Compare commits

..

1 Commits

Author SHA1 Message Date
aa19bcbc09 tmp media stream fix 2024-07-12 08:39:49 +10:00
33 changed files with 275 additions and 259 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "untitled-app",
"version": "0.24.1",
"version": "0.24.0",
"private": true,
"dependencies": {
"@codemirror/autocomplete": "^6.17.0",

View File

@ -93,10 +93,23 @@ export class LanguageServerPlugin implements PluginValue {
private doSemanticTokens: boolean = false
private doFoldingRanges: boolean = false
// When a doc update needs to be sent to the server, this holds the
// timeout handle for it. When null, the server has the up-to-date
// document.
private sendScheduled: number | null = null
private _defferer = deferExecution((code: string) => {
try {
// Update the state (not the editor) with the new code.
this.client.textDocumentDidChange({
textDocument: {
uri: this.getDocUri(),
version: this.documentVersion++,
},
contentChanges: [{ text: code }],
})
this.requestSemanticTokens()
this.updateFoldingRanges()
} catch (e) {
console.error(e)
}
}, this.changesDelay)
constructor(options: LanguageServerOptions, private view: EditorView) {
this.client = options.client
@ -139,9 +152,14 @@ export class LanguageServerPlugin implements PluginValue {
}
update(viewUpdate: ViewUpdate) {
if (viewUpdate.docChanged) {
this.scheduleSendDoc()
// If the doc didn't change we can return early.
if (!viewUpdate.docChanged) {
return
}
this.sendChange({
documentText: viewUpdate.state.doc.toString(),
})
}
destroy() {
@ -166,6 +184,16 @@ export class LanguageServerPlugin implements PluginValue {
this.updateFoldingRanges()
}
async sendChange({ documentText }: { documentText: string }) {
if (!this.client.ready) return
this._defferer(documentText)
}
requestDiagnostics() {
this.sendChange({ documentText: this.getDocText() })
}
async requestHoverTooltip(
view: EditorView,
{ line, character }: { line: number; character: number }
@ -176,7 +204,7 @@ export class LanguageServerPlugin implements PluginValue {
)
return null
this.ensureDocSent()
this.sendChange({ documentText: this.getDocText() })
const result = await this.client.textDocumentHover({
textDocument: { uri: this.getDocUri() },
position: { line, character },
@ -199,42 +227,6 @@ export class LanguageServerPlugin implements PluginValue {
return { pos, end, create: (view) => ({ dom }), above: true }
}
scheduleSendDoc() {
if (this.sendScheduled != null) window.clearTimeout(this.sendScheduled)
this.sendScheduled = window.setTimeout(
() => this.sendDoc(),
this.changesDelay
)
}
sendDoc() {
if (this.sendScheduled != null) {
window.clearTimeout(this.sendScheduled)
this.sendScheduled = null
}
if (!this.client.ready) return
try {
// Update the state (not the editor) with the new code.
this.client.textDocumentDidChange({
textDocument: {
uri: this.getDocUri(),
version: this.documentVersion++,
},
contentChanges: [{ text: this.view.state.doc.toString() }],
})
this.requestSemanticTokens()
this.updateFoldingRanges()
} catch (e) {
console.error(e)
}
}
ensureDocSent() {
if (this.sendScheduled != null) this.sendDoc()
}
async getFoldingRanges(): Promise<LSP.FoldingRange[] | null> {
if (
!this.doFoldingRanges ||
@ -292,7 +284,13 @@ export class LanguageServerPlugin implements PluginValue {
)
return null
this.ensureDocSent()
this.client.textDocumentDidChange({
textDocument: {
uri: this.getDocUri(),
version: this.documentVersion++,
},
contentChanges: [{ text: this.getDocText() }],
})
const result = await this.client.textDocumentFormatting({
textDocument: { uri: this.getDocUri() },
@ -332,7 +330,9 @@ export class LanguageServerPlugin implements PluginValue {
)
return null
this.ensureDocSent()
this.sendChange({
documentText: context.state.doc.toString(),
})
const result = await this.client.textDocumentCompletion({
textDocument: { uri: this.getDocUri() },

View File

@ -80,5 +80,5 @@
}
},
"productName": "Zoo Modeling App",
"version": "0.24.1"
"version": "0.24.0"
}

View File

@ -26,6 +26,7 @@ import useHotkeyWrapper from 'lib/hotkeyWrapper'
import Gizmo from 'components/Gizmo'
import { CoreDumpManager } from 'lib/coredump'
import { UnitsMenu } from 'components/UnitsMenu'
import { useAppState } from 'AppState'
export function App() {
useRefreshSettings(paths.FILE + 'SETTINGS')
@ -45,6 +46,8 @@ export function App() {
useHotKeyListener()
const { context } = useModelingContext()
const { streamDimensions, didDragInStream, buttonDownInStream } =
useAppState()
const { auth, settings } = useSettingsAuthContext()
const token = auth?.context?.token
@ -74,7 +77,7 @@ export function App() {
(p) => p === onboardingStatus.current
)
? 'opacity-20'
: context.store?.didDragInStream
: didDragInStream
? 'opacity-40'
: ''
@ -92,11 +95,11 @@ export function App() {
clientX: e.clientX,
clientY: e.clientY,
el: e.currentTarget,
...context.store?.streamDimensions,
...streamDimensions,
})
const newCmdId = uuidv4()
if (context.store?.buttonDownInStream === undefined) {
if (buttonDownInStream === undefined) {
debounceSocketSend({
type: 'modeling_cmd_req',
cmd: {
@ -118,7 +121,7 @@ export function App() {
className={
'transition-opacity transition-duration-75 ' +
paneOpacity +
(context.store?.buttonDownInStream ? ' pointer-events-none' : '')
(buttonDownInStream ? ' pointer-events-none' : '')
}
project={{ project, file }}
enableMenu={true}

View File

@ -1,4 +1,10 @@
import { createContext, useContext, useState, ReactNode } from 'react'
import {
createContext,
useContext,
useState,
ReactNode,
useEffect,
} from 'react'
/*
@ -11,11 +17,23 @@ Please do not fill this up with junk.
interface AppState {
isStreamReady: boolean
setAppState: (newAppState: Partial<AppState>) => void
mediaStream?: MediaStream
buttonDownInStream: number | undefined
didDragInStream: boolean
streamDimensions: { streamWidth: number; streamHeight: number }
// openPanes: SidebarType[]
}
const AppStateContext = createContext<AppState>({
isStreamReady: false,
setAppState: () => {},
buttonDownInStream: undefined,
didDragInStream: false,
streamDimensions: { streamWidth: 1280, streamHeight: 720 },
mediaStream: undefined,
// openPanes: persistedContext.openPanes || ['code'],
})
export const useAppState = () => useContext(AppStateContext)
@ -24,47 +42,38 @@ export const AppStateProvider = ({ children }: { children: ReactNode }) => {
const [appState, _setAppState] = useState<AppState>({
isStreamReady: false,
setAppState: () => {},
buttonDownInStream: undefined,
didDragInStream: false,
streamDimensions: { streamWidth: 1280, streamHeight: 720 },
mediaStream: undefined,
// openPanes: persistedContext.openPanes || ['code'],
})
const setAppState = (newAppState: Partial<AppState>) =>
_setAppState({ ...appState, ...newAppState })
useEffect(() => {
// console.log('appState change', appState)
}, [appState])
const setAppState = (newAppState: Partial<AppState>) => {
// console.log('appstate', newAppState)
_setAppState({
...appState,
...newAppState,
mediaStream: newAppState.mediaStream || appState.mediaStream,
})
}
return (
<AppStateContext.Provider
value={{
isStreamReady: appState.isStreamReady,
setAppState,
mediaStream: appState.mediaStream,
buttonDownInStream: appState.buttonDownInStream,
didDragInStream: appState.didDragInStream,
streamDimensions: appState.streamDimensions,
}}
>
{children}
</AppStateContext.Provider>
)
}
interface AppStream {
mediaStream: MediaStream
setMediaStream: (mediaStream: MediaStream) => void
}
const AppStreamContext = createContext<AppStream>({
mediaStream: undefined as unknown as MediaStream,
setMediaStream: () => {},
})
export const useAppStream = () => useContext(AppStreamContext)
export const AppStreamProvider = ({ children }: { children: ReactNode }) => {
const [mediaStream, setMediaStream] = useState<MediaStream>(
undefined as unknown as MediaStream
)
return (
<AppStreamContext.Provider
value={{
mediaStream,
setMediaStream,
}}
>
{children}
</AppStreamContext.Provider>
)
}

View File

@ -49,17 +49,17 @@ const router = createBrowserRouter([
/* Make sure auth is the outermost provider or else we will have
* inefficient re-renders, use the react profiler to see. */
element: (
<CommandBarProvider>
<SettingsAuthProvider>
<LspProvider>
<KclContextProvider>
<AppStateProvider>
<AppStateProvider>
<CommandBarProvider>
<SettingsAuthProvider>
<LspProvider>
<KclContextProvider>
<Outlet />
</AppStateProvider>
</KclContextProvider>
</LspProvider>
</SettingsAuthProvider>
</CommandBarProvider>
</KclContextProvider>
</LspProvider>
</SettingsAuthProvider>
</CommandBarProvider>
</AppStateProvider>
),
errorElement: <ErrorPage />,
children: [

View File

@ -1,6 +1,7 @@
import styles from './ModelingPane.module.css'
import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext'
import { useModelingContext } from 'hooks/useModelingContext'
import { useAppState } from 'AppState'
export interface ModelingPaneProps
extends React.PropsWithChildren,
@ -33,9 +34,10 @@ export const ModelingPane = ({
}: ModelingPaneProps) => {
const { settings } = useSettingsAuthContext()
const onboardingStatus = settings.context.app.onboardingStatus
const { context } = useModelingContext()
// const { context } = useModelingContext()
const { buttonDownInStream } = useAppState()
const pointerEventsCssClass =
context.store?.buttonDownInStream || onboardingStatus.current === 'camera'
buttonDownInStream || onboardingStatus.current === 'camera'
? 'pointer-events-none '
: 'pointer-events-auto '
return (

View File

@ -15,6 +15,7 @@ import styles from './ModelingSidebar.module.css'
import { ModelingPane } from './ModelingPane'
import { isTauri } from 'lib/isTauri'
import { useModelingContext } from 'hooks/useModelingContext'
import { useAppState } from 'AppState'
interface ModelingSidebarProps {
paneOpacity: '' | 'opacity-20' | 'opacity-40'
@ -24,8 +25,9 @@ export function ModelingSidebar({ paneOpacity }: ModelingSidebarProps) {
const { settings } = useSettingsAuthContext()
const onboardingStatus = settings.context.app.onboardingStatus
const { context } = useModelingContext()
const { buttonDownInStream } = useAppState()
const pointerEventsCssClass =
context.store?.buttonDownInStream ||
buttonDownInStream ||
onboardingStatus.current === 'camera' ||
context.store?.openPanes.length === 0
? 'pointer-events-none '

View File

@ -9,7 +9,7 @@ import { ClientSideScene } from 'clientSideScene/ClientSideSceneComp'
import { btnName } from 'lib/cameraControls'
import { sendSelectEventToEngine } from 'lib/selections'
import { kclManager, engineCommandManager, sceneInfra } from 'lib/singletons'
import { useAppStream } from 'AppState'
import { useAppState } from 'AppState'
export const Stream = () => {
const [isLoading, setIsLoading] = useState(true)
@ -17,8 +17,10 @@ export const Stream = () => {
const [clickCoords, setClickCoords] = useState<{ x: number; y: number }>()
const videoRef = useRef<HTMLVideoElement>(null)
const { settings } = useSettingsAuthContext()
const { state, send, context } = useModelingContext()
const { mediaStream } = useAppStream()
const { state, send } = useModelingContext()
const { mediaStream, streamDimensions, didDragInStream, setAppState } =
useAppState()
const { overallState } = useNetworkContext()
const [isFreezeFrame, setIsFreezeFrame] = useState(false)
@ -126,12 +128,19 @@ export const Stream = () => {
)
return
if (!videoRef.current) return
if (!mediaStream) return
// console.log('setting mideastrema to vi2', mediaStream, (window as any).mediaStream)
const _mediaStream = mediaStream || (window as any).mediaStream
if (!_mediaStream) return
// console.log('setting mideastrema to vi')
// Do not immediately play the stream!
videoRef.current.srcObject = mediaStream
videoRef.current.srcObject = _mediaStream
videoRef.current.pause()
// setAppState({
// mediaStream,
// })
send({
type: 'Set context',
data: {
@ -150,44 +159,49 @@ export const Stream = () => {
clientX: e.clientX,
clientY: e.clientY,
el: videoRef.current,
...context.store?.streamDimensions,
...streamDimensions,
})
send({
type: 'Set context',
data: {
buttonDownInStream: e.button,
},
setAppState({
buttonDownInStream: e.button,
})
// send({
// type: 'Set context',
// data: {
// buttonDownInStream: e.button,
// },
// })
setClickCoords({ x, y })
}
const handleMouseUp: MouseEventHandler<HTMLDivElement> = (e) => {
if (!isNetworkOkay) return
if (!videoRef.current) return
send({
type: 'Set context',
data: {
buttonDownInStream: undefined,
},
setAppState({
buttonDownInStream: undefined,
})
// send({
// type: 'Set context',
// data: {
// buttonDownInStream: undefined,
// },
// })
if (state.matches('Sketch')) return
if (state.matches('Sketch no face')) return
if (!context.store?.didDragInStream && btnName(e).left) {
sendSelectEventToEngine(
e,
videoRef.current,
context.store?.streamDimensions
)
if (!didDragInStream && btnName(e).left) {
sendSelectEventToEngine(e, videoRef.current, streamDimensions)
}
send({
type: 'Set context',
data: {
didDragInStream: false,
},
setAppState({
didDragInStream: false,
})
// send({
// type: 'Set context',
// data: {
// didDragInStream: false,
// },
// })
setClickCoords(undefined)
}
@ -201,13 +215,16 @@ export const Stream = () => {
((clickCoords.x - e.clientX) ** 2 + (clickCoords.y - e.clientY) ** 2) **
0.5
if (delta > 5 && !context.store?.didDragInStream) {
send({
type: 'Set context',
data: {
didDragInStream: true,
},
if (delta > 5 && !didDragInStream) {
setAppState({
didDragInStream: true,
})
// send({
// type: 'Set context',
// data: {
// didDragInStream: true,
// },
// })
}
}

View File

@ -195,15 +195,14 @@ export class CompletionRequester implements PluginValue {
private queuedUids: string[] = []
private _deffererCodeUpdate = deferExecution(() => {
this.requestCompletions()
}, changesDelay)
private _deffererUserSelect = deferExecution(() => {
this.rejectSuggestionCommand()
}, changesDelay)
// When a doc update needs to be sent to the server, this holds the
// timeout handle for it. When null, the server has the up-to-date
// document.
private sendScheduledInput: number | null = null
constructor(readonly view: EditorView, client: LanguageServerClient) {
this.client = client
}
@ -246,34 +245,7 @@ export class CompletionRequester implements PluginValue {
}
this.lastPos = this.view.state.selection.main.head
if (viewUpdate.docChanged) this.scheduleUpdateDoc()
}
scheduleUpdateDoc() {
if (this.sendScheduledInput != null)
window.clearTimeout(this.sendScheduledInput)
this.sendScheduledInput = window.setTimeout(
() => this.updateDoc(),
changesDelay
)
}
updateDoc() {
if (this.sendScheduledInput != null) {
window.clearTimeout(this.sendScheduledInput)
this.sendScheduledInput = null
}
if (!this.client.ready) return
try {
this.requestCompletions()
} catch (e) {
console.error(e)
}
}
ensureDocUpdated() {
if (this.sendScheduledInput != null) this.updateDoc()
if (viewUpdate.docChanged) this._deffererCodeUpdate(true)
}
ghostText(): GhostText | null {

View File

@ -27,10 +27,13 @@ export class KclPlugin implements PluginValue {
this.client = client
}
// When a doc update needs to be sent to the server, this holds the
// timeout handle for it. When null, the server has the up-to-date
// document.
private sendScheduledInput: number | null = null
private _deffererCodeUpdate = deferExecution(() => {
if (this.viewUpdate === null) {
return
}
kclManager.executeCode()
}, changesDelay)
private _deffererUserSelect = deferExecution(() => {
if (this.viewUpdate === null) {
@ -98,34 +101,7 @@ export class KclPlugin implements PluginValue {
codeManager.code = newCode
codeManager.writeToFile()
this.scheduleUpdateDoc()
}
scheduleUpdateDoc() {
if (this.sendScheduledInput != null)
window.clearTimeout(this.sendScheduledInput)
this.sendScheduledInput = window.setTimeout(
() => this.updateDoc(),
changesDelay
)
}
updateDoc() {
if (this.sendScheduledInput != null) {
window.clearTimeout(this.sendScheduledInput)
this.sendScheduledInput = null
}
if (!this.client.ready) return
try {
kclManager.executeCode()
} catch (e) {
console.error(e)
}
}
ensureDocUpdated() {
if (this.sendScheduledInput != null) this.updateDoc()
this._deffererCodeUpdate(true)
}
async updateUnits(

View File

@ -1,10 +1,10 @@
import { useLayoutEffect, useEffect, useRef } from 'react'
import { engineCommandManager, kclManager } from 'lib/singletons'
import { engineCommandManager, kclManager, sceneInfra } from 'lib/singletons'
import { deferExecution } from 'lib/utils'
import { Themes } from 'lib/theme'
import { makeDefaultPlanes, modifyGrid } from 'lang/wasm'
import { useModelingContext } from './useModelingContext'
import { useAppState, useAppStream } from 'AppState'
import { useAppState } from 'AppState'
export function useSetupEngineManager(
streamRef: React.RefObject<HTMLDivElement>,
@ -27,8 +27,7 @@ export function useSetupEngineManager(
showScaleGrid: boolean
}
) {
const { setAppState } = useAppState()
const { setMediaStream } = useAppStream()
const { setAppState, streamDimensions } = useAppState()
const streamWidth = streamRef?.current?.offsetWidth
const streamHeight = streamRef?.current?.offsetHeight
@ -48,14 +47,17 @@ export function useSetupEngineManager(
streamWidth,
streamHeight
)
if (
!hasSetNonZeroDimensions.current &&
quadHeight &&
quadWidth &&
settings.modelingSend
) {
if (!hasSetNonZeroDimensions.current && quadHeight && quadWidth) {
engineCommandManager.start({
setMediaStream: setMediaStream,
// setMediaStream: (mediaStream) =>
// settings.modelingSend({
// type: 'Set context',
// data: { mediaStream },
// }),
setMediaStream: (mediaStream) => {
;(window as any).mediaStream = mediaStream
setAppState({ mediaStream })
},
setIsStreamReady: (isStreamReady) => setAppState({ isStreamReady }),
width: quadWidth,
height: quadHeight,
@ -76,15 +78,22 @@ export function useSetupEngineManager(
return modifyGrid(kclManager.engineCommandManager, hidden)
},
})
settings.modelingSend({
type: 'Set context',
data: {
streamDimensions: {
streamWidth: quadWidth,
streamHeight: quadHeight,
},
},
setAppState({
streamDimensions: { streamWidth: quadWidth, streamHeight: quadHeight },
})
sceneInfra._streamDimensions = {
streamWidth: quadWidth,
streamHeight: quadHeight,
}
// settings.modelingSend({
// type: 'Set context',
// data: {
// streamDimensions: {
// streamWidth: quadWidth,
// streamHeight: quadHeight,
// },
// },
// })
hasSetNonZeroDimensions.current = true
}
}
@ -93,6 +102,7 @@ export function useSetupEngineManager(
streamRef?.current?.offsetWidth,
streamRef?.current?.offsetHeight,
settings.modelingSend,
setAppState,
])
useEffect(() => {
@ -102,22 +112,29 @@ export function useSetupEngineManager(
streamRef?.current?.offsetHeight
)
if (
settings.modelingContext.store.streamDimensions.streamWidth !== width ||
settings.modelingContext.store.streamDimensions.streamHeight !== height
streamDimensions.streamWidth !== width ||
streamDimensions.streamHeight !== height
) {
engineCommandManager.handleResize({
streamWidth: width,
streamHeight: height,
})
settings.modelingSend({
type: 'Set context',
data: {
streamDimensions: {
streamWidth: width,
streamHeight: height,
},
},
setAppState({
streamDimensions: { streamWidth: width, streamHeight: height },
})
sceneInfra._streamDimensions = {
streamWidth: width,
streamHeight: height,
}
// settings.modelingSend({
// type: 'Set context',
// data: {
// streamDimensions: {
// streamWidth: width,
// streamHeight: height,
// },
// },
// })
}
}, 500)

View File

@ -13,7 +13,6 @@ import {
UpdaterRestartModal,
createUpdaterRestartModal,
} from 'components/UpdaterRestartModal'
import { AppStreamProvider } from 'AppState'
// uncomment for xstate inspector
// import { DEV } from 'env'
@ -27,30 +26,28 @@ const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
root.render(
<HotkeysProvider>
<AppStreamProvider>
<Router />
<Toaster
position="bottom-center"
toastOptions={{
style: {
borderRadius: '3px',
<Router />
<Toaster
position="bottom-center"
toastOptions={{
style: {
borderRadius: '3px',
},
className:
'bg-chalkboard-10 dark:bg-chalkboard-90 text-chalkboard-110 dark:text-chalkboard-10 rounded-sm border-chalkboard-20/50 dark:border-chalkboard-80/50',
success: {
iconTheme: {
primary: 'oklch(89% 0.16 143.4deg)',
secondary: 'oklch(48.62% 0.1654 142.5deg)',
},
className:
'bg-chalkboard-10 dark:bg-chalkboard-90 text-chalkboard-110 dark:text-chalkboard-10 rounded-sm border-chalkboard-20/50 dark:border-chalkboard-80/50',
success: {
iconTheme: {
primary: 'oklch(89% 0.16 143.4deg)',
secondary: 'oklch(48.62% 0.1654 142.5deg)',
},
duration:
window?.localStorage.getItem('playwright') === 'true'
? 10 // speed up e2e tests
: 1500,
},
}}
/>
<ModalContainer />
</AppStreamProvider>
duration:
window?.localStorage.getItem('playwright') === 'true'
? 10 // speed up e2e tests
: 1500,
},
}}
/>
<ModalContainer />
</HotkeysProvider>
)

View File

@ -138,6 +138,7 @@ export type SegmentOverlayPayload =
}
interface Store {
mediaStream?: MediaStream
videoElement?: HTMLVideoElement
buttonDownInStream: number | undefined
didDragInStream: boolean

View File

@ -8,9 +8,11 @@ import {
} from 'lib/cameraControls'
import { SettingsSection } from 'components/Settings/SettingsSection'
import { useModelingContext } from 'hooks/useModelingContext'
import { useAppState } from 'AppState'
export default function Units() {
const { context } = useModelingContext()
const { buttonDownInStream } = useAppState()
const dismiss = useDismiss()
const next = useNextClick(onboardingPaths.STREAMING)
const {
@ -29,7 +31,7 @@ export default function Units() {
<div
className={
'max-w-2xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded' +
(context.store?.buttonDownInStream ? '' : ' pointer-events-auto')
(buttonDownInStream ? '' : ' pointer-events-auto')
}
>
<SettingsSection

View File

@ -2,9 +2,11 @@ import usePlatform from 'hooks/usePlatform'
import { OnboardingButtons, kbdClasses, useDismiss, useNextClick } from '.'
import { onboardingPaths } from 'routes/Onboarding/paths'
import { useModelingContext } from 'hooks/useModelingContext'
import { useAppState } from 'AppState'
export default function CmdK() {
const { context } = useModelingContext()
// const { context } = useModelingContext()
const { buttonDownInStream } = useAppState()
const dismiss = useDismiss()
const next = useNextClick(onboardingPaths.USER_MENU)
const platformName = usePlatform()
@ -14,7 +16,7 @@ export default function CmdK() {
<div
className={
'max-w-full xl:max-w-4xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded' +
(context.store?.buttonDownInStream ? '' : ' pointer-events-auto')
(buttonDownInStream ? '' : ' pointer-events-auto')
}
>
<h2 className="text-2xl font-bold">Command Bar</h2>

View File

@ -1,10 +1,12 @@
import { useModelingContext } from 'hooks/useModelingContext'
import { OnboardingButtons, useDemoCode, useDismiss, useNextClick } from '.'
import { onboardingPaths } from 'routes/Onboarding/paths'
import { useAppState } from 'AppState'
export default function OnboardingCodeEditor() {
useDemoCode()
const { context } = useModelingContext()
const { buttonDownInStream } = useAppState()
const dismiss = useDismiss()
const next = useNextClick(onboardingPaths.PARAMETRIC_MODELING)
@ -13,7 +15,7 @@ export default function OnboardingCodeEditor() {
<div
className={
'z-10 max-w-xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg h-[75vh] flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded' +
(context.store?.buttonDownInStream ? '' : ' pointer-events-auto')
(buttonDownInStream ? '' : ' pointer-events-auto')
}
>
<section className="flex-1 overflow-y-auto">

View File

@ -2,9 +2,11 @@ import { APP_NAME } from 'lib/constants'
import { OnboardingButtons, useDismiss, useNextClick } from '.'
import { onboardingPaths } from 'routes/Onboarding/paths'
import { useModelingContext } from 'hooks/useModelingContext'
import { useAppState } from 'AppState'
export default function Export() {
const { context } = useModelingContext()
const { buttonDownInStream } = useAppState()
const dismiss = useDismiss()
const next = useNextClick(onboardingPaths.SKETCHING)
@ -13,7 +15,7 @@ export default function Export() {
<div
className={
'max-w-full xl:max-w-2xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded' +
(context.store?.buttonDownInStream ? '' : ' pointer-events-auto')
(buttonDownInStream ? '' : ' pointer-events-auto')
}
>
<section className="flex-1">

View File

@ -8,10 +8,12 @@ import {
import { onboardingPaths } from 'routes/Onboarding/paths'
import { bracketWidthConstantLine } from 'lib/exampleKcl'
import { useModelingContext } from 'hooks/useModelingContext'
import { useAppState } from 'AppState'
export default function OnboardingInteractiveNumbers() {
useDemoCode()
const { context } = useModelingContext()
const { buttonDownInStream } = useAppState()
const dismiss = useDismiss()
const next = useNextClick(onboardingPaths.COMMAND_K)
@ -20,7 +22,7 @@ export default function OnboardingInteractiveNumbers() {
<div
className={
'z-10 max-w-xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg h-[75vh] flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded' +
(context.store?.buttonDownInStream ? '' : ' pointer-events-auto')
(buttonDownInStream ? '' : ' pointer-events-auto')
}
>
<section className="flex-1 overflow-y-auto mb-6">

View File

@ -4,10 +4,12 @@ import { Themes, getSystemTheme } from 'lib/theme'
import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext'
import { bracketThicknessCalculationLine } from 'lib/exampleKcl'
import { useModelingContext } from 'hooks/useModelingContext'
import { useAppState } from 'AppState'
export default function OnboardingParametricModeling() {
useDemoCode()
const { context } = useModelingContext()
const { buttonDownInStream } = useAppState()
const {
settings: {
context: {
@ -30,7 +32,7 @@ export default function OnboardingParametricModeling() {
<div
className={
'z-10 max-w-xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg h-[75vh] flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded' +
(context.store?.buttonDownInStream ? '' : ' pointer-events-auto')
(buttonDownInStream ? '' : ' pointer-events-auto')
}
>
<section className="flex-1 overflow-y-auto mb-6">

View File

@ -2,9 +2,11 @@ import { OnboardingButtons, useDismiss, useNextClick } from '.'
import { onboardingPaths } from 'routes/Onboarding/paths'
import { isTauri } from 'lib/isTauri'
import { useModelingContext } from 'hooks/useModelingContext'
import { useAppState } from 'AppState'
export default function ProjectMenu() {
const { context } = useModelingContext()
const { buttonDownInStream } = useAppState()
const dismiss = useDismiss()
const next = useNextClick(onboardingPaths.EXPORT)
const tauri = isTauri()
@ -14,7 +16,7 @@ export default function ProjectMenu() {
<div
className={
'max-w-xl flex flex-col border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded' +
(context.store?.buttonDownInStream ? '' : ' pointer-events-auto')
(buttonDownInStream ? '' : ' pointer-events-auto')
}
>
<section className="flex-1">

View File

@ -3,9 +3,11 @@ import { onboardingPaths } from 'routes/Onboarding/paths'
import { useEffect } from 'react'
import { codeManager, kclManager } from 'lib/singletons'
import { useModelingContext } from 'hooks/useModelingContext'
import { useAppState } from 'AppState'
export default function Sketching() {
const { context } = useModelingContext()
const { buttonDownInStream } = useAppState()
const dismiss = useDismiss()
const next = useNextClick(onboardingPaths.FUTURE_WORK)
@ -23,7 +25,7 @@ export default function Sketching() {
<div
className={
'max-w-full xl:max-w-2xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded' +
(context.store?.buttonDownInStream ? '' : ' pointer-events-auto')
(buttonDownInStream ? '' : ' pointer-events-auto')
}
>
<h1 className="text-2xl font-bold">Sketching</h1>

View File

@ -1,9 +1,11 @@
import { useModelingContext } from 'hooks/useModelingContext'
import { OnboardingButtons, useDismiss, useNextClick } from '.'
import { onboardingPaths } from 'routes/Onboarding/paths'
import { useAppState } from 'AppState'
export default function Streaming() {
const { context } = useModelingContext()
const { buttonDownInStream } = useAppState()
const dismiss = useDismiss()
const next = useNextClick(onboardingPaths.EDITOR)
@ -12,7 +14,7 @@ export default function Streaming() {
<div
className={
'max-w-xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg h-[75vh] flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded' +
(context.store?.buttonDownInStream ? '' : ' pointer-events-auto')
(buttonDownInStream ? '' : ' pointer-events-auto')
}
>
<section className="flex-1 overflow-y-auto">

View File

@ -3,9 +3,11 @@ import { onboardingPaths } from 'routes/Onboarding/paths'
import { useEffect, useState } from 'react'
import { useModelingContext } from 'hooks/useModelingContext'
import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext'
import { useAppState } from 'AppState'
export default function UserMenu() {
const { context } = useModelingContext()
const { buttonDownInStream } = useAppState()
const { auth } = useSettingsAuthContext()
const dismiss = useDismiss()
const next = useNextClick(onboardingPaths.PROJECT_MENU)
@ -36,7 +38,7 @@ export default function UserMenu() {
<div
className={
'max-w-xl flex flex-col border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded' +
(context.store?.buttonDownInStream ? '' : ' pointer-events-auto')
(buttonDownInStream ? '' : ' pointer-events-auto')
}
>
<section className="flex-1">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 333 KiB

After

Width:  |  Height:  |  Size: 333 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 333 KiB

After

Width:  |  Height:  |  Size: 333 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 117 KiB