2023-08-06 21:29:26 -04:00
|
|
|
import {
|
|
|
|
useRef,
|
|
|
|
useEffect,
|
2023-08-09 20:49:10 +10:00
|
|
|
useLayoutEffect,
|
2023-08-06 21:29:26 -04:00
|
|
|
useCallback,
|
|
|
|
MouseEventHandler,
|
|
|
|
} from 'react'
|
2023-07-21 16:53:06 +10:00
|
|
|
import { DebugPanel } from './components/DebugPanel'
|
2023-08-06 21:29:26 -04:00
|
|
|
import { v4 as uuidv4 } from 'uuid'
|
2023-08-18 19:37:52 +10:00
|
|
|
import { asyncParser } from './lang/abstractSyntaxTree'
|
2023-08-08 12:39:11 -04:00
|
|
|
import { _executor } from './lang/executor'
|
2023-09-09 01:38:36 -04:00
|
|
|
import { PaneType, useStore } from './useStore'
|
2023-07-26 14:10:30 -05:00
|
|
|
import { Logs, KCLErrors } from './components/Logs'
|
2023-08-06 21:29:26 -04:00
|
|
|
import { CollapsiblePanel } from './components/CollapsiblePanel'
|
2023-02-03 10:04:16 +11:00
|
|
|
import { MemoryPanel } from './components/MemoryPanel'
|
2023-02-21 10:28:34 +11:00
|
|
|
import { useHotKeyListener } from './hooks/useHotKeyListener'
|
2023-03-06 20:13:34 +11:00
|
|
|
import { Stream } from './components/Stream'
|
2023-03-07 15:45:59 +11:00
|
|
|
import ModalContainer from 'react-modal-promise'
|
2023-08-06 21:29:26 -04:00
|
|
|
import {
|
|
|
|
EngineCommand,
|
|
|
|
EngineCommandManager,
|
|
|
|
} from './lang/std/engineConnection'
|
2023-09-09 01:38:36 -04:00
|
|
|
import { throttle } from './lib/utils'
|
2023-07-13 07:22:08 -04:00
|
|
|
import { AppHeader } from './components/AppHeader'
|
2023-09-09 01:38:36 -04:00
|
|
|
import { KCLError } from './lang/errors'
|
2023-08-06 21:29:26 -04:00
|
|
|
import { Resizable } from 're-resizable'
|
|
|
|
import {
|
|
|
|
faCode,
|
|
|
|
faCodeCommit,
|
|
|
|
faSquareRootVariable,
|
|
|
|
} from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { useHotkeys } from 'react-hotkeys-hook'
|
2023-08-09 20:49:10 +10:00
|
|
|
import { getNormalisedCoordinates } from './lib/utils'
|
2023-08-15 21:56:24 -04:00
|
|
|
import { isTauri } from './lib/isTauri'
|
2023-09-09 01:38:36 -04:00
|
|
|
import { useLoaderData } from 'react-router-dom'
|
2023-08-15 21:56:24 -04:00
|
|
|
import { IndexLoaderData } from './Router'
|
2023-08-29 10:48:55 -04:00
|
|
|
import { useGlobalStateContext } from 'hooks/useGlobalStateContext'
|
2023-08-31 16:08:15 -04:00
|
|
|
import { onboardingPaths } from 'routes/Onboarding'
|
2023-09-08 10:13:35 -04:00
|
|
|
import { cameraMouseDragGuards } from 'lib/cameraControls'
|
|
|
|
import { CameraDragInteractionType_type } from '@kittycad/lib/dist/types/src/models'
|
2023-09-09 01:38:36 -04:00
|
|
|
import { CodeMenu } from 'components/CodeMenu'
|
|
|
|
import { TextEditor } from 'components/TextEditor'
|
|
|
|
import { Themes, getSystemTheme } from 'lib/theme'
|
2022-11-22 09:06:08 +11:00
|
|
|
|
2023-06-22 16:43:33 +10:00
|
|
|
export function App() {
|
2023-08-18 10:27:01 -04:00
|
|
|
const { code: loadedCode, project } = useLoaderData() as IndexLoaderData
|
2023-09-09 01:38:36 -04:00
|
|
|
|
2023-08-09 20:49:10 +10:00
|
|
|
const streamRef = useRef<HTMLDivElement>(null)
|
2023-02-21 10:28:34 +11:00
|
|
|
useHotKeyListener()
|
2022-11-27 14:06:33 +11:00
|
|
|
const {
|
|
|
|
addLog,
|
2023-07-26 14:10:30 -05:00
|
|
|
addKCLError,
|
2022-11-28 09:37:46 +11:00
|
|
|
setCode,
|
|
|
|
setAst,
|
2022-12-06 05:40:05 +11:00
|
|
|
setError,
|
2023-01-04 01:28:26 +11:00
|
|
|
setProgramMemory,
|
2023-02-03 11:09:09 +11:00
|
|
|
resetLogs,
|
2023-07-26 18:16:20 -05:00
|
|
|
resetKCLErrors,
|
2023-06-22 16:43:33 +10:00
|
|
|
setArtifactMap,
|
2023-08-09 20:49:10 +10:00
|
|
|
engineCommandManager,
|
2023-06-22 16:43:33 +10:00
|
|
|
setEngineCommandManager,
|
2023-09-06 01:32:53 -04:00
|
|
|
highlightRange,
|
2023-06-22 16:43:33 +10:00
|
|
|
setHighlightRange,
|
|
|
|
setCursor2,
|
|
|
|
setMediaStream,
|
2023-06-23 14:19:15 +10:00
|
|
|
setIsStreamReady,
|
|
|
|
isStreamReady,
|
2023-09-08 10:13:35 -04:00
|
|
|
buttonDownInStream,
|
2023-08-06 21:29:26 -04:00
|
|
|
openPanes,
|
|
|
|
setOpenPanes,
|
2023-08-18 10:27:01 -04:00
|
|
|
didDragInStream,
|
2023-08-09 20:49:10 +10:00
|
|
|
setStreamDimensions,
|
|
|
|
streamDimensions,
|
2023-09-08 17:50:37 +10:00
|
|
|
setIsExecuting,
|
|
|
|
defferedCode,
|
2023-09-13 08:36:47 +10:00
|
|
|
guiMode,
|
2022-11-27 14:06:33 +11:00
|
|
|
} = useStore((s) => ({
|
2023-09-13 08:36:47 +10:00
|
|
|
guiMode: s.guiMode,
|
2022-11-27 14:06:33 +11:00
|
|
|
addLog: s.addLog,
|
2023-09-08 17:50:37 +10:00
|
|
|
defferedCode: s.defferedCode,
|
2022-11-28 09:37:46 +11:00
|
|
|
setCode: s.setCode,
|
|
|
|
setAst: s.setAst,
|
2022-12-06 05:40:05 +11:00
|
|
|
setError: s.setError,
|
2023-01-04 01:28:26 +11:00
|
|
|
setProgramMemory: s.setProgramMemory,
|
2023-02-03 11:09:09 +11:00
|
|
|
resetLogs: s.resetLogs,
|
2023-07-26 18:16:20 -05:00
|
|
|
resetKCLErrors: s.resetKCLErrors,
|
2023-06-22 16:43:33 +10:00
|
|
|
setArtifactMap: s.setArtifactNSourceRangeMaps,
|
|
|
|
engineCommandManager: s.engineCommandManager,
|
|
|
|
setEngineCommandManager: s.setEngineCommandManager,
|
2023-09-06 01:32:53 -04:00
|
|
|
highlightRange: s.highlightRange,
|
2023-06-22 16:43:33 +10:00
|
|
|
setHighlightRange: s.setHighlightRange,
|
|
|
|
setCursor2: s.setCursor2,
|
2023-06-23 14:19:15 +10:00
|
|
|
setMediaStream: s.setMediaStream,
|
|
|
|
isStreamReady: s.isStreamReady,
|
|
|
|
setIsStreamReady: s.setIsStreamReady,
|
2023-09-08 10:13:35 -04:00
|
|
|
buttonDownInStream: s.buttonDownInStream,
|
2023-07-26 14:10:30 -05:00
|
|
|
addKCLError: s.addKCLError,
|
2023-08-06 21:29:26 -04:00
|
|
|
openPanes: s.openPanes,
|
|
|
|
setOpenPanes: s.setOpenPanes,
|
2023-08-18 10:27:01 -04:00
|
|
|
didDragInStream: s.didDragInStream,
|
2023-08-09 20:49:10 +10:00
|
|
|
setStreamDimensions: s.setStreamDimensions,
|
|
|
|
streamDimensions: s.streamDimensions,
|
2023-09-08 17:50:37 +10:00
|
|
|
setIsExecuting: s.setIsExecuting,
|
2022-11-27 14:06:33 +11:00
|
|
|
}))
|
2023-08-28 20:31:49 -04:00
|
|
|
|
2023-08-29 10:48:55 -04:00
|
|
|
const {
|
|
|
|
auth: {
|
|
|
|
context: { token },
|
|
|
|
},
|
|
|
|
settings: {
|
2023-09-09 01:38:36 -04:00
|
|
|
context: { showDebugPanel, onboardingStatus, cameraControls, theme },
|
2023-08-29 10:48:55 -04:00
|
|
|
},
|
|
|
|
} = useGlobalStateContext()
|
2023-08-06 21:29:26 -04:00
|
|
|
|
2023-08-09 13:57:07 -04:00
|
|
|
const editorTheme = theme === Themes.System ? getSystemTheme() : theme
|
|
|
|
|
2023-08-06 21:29:26 -04:00
|
|
|
// Pane toggling keyboard shortcuts
|
|
|
|
const togglePane = useCallback(
|
|
|
|
(newPane: PaneType) =>
|
|
|
|
openPanes.includes(newPane)
|
|
|
|
? setOpenPanes(openPanes.filter((p) => p !== newPane))
|
|
|
|
: setOpenPanes([...openPanes, newPane]),
|
|
|
|
[openPanes, setOpenPanes]
|
|
|
|
)
|
|
|
|
useHotkeys('shift + c', () => togglePane('code'))
|
|
|
|
useHotkeys('shift + v', () => togglePane('variables'))
|
|
|
|
useHotkeys('shift + l', () => togglePane('logs'))
|
|
|
|
useHotkeys('shift + e', () => togglePane('kclErrors'))
|
|
|
|
useHotkeys('shift + d', () => togglePane('debug'))
|
|
|
|
|
2023-08-07 17:07:28 -04:00
|
|
|
const paneOpacity =
|
2023-08-31 16:08:15 -04:00
|
|
|
onboardingStatus === onboardingPaths.CAMERA
|
2023-08-07 17:07:28 -04:00
|
|
|
? 'opacity-20'
|
2023-08-18 10:27:01 -04:00
|
|
|
: didDragInStream
|
2023-08-07 17:07:28 -04:00
|
|
|
? 'opacity-40'
|
|
|
|
: ''
|
2023-08-06 21:29:26 -04:00
|
|
|
|
2023-08-15 21:56:24 -04:00
|
|
|
// Use file code loaded from disk
|
|
|
|
// on mount, and overwrite any locally-stored code
|
|
|
|
useEffect(() => {
|
|
|
|
if (isTauri() && loadedCode !== null) {
|
|
|
|
setCode(loadedCode)
|
|
|
|
}
|
|
|
|
return () => {
|
|
|
|
// Clear code on unmount if in desktop app
|
|
|
|
if (isTauri()) {
|
|
|
|
setCode('')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, [loadedCode, setCode])
|
|
|
|
|
2023-08-09 20:49:10 +10:00
|
|
|
const streamWidth = streamRef?.current?.offsetWidth
|
|
|
|
const streamHeight = streamRef?.current?.offsetHeight
|
|
|
|
|
2023-09-01 17:29:03 -07:00
|
|
|
const width = streamWidth ? streamWidth : 0
|
2023-08-09 20:49:10 +10:00
|
|
|
const quadWidth = Math.round(width / 4) * 4
|
2023-09-01 17:29:03 -07:00
|
|
|
const height = streamHeight ? streamHeight : 0
|
2023-08-09 20:49:10 +10:00
|
|
|
const quadHeight = Math.round(height / 4) * 4
|
|
|
|
|
|
|
|
useLayoutEffect(() => {
|
|
|
|
setStreamDimensions({
|
|
|
|
streamWidth: quadWidth,
|
|
|
|
streamHeight: quadHeight,
|
|
|
|
})
|
|
|
|
if (!width || !height) return
|
|
|
|
const eng = new EngineCommandManager({
|
2023-07-11 20:34:09 +10:00
|
|
|
setMediaStream,
|
|
|
|
setIsStreamReady,
|
2023-08-09 20:49:10 +10:00
|
|
|
width: quadWidth,
|
|
|
|
height: quadHeight,
|
2023-07-11 20:34:09 +10:00
|
|
|
token,
|
|
|
|
})
|
2023-08-09 20:49:10 +10:00
|
|
|
setEngineCommandManager(eng)
|
2023-06-23 09:56:37 +10:00
|
|
|
return () => {
|
2023-08-09 20:49:10 +10:00
|
|
|
eng?.tearDown()
|
2023-06-23 09:56:37 +10:00
|
|
|
}
|
2023-08-09 20:49:10 +10:00
|
|
|
}, [quadWidth, quadHeight])
|
2023-06-23 09:56:37 +10:00
|
|
|
|
2022-11-23 21:28:38 +11:00
|
|
|
useEffect(() => {
|
2023-06-23 14:19:15 +10:00
|
|
|
if (!isStreamReady) return
|
2023-08-31 05:19:37 +10:00
|
|
|
if (!engineCommandManager) return
|
|
|
|
let unsubFn: any[] = []
|
2023-02-21 14:50:22 +11:00
|
|
|
const asyncWrap = async () => {
|
|
|
|
try {
|
2023-09-08 17:50:37 +10:00
|
|
|
if (!defferedCode) {
|
2023-09-13 08:36:47 +10:00
|
|
|
setAst({
|
|
|
|
start: 0,
|
|
|
|
end: 0,
|
|
|
|
body: [],
|
|
|
|
nonCodeMeta: {
|
|
|
|
noneCodeNodes: {},
|
|
|
|
start: null,
|
|
|
|
},
|
|
|
|
})
|
2023-09-12 18:10:27 -07:00
|
|
|
setProgramMemory({ root: {}, return: null })
|
2023-09-13 08:36:47 +10:00
|
|
|
engineCommandManager.endSession()
|
|
|
|
engineCommandManager.startNewSession()
|
2023-02-21 14:50:22 +11:00
|
|
|
return
|
|
|
|
}
|
2023-09-08 17:50:37 +10:00
|
|
|
const _ast = await asyncParser(defferedCode)
|
2023-02-21 14:50:22 +11:00
|
|
|
setAst(_ast)
|
|
|
|
resetLogs()
|
2023-07-26 18:16:20 -05:00
|
|
|
resetKCLErrors()
|
2023-08-31 05:19:37 +10:00
|
|
|
engineCommandManager.endSession()
|
|
|
|
engineCommandManager.startNewSession()
|
2023-09-08 17:50:37 +10:00
|
|
|
setIsExecuting(true)
|
2023-08-07 20:33:38 -05:00
|
|
|
const programMemory = await _executor(
|
2023-06-22 16:43:33 +10:00
|
|
|
_ast,
|
|
|
|
{
|
|
|
|
root: {
|
|
|
|
_0: {
|
2023-09-12 18:10:27 -07:00
|
|
|
type: 'UserVal',
|
2023-06-22 16:43:33 +10:00
|
|
|
value: 0,
|
|
|
|
__meta: [],
|
|
|
|
},
|
|
|
|
_90: {
|
2023-09-12 18:10:27 -07:00
|
|
|
type: 'UserVal',
|
2023-06-22 16:43:33 +10:00
|
|
|
value: 90,
|
|
|
|
__meta: [],
|
|
|
|
},
|
|
|
|
_180: {
|
2023-09-12 18:10:27 -07:00
|
|
|
type: 'UserVal',
|
2023-06-22 16:43:33 +10:00
|
|
|
value: 180,
|
|
|
|
__meta: [],
|
|
|
|
},
|
|
|
|
_270: {
|
2023-09-12 18:10:27 -07:00
|
|
|
type: 'UserVal',
|
2023-06-22 16:43:33 +10:00
|
|
|
value: 270,
|
|
|
|
__meta: [],
|
|
|
|
},
|
2023-04-01 21:25:00 +11:00
|
|
|
},
|
2023-09-12 18:10:27 -07:00
|
|
|
return: null,
|
2022-11-27 14:06:33 +11:00
|
|
|
},
|
2023-08-24 15:34:51 -07:00
|
|
|
engineCommandManager
|
2023-08-07 20:33:38 -05:00
|
|
|
)
|
2023-06-22 16:43:33 +10:00
|
|
|
|
2023-08-07 20:33:38 -05:00
|
|
|
const { artifactMap, sourceRangeMap } =
|
|
|
|
await engineCommandManager.waitForAllCommands()
|
2023-09-08 17:50:37 +10:00
|
|
|
setIsExecuting(false)
|
2023-09-13 08:36:47 +10:00
|
|
|
if (programMemory !== undefined) {
|
|
|
|
setProgramMemory(programMemory)
|
|
|
|
}
|
2023-01-08 16:37:31 +11:00
|
|
|
|
2023-08-07 20:33:38 -05:00
|
|
|
setArtifactMap({ artifactMap, sourceRangeMap })
|
2023-08-31 07:39:03 +10:00
|
|
|
const unSubHover = engineCommandManager.subscribeToUnreliable({
|
2023-08-31 05:19:37 +10:00
|
|
|
event: 'highlight_set_entity',
|
|
|
|
callback: ({ data }) => {
|
2023-09-06 01:32:53 -04:00
|
|
|
if (data?.entity_id) {
|
2023-08-31 05:19:37 +10:00
|
|
|
const sourceRange = sourceRangeMap[data.entity_id]
|
|
|
|
setHighlightRange(sourceRange)
|
2023-09-06 01:32:53 -04:00
|
|
|
} else if (
|
|
|
|
!highlightRange ||
|
|
|
|
(highlightRange[0] !== 0 && highlightRange[1] !== 0)
|
|
|
|
) {
|
|
|
|
setHighlightRange([0, 0])
|
2023-08-31 05:19:37 +10:00
|
|
|
}
|
|
|
|
},
|
2023-06-22 16:43:33 +10:00
|
|
|
})
|
2023-08-31 05:19:37 +10:00
|
|
|
const unSubClick = engineCommandManager.subscribeTo({
|
|
|
|
event: 'select_with_point',
|
|
|
|
callback: ({ data }) => {
|
|
|
|
if (!data?.entity_id) {
|
|
|
|
setCursor2()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
const sourceRange = sourceRangeMap[data.entity_id]
|
|
|
|
setCursor2({ range: sourceRange, type: 'default' })
|
|
|
|
},
|
2023-08-07 20:33:38 -05:00
|
|
|
})
|
2023-08-31 05:19:37 +10:00
|
|
|
unsubFn.push(unSubHover, unSubClick)
|
2023-08-07 20:33:38 -05:00
|
|
|
|
|
|
|
setError()
|
2023-02-21 14:50:22 +11:00
|
|
|
} catch (e: any) {
|
2023-09-08 17:50:37 +10:00
|
|
|
setIsExecuting(false)
|
2023-07-26 14:10:30 -05:00
|
|
|
if (e instanceof KCLError) {
|
|
|
|
addKCLError(e)
|
|
|
|
} else {
|
|
|
|
setError('problem')
|
|
|
|
console.log(e)
|
|
|
|
addLog(e)
|
|
|
|
}
|
2023-02-21 14:50:22 +11:00
|
|
|
}
|
2022-11-23 21:28:38 +11:00
|
|
|
}
|
2023-02-21 14:50:22 +11:00
|
|
|
asyncWrap()
|
2023-08-31 05:19:37 +10:00
|
|
|
return () => {
|
|
|
|
unsubFn.forEach((fn) => fn())
|
|
|
|
}
|
2023-09-08 17:50:37 +10:00
|
|
|
}, [defferedCode, isStreamReady, engineCommandManager])
|
2023-07-31 06:33:10 -04:00
|
|
|
|
2023-08-06 21:29:26 -04:00
|
|
|
const debounceSocketSend = throttle<EngineCommand>((message) => {
|
|
|
|
engineCommandManager?.sendSceneCommand(message)
|
|
|
|
}, 16)
|
2023-09-08 10:13:35 -04:00
|
|
|
const handleMouseMove: MouseEventHandler<HTMLDivElement> = (e) => {
|
|
|
|
e.nativeEvent.preventDefault()
|
2023-08-09 20:49:10 +10:00
|
|
|
|
|
|
|
const { x, y } = getNormalisedCoordinates({
|
2023-09-08 10:13:35 -04:00
|
|
|
clientX: e.clientX,
|
|
|
|
clientY: e.clientY,
|
|
|
|
el: e.currentTarget,
|
2023-08-09 20:49:10 +10:00
|
|
|
...streamDimensions,
|
|
|
|
})
|
2023-08-06 21:29:26 -04:00
|
|
|
|
2023-08-09 20:49:10 +10:00
|
|
|
const newCmdId = uuidv4()
|
2023-09-13 08:36:47 +10:00
|
|
|
if (buttonDownInStream === undefined) {
|
|
|
|
if (
|
|
|
|
guiMode.mode === 'sketch' &&
|
|
|
|
guiMode.sketchMode === ('sketch_line' as any)
|
|
|
|
) {
|
|
|
|
debounceSocketSend({
|
|
|
|
type: 'modeling_cmd_req',
|
|
|
|
cmd_id: newCmdId,
|
|
|
|
cmd: {
|
|
|
|
type: 'mouse_move',
|
|
|
|
window: { x, y },
|
|
|
|
},
|
|
|
|
})
|
|
|
|
} else if (
|
|
|
|
guiMode.mode === 'sketch' &&
|
|
|
|
guiMode.sketchMode === ('move' as any)
|
|
|
|
) {
|
|
|
|
debounceSocketSend({
|
|
|
|
type: 'modeling_cmd_req',
|
|
|
|
cmd_id: newCmdId,
|
|
|
|
cmd: {
|
|
|
|
type: 'handle_mouse_drag_move',
|
|
|
|
window: { x, y },
|
|
|
|
},
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
debounceSocketSend({
|
|
|
|
type: 'modeling_cmd_req',
|
|
|
|
cmd: {
|
|
|
|
type: 'highlight_set_entity',
|
|
|
|
selected_at_window: { x, y },
|
|
|
|
},
|
|
|
|
cmd_id: newCmdId,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
} else {
|
2023-09-08 10:13:35 -04:00
|
|
|
const interactionGuards = cameraMouseDragGuards[cameraControls]
|
|
|
|
let interaction: CameraDragInteractionType_type
|
|
|
|
|
|
|
|
const eWithButton = { ...e, button: buttonDownInStream }
|
|
|
|
|
|
|
|
if (interactionGuards.pan.callback(eWithButton)) {
|
|
|
|
interaction = 'pan'
|
|
|
|
} else if (interactionGuards.rotate.callback(eWithButton)) {
|
|
|
|
interaction = 'rotate'
|
|
|
|
} else if (interactionGuards.zoom.dragCallback(eWithButton)) {
|
|
|
|
interaction = 'zoom'
|
|
|
|
} else {
|
2023-09-13 08:36:47 +10:00
|
|
|
console.log('none')
|
2023-09-08 10:13:35 -04:00
|
|
|
return
|
|
|
|
}
|
2023-09-11 16:21:23 -04:00
|
|
|
|
2023-08-06 21:29:26 -04:00
|
|
|
debounceSocketSend({
|
|
|
|
type: 'modeling_cmd_req',
|
|
|
|
cmd: {
|
|
|
|
type: 'camera_drag_move',
|
|
|
|
interaction,
|
|
|
|
window: { x, y },
|
|
|
|
},
|
|
|
|
cmd_id: newCmdId,
|
|
|
|
})
|
2023-08-09 20:49:10 +10:00
|
|
|
}
|
|
|
|
}
|
2023-08-06 21:29:26 -04:00
|
|
|
|
2022-11-12 13:11:54 +11:00
|
|
|
return (
|
2023-08-06 21:29:26 -04:00
|
|
|
<div
|
2023-08-21 10:52:41 -04:00
|
|
|
className="h-screen overflow-hidden relative flex flex-col cursor-pointer select-none"
|
2023-08-06 21:29:26 -04:00
|
|
|
onMouseMove={handleMouseMove}
|
2023-08-09 20:49:10 +10:00
|
|
|
ref={streamRef}
|
2023-08-06 21:29:26 -04:00
|
|
|
>
|
|
|
|
<AppHeader
|
|
|
|
className={
|
2023-08-07 17:07:28 -04:00
|
|
|
'transition-opacity transition-duration-75 ' +
|
|
|
|
paneOpacity +
|
2023-09-08 10:13:35 -04:00
|
|
|
(buttonDownInStream ? ' pointer-events-none' : '')
|
2023-08-06 21:29:26 -04:00
|
|
|
}
|
2023-08-18 10:27:01 -04:00
|
|
|
project={project}
|
|
|
|
enableMenu={true}
|
2023-08-06 21:29:26 -04:00
|
|
|
/>
|
2023-03-07 15:45:59 +11:00
|
|
|
<ModalContainer />
|
2023-08-06 21:29:26 -04:00
|
|
|
<Resizable
|
|
|
|
className={
|
2023-08-08 12:39:11 -04:00
|
|
|
'h-full flex flex-col flex-1 z-10 my-5 ml-5 pr-1 transition-opacity transition-duration-75 ' +
|
2023-09-08 10:13:35 -04:00
|
|
|
(buttonDownInStream || onboardingStatus === 'camera'
|
2023-08-06 21:29:26 -04:00
|
|
|
? ' pointer-events-none '
|
|
|
|
: ' ') +
|
|
|
|
paneOpacity
|
|
|
|
}
|
|
|
|
defaultSize={{
|
2023-09-13 08:36:47 +10:00
|
|
|
width: '550px',
|
2023-08-06 21:29:26 -04:00
|
|
|
height: 'auto',
|
|
|
|
}}
|
|
|
|
minWidth={200}
|
2023-09-13 08:36:47 +10:00
|
|
|
maxWidth={800}
|
2023-08-06 21:29:26 -04:00
|
|
|
minHeight={'auto'}
|
|
|
|
maxHeight={'auto'}
|
|
|
|
handleClasses={{
|
|
|
|
right:
|
|
|
|
'hover:bg-liquid-30/40 dark:hover:bg-liquid-10/40 bg-transparent transition-colors duration-100 transition-ease-out delay-100',
|
|
|
|
}}
|
|
|
|
>
|
2023-08-08 12:39:11 -04:00
|
|
|
<div className="h-full flex flex-col justify-between">
|
|
|
|
<CollapsiblePanel
|
|
|
|
title="Code"
|
|
|
|
icon={faCode}
|
2023-09-06 21:27:30 -04:00
|
|
|
className="open:!mb-2"
|
2023-08-08 12:39:11 -04:00
|
|
|
open={openPanes.includes('code')}
|
2023-09-09 01:38:36 -04:00
|
|
|
menu={<CodeMenu />}
|
2023-08-08 12:39:11 -04:00
|
|
|
>
|
2023-09-09 01:38:36 -04:00
|
|
|
<TextEditor theme={editorTheme} />
|
2023-08-08 12:39:11 -04:00
|
|
|
</CollapsiblePanel>
|
|
|
|
<section className="flex flex-col">
|
|
|
|
<MemoryPanel
|
2023-08-09 13:57:07 -04:00
|
|
|
theme={editorTheme}
|
2023-08-08 12:39:11 -04:00
|
|
|
open={openPanes.includes('variables')}
|
|
|
|
title="Variables"
|
|
|
|
icon={faSquareRootVariable}
|
|
|
|
/>
|
|
|
|
<Logs
|
2023-08-09 13:57:07 -04:00
|
|
|
theme={editorTheme}
|
2023-08-08 12:39:11 -04:00
|
|
|
open={openPanes.includes('logs')}
|
|
|
|
title="Logs"
|
|
|
|
icon={faCodeCommit}
|
|
|
|
/>
|
|
|
|
<KCLErrors
|
2023-08-09 13:57:07 -04:00
|
|
|
theme={editorTheme}
|
2023-08-08 12:39:11 -04:00
|
|
|
open={openPanes.includes('kclErrors')}
|
|
|
|
title="KCL Errors"
|
|
|
|
iconClassNames={{ icon: 'group-open:text-destroy-30' }}
|
2023-08-06 21:29:26 -04:00
|
|
|
/>
|
2023-08-08 12:39:11 -04:00
|
|
|
</section>
|
|
|
|
</div>
|
2023-08-06 21:29:26 -04:00
|
|
|
</Resizable>
|
|
|
|
<Stream className="absolute inset-0 z-0" />
|
2023-08-28 20:31:49 -04:00
|
|
|
{showDebugPanel && (
|
2023-08-06 21:29:26 -04:00
|
|
|
<DebugPanel
|
|
|
|
title="Debug"
|
|
|
|
className={
|
2023-08-07 17:07:28 -04:00
|
|
|
'transition-opacity transition-duration-75 ' +
|
|
|
|
paneOpacity +
|
2023-09-08 10:13:35 -04:00
|
|
|
(buttonDownInStream ? ' pointer-events-none' : '')
|
2023-08-06 21:29:26 -04:00
|
|
|
}
|
|
|
|
open={openPanes.includes('debug')}
|
|
|
|
/>
|
|
|
|
)}
|
2022-11-12 13:11:54 +11:00
|
|
|
</div>
|
2022-11-26 08:34:23 +11:00
|
|
|
)
|
2022-11-12 13:11:54 +11:00
|
|
|
}
|