fix(ui): 移除顶部页面标签并放大左侧导航
build / build (push) Successful in 1m14s

去掉系统已打开页面页签及无用关闭入口和样式;保留面包屑、来源路径与分页。左侧文字16px、图标20px,导航项最小44px。

验证:顶部页签移除与导航字号回归分别先红后绿,相关测试和类型检查通过;完整门禁与部署验收待执行。
This commit is contained in:
姚章浩
2026-10-24 15:10:10 +08:00
parent 1c065846f6
commit 8d44d54dc7
5 changed files with 37 additions and 129 deletions
+7
View File
@@ -76,6 +76,13 @@
> `0.1.12`),由 `scripts/version.py` 从 git **算出来**;开发交付的独立说明写入本文件“开发快照”章节,并打 `snapshot/vX.Y.Z` 注释标签 ⇒ 每次开发交付均可追溯,
> 但"发布版本"仍然只能由人定(CI 不会自动升版本、不会打 tag)。
## 开发快照 snapshot/v0.1.52 - 2026-10-24
### Changed
- 移除系统顶部的已打开页面标签栏及关闭入口,保留左侧功能导航、当前位置、来源路径和表格分页。
- 左侧导航文字放大至16px、图标放大至20px,图标区域24px、导航项最小高度44px,手机抽屉同步生效。
## 开发快照 snapshot/v0.1.51 - 2026-10-24
### Changed
+13 -11
View File
@@ -28,7 +28,6 @@ describe('WorkspaceShell', () => {
<WorkspaceShell
workspace={{ openTabs: ['dashboard'], activeTab: 'dashboard' }}
onOpen={vi.fn()}
onClose={vi.fn()}
>
<div>工作区内容</div>
</WorkspaceShell>,
@@ -44,36 +43,38 @@ describe('WorkspaceShell', () => {
expect(html).not.toContain('P2 本地治理环境')
})
it('renders open tabs and marks the active tab', () => {
it('omits the system open-page tab strip while retaining navigation and the current location', () => {
const html = renderToStaticMarkup(
<WorkspaceShell
workspace={{ openTabs: ['dashboard', 'tasks', 'releases'], activeTab: 'tasks' }}
onOpen={vi.fn()}
onClose={vi.fn()}
>
<div>工作区内容</div>
</WorkspaceShell>,
)
expect(html).toContain('aria-label="已打开页面"')
expect(html).not.toContain('aria-label="已打开页面"')
expect(html).not.toContain('class="tab-list"')
expect(html).not.toContain('class="workspace-tab')
expect(html).toContain('来源与目录')
expect(html).toContain('解析监控')
expect(html).toContain('发布管理')
expect(html).toContain('aria-current="page"')
expect(html).toContain('aria-label="当前位置"')
expect(html).toContain('<b>解析监控</b>')
expect(html).toContain('class="nav-item active"')
})
it('offers close controls only for unpinned tabs', () => {
it('does not render obsolete module-tab close controls', () => {
const html = renderToStaticMarkup(
<WorkspaceShell
workspace={{ openTabs: ['dashboard', 'tasks'], activeTab: 'tasks' }}
onOpen={vi.fn()}
onClose={vi.fn()}
>
<div>工作区内容</div>
</WorkspaceShell>,
)
expect(html).toContain('aria-label="关闭解析监控标签"')
expect(html).not.toContain('aria-label="关闭解析监控标签"')
expect(html).not.toContain('aria-label="关闭来源与目录标签"')
})
@@ -82,7 +83,6 @@ describe('WorkspaceShell', () => {
<WorkspaceShell
workspace={{ openTabs: ['dashboard'], activeTab: 'dashboard' }}
onOpen={vi.fn()}
onClose={vi.fn()}
>
<div>工作区内容</div>
</WorkspaceShell>,
@@ -94,11 +94,13 @@ describe('WorkspaceShell', () => {
})
describe('App', () => {
it('renders the dashboard inside the multi-tab workspace by default', () => {
it('renders the dashboard inside the workspace without the system page tabs', () => {
const html = renderToStaticMarkup(<App />)
expect(html).toContain('aria-label="功能导航"')
expect(html).toContain('aria-label="已打开页面"')
expect(html).not.toContain('aria-label="已打开页面"')
expect(html).not.toContain('class="tab-list"')
expect(html).not.toContain('class="workspace-tab')
expect(html).toContain('<h1>来源与目录</h1>')
expect(html).not.toContain('最近任务')
})
+1 -35
View File
@@ -52,7 +52,7 @@ import { fetchSourceConnections, fetchSourceScanDetail, fetchSourceScans, trigge
import type { SourceConnectionPage, SourceScanDetail, SourceScanPage } from './sourceConnections'
import { fetchTestPublications, retryPublication } from './testPublications'
import type { ProcessingState, TestPublicationPage } from './testPublications'
import { closeModule, initialWorkspace, openModule, restoreWorkspace } from './workspace'
import { initialWorkspace, openModule, restoreWorkspace } from './workspace'
import type { ModuleId, WorkspaceState } from './workspace'
const workspaceStorageKey = 'knowledge-governance.workspace.v1'
@@ -69,7 +69,6 @@ const modules: ReadonlyArray<{ id: ModuleId; label: string; icon: string }> = [
interface WorkspaceShellProps {
workspace: WorkspaceState
onOpen: (moduleId: ModuleId) => void
onClose: (moduleId: ModuleId) => void
children: React.ReactNode
}
@@ -141,38 +140,6 @@ export function WorkspaceShell(props: WorkspaceShellProps) {
</span>
<b>{activeModule?.label ?? '工作台'}</b>
</div>
<div className="tab-list" role="tablist" aria-label="已打开页面">
{props.workspace.openTabs.map((tabId) => {
const module = modules.find((item) => item.id === tabId)
if (!module) return null
const active = props.workspace.activeTab === tabId
return (
<div className={active ? 'workspace-tab active' : 'workspace-tab'} key={tabId}>
<button
className="tab-activate"
type="button"
role="tab"
aria-current={active ? 'page' : undefined}
aria-selected={active}
onClick={() => props.onOpen(tabId)}
>
<span aria-hidden="true">{module.icon}</span>
{module.label}
</button>
{tabId !== 'dashboard' ? (
<button
className="tab-close"
type="button"
aria-label={`关闭${module.label}标签`}
onClick={() => props.onClose(tabId)}
>
×
</button>
) : null}
</div>
)
})}
</div>
<WorkspaceContextTabsBar tabs={contextTabs} />
<TopBarUser />
</header>
@@ -2992,7 +2959,6 @@ export default function App() {
<WorkspaceShell
workspace={workspace}
onOpen={(moduleId) => setWorkspace((current) => openModule(current, moduleId))}
onClose={(moduleId) => setWorkspace((current) => closeModule(current, moduleId))}
>
{workspace.activeTab === 'dashboard' ? (
<SourceCatalogBrowser />
+10 -2
View File
@@ -5,8 +5,16 @@ import { readFileSync } from 'node:fs'
const styles = readFileSync(new URL('./styles.css', import.meta.url), 'utf8')
describe('mobile workspace navigation styles', () => {
it('keeps only the active workspace tab and hamburger navigation on narrow screens', () => {
expect(styles).toMatch(/@media \(max-width: 760px\)[\s\S]*?\.workspace-tab:not\(\.active\)\s*\{\s*display:\s*none;/)
it('keeps the hamburger navigation and collapses only source context on narrow screens', () => {
expect(styles).toMatch(/@media \(max-width: 760px\)[\s\S]*?\.workspace-context-tabs\s*\{\s*display:\s*none;/)
})
it('enlarges sidebar labels and icons with comfortable navigation targets', () => {
const item = styles.match(/\.nav-item\s*\{([^}]+)\}/)![1]
const icon = styles.match(/\.nav-icon\s*\{([^}]+)\}/)![1]
expect(item).toMatch(/font-size:\s*16px;/)
expect(item).toMatch(/min-height:\s*44px;/)
expect(icon).toMatch(/font-size:\s*20px;/)
expect(icon).toMatch(/width:\s*24px;/)
expect(icon).toMatch(/height:\s*24px;/)
})
})
+6 -81
View File
@@ -219,12 +219,13 @@ code {
gap: 10px;
border: 1px solid transparent;
border-radius: var(--r-md);
padding: 7px 10px;
padding: 9px 10px;
color: #8aa2b3;
background: transparent;
box-shadow: none;
font-weight: 500;
font-size: 12.5px;
font-size: 16px;
min-height: 44px;
text-align: left;
transition: background 120ms ease, color 120ms ease;
}
@@ -244,12 +245,12 @@ code {
.nav-icon {
display: grid;
width: 18px;
height: 18px;
width: 24px;
height: 24px;
flex: none;
place-items: center;
color: var(--side-accent);
font-size: 13px;
font-size: 20px;
}
.sidebar-footer {
@@ -317,15 +318,6 @@ code {
font-weight: 600;
}
.tab-list {
display: flex;
min-width: 0;
gap: 2px;
overflow-x: auto;
padding: 8px 16px 0;
scrollbar-width: thin;
}
.workspace-context-tabs {
display: flex;
min-width: 0;
@@ -361,25 +353,6 @@ code {
font-weight: 600;
}
.workspace-tab {
display: flex;
height: 36px;
flex: none;
align-items: center;
border: 1px solid transparent;
border-bottom: 0;
border-radius: var(--r-md) var(--r-md) 0 0;
background: transparent;
}
.workspace-tab.active {
border-color: var(--border-base);
background: var(--bg-page);
box-shadow: inset 0 2px var(--c-run);
}
.tab-activate,
.tab-close,
.mobile-nav-toggle,
.sidebar-backdrop {
border-radius: 0;
@@ -390,44 +363,6 @@ code {
border: 0;
}
.tab-activate {
display: flex;
height: 100%;
align-items: center;
gap: 6px;
padding: 0 11px;
color: var(--ink-mute);
font-size: 12px;
font-weight: 500;
}
.workspace-tab.active .tab-activate {
color: var(--ink-strong);
font-weight: 600;
}
.tab-activate span {
color: var(--c-cyan);
font-size: 12px;
}
.tab-close {
display: grid;
width: 20px;
height: 20px;
margin-right: 6px;
place-items: center;
border-radius: var(--r-sm);
color: var(--ink-faint);
font-size: 16px;
line-height: 1;
}
.tab-close:hover {
color: var(--c-fail);
background: var(--c-fail-bg);
}
.workspace-content {
min-width: 0;
flex: 1;
@@ -1856,15 +1791,6 @@ tbody tr:hover {
}
.workspace-topbar { align-items: center; }
.workspace-context-tabs { display: none; }
.workspace-tab:not(.active) { display: none; }
.workspace-tab.active { min-width: 0; max-width: 100%; }
.workspace-tab.active .tab-activate {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.workspace-tab.active .tab-close { width: 32px; height: 32px; flex: none; }
.mobile-nav-toggle {
display: grid;
width: 32px;
@@ -1878,7 +1804,6 @@ tbody tr:hover {
font-size: 16px;
border: 1px solid var(--border-base);
}
.tab-list { flex: 1; overflow: hidden; padding-left: 6px; }
}
@media (max-width: 620px) {