fix(workbench): clarify junction browse mode

This commit is contained in:
que01 committed 2026-09-03 13:54:26 +08:00
1 parent 39d7453ebc
commit c9d9e45f48
4 files changed
+37 -3

No files matched your search

+3 -1
View File
@@ -117,7 +117,9 @@ test.describe('workbench editing shell', () => {
await expect(page.getByLabel('路口编辑工作区')).toBeVisible(); await expect(page.getByLabel('路口编辑工作区')).toBeVisible();
await expect(page.getByText(`路口节点 ${nodeId}`)).toBeVisible(); await expect(page.getByText(`路口节点 ${nodeId}`)).toBeVisible();
await expect(page.getByText('设施与验证', { exact: true })).toBeVisible(); await expect(page.getByText('设施与验证', { exact: true })).toBeVisible();
await page.getByRole('switch', { name: '编辑模式' }).check(); await expect(page.getByText('当前为浏览模式,开启编辑后可调整路口几何参数')).toBeVisible();
await page.getByRole('button', { name: '开启编辑模式' }).click();
await expect(page.getByRole('switch', { name: '编辑模式' })).toBeChecked();
await expect(page.getByLabel('路口编辑工作区').getByText('道路参数', { exact: true })).toBeVisible(); await expect(page.getByLabel('路口编辑工作区').getByText('道路参数', { exact: true })).toBeVisible();
}); });
}); });
+2
View File
@@ -1049,6 +1049,8 @@ function App() {
setStatus((error as Error).message); setStatus((error as Error).message);
} }
}} }}
editMode={editMode}
onEnableEdit={() => setEditMode(true)}
handles={junctionHandles} handles={junctionHandles}
onDraft={draftValue} onDraft={draftValue}
onSettle={(handle, value) => { onSettle={(handle, value) => {
@@ -14,6 +14,8 @@ interface Props {
onApply: () => void; onApply: () => void;
onDiscard: () => void; onDiscard: () => void;
onSave: () => void; onSave: () => void;
editMode?: boolean;
onEnableEdit?: () => void;
handles?: EditHandle[]; handles?: EditHandle[];
onDraft?: (handle: EditHandle, value: number) => void; onDraft?: (handle: EditHandle, value: number) => void;
onSettle?: (handle: EditHandle, value: number) => void; onSettle?: (handle: EditHandle, value: number) => void;
@@ -28,6 +30,8 @@ export function JunctionWorkspace({
onApply, onApply,
onDiscard, onDiscard,
onSave, onSave,
editMode = false,
onEnableEdit,
diagnostics = [], diagnostics = [],
facilitySummary = { crosswalks: 0, stopLines: 0, signals: 0 }, facilitySummary = { crosswalks: 0, stopLines: 0, signals: 0 },
handles = [], handles = [],
@@ -45,9 +49,18 @@ export function JunctionWorkspace({
<h2> <h2>
{descriptor.ref.type === 'node' ? '路口节点' : '复杂路口上下文'} {descriptor.ref.id} {descriptor.ref.type === 'node' ? '路口节点' : '复杂路口上下文'} {descriptor.ref.id}
</h2> </h2>
<p>{editable ? '可编辑路口几何参数' : '只读上下文:当前路口类型暂不支持编辑'}</p> <p>
{editable
? editMode
? '可编辑路口几何参数'
: '当前为浏览模式,开启编辑后可调整路口几何参数'
: '只读上下文:当前路口类型暂不支持编辑'}
</p>
</div> </div>
<div className="junction-workspace__header-actions">
{editable && !editMode ? <Button onClick={onEnableEdit}>开启编辑模式</Button> : null}
<Button onClick={onClose}>返回主地图</Button> <Button onClick={onClose}>返回主地图</Button>
</div>
</header> </header>
<div className="junction-workspace__body"> <div className="junction-workspace__body">
<dl> <dl>
@@ -80,7 +93,7 @@ export function JunctionWorkspace({
<p>当前路口没有诊断问题。</p> <p>当前路口没有诊断问题。</p>
)} )}
</section> </section>
{editable ? ( {editable && editMode ? (
<> <>
<ParameterPanel <ParameterPanel
handles={handles} handles={handles}
@@ -102,6 +115,10 @@ export function JunctionWorkspace({
</Button> </Button>
</div> </div>
</> </>
) : editable ? (
<p className="junction-workspace__browse-hint">
开启编辑模式后,这里会显示进口宽度、cutback 和角部圆角控件。
</p>
) : null} ) : null}
</div> </div>
</section> </section>
+13
View File
@@ -549,6 +549,12 @@ pre {
align-items: flex-start; align-items: flex-start;
gap: 1rem; gap: 1rem;
} }
.junction-workspace__header-actions {
display: flex;
align-items: center;
gap: 0.5rem;
flex-wrap: wrap;
}
.junction-workspace__header h2 { .junction-workspace__header h2 {
margin: 0.2rem 0; margin: 0.2rem 0;
} }
@@ -579,3 +585,10 @@ pre {
gap: 0.5rem; gap: 0.5rem;
margin-top: 1.5rem; margin-top: 1.5rem;
} }
.junction-workspace__browse-hint {
margin: 1.5rem 0 0;
padding: 0.75rem 1rem;
border-left: 3px solid #94a3b8;
background: #f8fafc;
color: #475569;
}