From f20c83f21ed427a9de48fe5a26de91c3c65241c3 Mon Sep 17 00:00:00 2001 From: wangdequan Date: Sun, 2 Aug 2026 02:54:23 -0400 Subject: [PATCH] feat: route UI commands through facade --- src/App.tsx | 20 ++++++++++---------- src/styles.css | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 05da850..bd25aaa 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -252,12 +252,12 @@ function Workspace({ workbench, setWorkbench, leftTab, setLeftTab, rightTab, set
- showNotice('New document prepared')} /> + { facade.gui.command.execute({ commandId: 'new-document' }); showNotice('New document prepared') }} /> showNotice('Project browser opened')} /> - showNotice('Saved to local workspace')} /> + { facade.gui.command.execute({ commandId: 'save' }); showNotice('Saved to local workspace') }} />
- showNotice('Create Body task opened')} active={workbench === 'Part Design'} /> - showNotice('Select a plane to create a sketch')} /> + { facade.gui.command.execute({ commandId: 'create-body' }); showNotice('Create Body task opened') }} active={workbench === 'Part Design'} /> + { facade.gui.command.execute({ commandId: 'create-sketch' }); showNotice('Select a plane to create a sketch') }} />
@@ -283,8 +283,8 @@ function Workspace({ workbench, setWorkbench, leftTab, setLeftTab, rightTab, set
Perspective
Grid 10 mm
XYZ
- - + +
@@ -298,9 +298,9 @@ function WorkbenchNavBar({ workbench, setWorkbench, showNotice }: { workbench: W return
Workbench{pinnedWorkbenches.map((item) => { const IconComponent = workbenchMeta[item].icon; return })}
} -function FunctionRail({ workbench, showNotice }: { workbench: Workbench; showNotice: (message: string) => void }) { +function FunctionRail({ workbench, facade, showNotice }: { workbench: Workbench; facade: BitBybitWebCadFacade; showNotice: (message: string) => void }) { const groups = workbenchDefinitions[workbench].groups - return + return } function ModelTree({ document, selectedObject, setSelectedObject, showNotice }: { document: DocumentSnapshot; selectedObject: string; setSelectedObject: (id: string) => void; showNotice: (message: string) => void }) { @@ -330,10 +330,10 @@ function TreeItem({ item, level, expanded, onToggle, selectedObject, setSelected } -function TaskPanel({ workbench, showNotice }: { workbench: Workbench; showNotice: (message: string) => void }) { +function TaskPanel({ workbench, facade, showNotice }: { workbench: Workbench; facade: BitBybitWebCadFacade; showNotice: (message: string) => void }) { const definition = workbenchDefinitions[workbench] const isSketch = workbench === 'Sketcher' - return
Active command

{isSketch ? 'Edit Sketch' : definition.taskTitle}

Preview
1
{isSketch ? 'Geometry and constraints' : definition.objectType}{definition.taskSummary}
Changes remain local until the document is recomputed.
+ return
Active command

{isSketch ? 'Edit Sketch' : definition.taskTitle}

Preview
1
{isSketch ? 'Geometry and constraints' : definition.objectType}{definition.taskSummary}
Changes remain local until the document is recomputed.
} function DataProperties({ selectedObject, showNotice }: { selectedObject: string; showNotice: (message: string) => void }) { diff --git a/src/styles.css b/src/styles.css index de24315..cc91b41 100644 --- a/src/styles.css +++ b/src/styles.css @@ -342,6 +342,7 @@ button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px s .rail-group-label { width: 100%; overflow: hidden; color: var(--text-muted); font-size: 7px; text-align: center; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; text-overflow: ellipsis; } .rail-group button { width: 30px; height: 27px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 3px; background: transparent; color: var(--text-muted); cursor: pointer; } .rail-group button:hover { color: var(--cyan); background: var(--cyan-soft); border-color: #2c6568; } +.rail-group button:disabled { opacity: .3; cursor: not-allowed; } .model-task-summary { padding: 17px 14px; color: var(--text-muted); } .model-task-summary p { font-size: 11px; line-height: 1.5; margin: 10px 0 15px; } .model-task-summary .button { width: 100%; }