2024-04-15 12:04:17 -04:00
|
|
|
import {
|
|
|
|
IconDefinition,
|
|
|
|
faBugSlash,
|
|
|
|
faCode,
|
|
|
|
faCodeCommit,
|
|
|
|
faSquareRootVariable,
|
|
|
|
} from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { KclEditorMenu } from 'components/ModelingSidebar/ModelingPanes/KclEditorMenu'
|
|
|
|
import { CustomIconName } from 'components/CustomIcon'
|
|
|
|
import { KclEditorPane } from 'components/ModelingSidebar/ModelingPanes/KclEditorPane'
|
|
|
|
import { ReactNode } from 'react'
|
2024-05-17 16:40:20 -04:00
|
|
|
import { MemoryPane, MemoryPaneMenu } from './MemoryPane'
|
2024-08-01 19:40:16 -07:00
|
|
|
import { LogsPane } from './LoggingPanes'
|
2024-04-15 12:04:17 -04:00
|
|
|
import { DebugPane } from './DebugPane'
|
2024-04-25 09:56:55 -04:00
|
|
|
import { FileTreeInner, FileTreeMenu } from 'components/FileTree'
|
2024-07-31 23:29:24 -04:00
|
|
|
import { useKclContext } from 'lang/KclProvider'
|
2024-04-15 12:04:17 -04:00
|
|
|
|
2024-04-25 09:56:55 -04:00
|
|
|
export type SidebarType =
|
|
|
|
| 'code'
|
|
|
|
| 'debug'
|
|
|
|
| 'export'
|
|
|
|
| 'files'
|
|
|
|
| 'logs'
|
|
|
|
| 'lspMessages'
|
|
|
|
| 'variables'
|
|
|
|
|
2024-07-31 23:29:24 -04:00
|
|
|
/**
|
|
|
|
* This interface can be extended as more context is needed for the panes
|
|
|
|
* to determine if they should show their badges or not.
|
|
|
|
*/
|
|
|
|
interface PaneCallbackProps {
|
|
|
|
kclContext: ReturnType<typeof useKclContext>
|
|
|
|
}
|
|
|
|
|
2024-04-25 09:56:55 -04:00
|
|
|
export type SidebarPane = {
|
|
|
|
id: SidebarType
|
2024-04-15 12:04:17 -04:00
|
|
|
title: string
|
|
|
|
icon: CustomIconName | IconDefinition
|
2024-04-25 09:56:55 -04:00
|
|
|
keybinding: string
|
2024-04-15 12:04:17 -04:00
|
|
|
Content: ReactNode | React.FC
|
|
|
|
Menu?: ReactNode | React.FC
|
2024-04-25 09:56:55 -04:00
|
|
|
hideOnPlatform?: 'desktop' | 'web'
|
2024-07-31 23:29:24 -04:00
|
|
|
showBadge?: (props: PaneCallbackProps) => boolean | number
|
2024-04-15 12:04:17 -04:00
|
|
|
}
|
|
|
|
|
2024-07-24 22:02:16 -04:00
|
|
|
export const sidebarPanes: SidebarPane[] = [
|
2024-04-15 12:04:17 -04:00
|
|
|
{
|
|
|
|
id: 'code',
|
|
|
|
title: 'KCL Code',
|
|
|
|
icon: faCode,
|
|
|
|
Content: KclEditorPane,
|
2024-07-24 22:02:16 -04:00
|
|
|
keybinding: 'Shift + C',
|
2024-04-15 12:04:17 -04:00
|
|
|
Menu: KclEditorMenu,
|
2024-08-01 19:40:16 -07:00
|
|
|
showBadge: ({ kclContext }) => kclContext.errors.length,
|
2024-04-15 12:04:17 -04:00
|
|
|
},
|
2024-04-25 09:56:55 -04:00
|
|
|
{
|
|
|
|
id: 'files',
|
|
|
|
title: 'Project Files',
|
|
|
|
icon: 'folder',
|
|
|
|
Content: FileTreeInner,
|
2024-07-24 22:02:16 -04:00
|
|
|
keybinding: 'Shift + F',
|
2024-04-25 09:56:55 -04:00
|
|
|
Menu: FileTreeMenu,
|
|
|
|
hideOnPlatform: 'web',
|
|
|
|
},
|
2024-04-15 12:04:17 -04:00
|
|
|
{
|
|
|
|
id: 'variables',
|
|
|
|
title: 'Variables',
|
|
|
|
icon: faSquareRootVariable,
|
|
|
|
Content: MemoryPane,
|
2024-05-17 16:40:20 -04:00
|
|
|
Menu: MemoryPaneMenu,
|
2024-07-24 22:02:16 -04:00
|
|
|
keybinding: 'Shift + V',
|
2024-04-15 12:04:17 -04:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'logs',
|
|
|
|
title: 'Logs',
|
|
|
|
icon: faCodeCommit,
|
|
|
|
Content: LogsPane,
|
2024-07-24 22:02:16 -04:00
|
|
|
keybinding: 'Shift + L',
|
2024-04-15 12:04:17 -04:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'debug',
|
|
|
|
title: 'Debug',
|
|
|
|
icon: faBugSlash,
|
|
|
|
Content: DebugPane,
|
2024-07-24 22:02:16 -04:00
|
|
|
keybinding: 'Shift + D',
|
2024-04-15 12:04:17 -04:00
|
|
|
},
|
|
|
|
]
|