style(client): stack local build metadata

This commit is contained in:
imccyu committed 2026-08-24 15:08:14 +08:00
1 parent 720c5c247c
commit 1a36d5c6f5
10 files changed
+27 -54

No files matched your search

+1 -2
View File
@@ -72,8 +72,7 @@ it('boots the built plugin graph and renders a fixture session end to end', asyn
const buildVersion = version
+ (commit === undefined ? '' : `-${commit}`)
+ (clientBuildValue('DSH_CLIENT_GIT_DIRTY') === 'true' ? '-dirty' : '')
screen.getByText('DSH')
screen.getByText('Local Build')
screen.getByText('DSH Local Build')
screen.getByText(buildVersion)
}
// The compact layout dropped group session counts; the fixture workspace
-2
View File
@@ -30,9 +30,7 @@ export const en = {
'collapse': 'Collapse',
'expand': 'Expand',
'back': 'Back',
'brand.name': 'DSH',
'brand.localBuild': 'DSH Local Build',
'brand.localBuildLabel': 'Local Build',
'unknown': 'Unknown',
'none': 'None',
'truncated': 'Truncated',
-2
View File
@@ -28,9 +28,7 @@ export const zh = {
'collapse': '收起',
'expand': '展开',
'back': '返回',
'brand.name': 'DSH',
'brand.localBuild': 'DSH 本地构建',
'brand.localBuildLabel': '本地构建',
'unknown': '未知',
'none': '无',
'truncated': '已截断',
+2 -2
View File
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/client/ui-sidebar/README.md
README.md: 406f2930ac1deb9bf8e12caedbcfb11f7fc35fbc
README.zh.md: fd809b20298d069b37076c8dde4fe98f8fb761c8
README.md: 075a132b9fc35ec4aee871690b436d3380e616fb
README.zh.md: 39ec5d58cd7270fbefdaa81eb0a6a022229d7963
+1 -1
View File
@@ -4,7 +4,7 @@ English | [中文](README.zh.md)
Sidebar shell plugin: the brand row, New Session action, layout-owned collapse control, scroll-aware region seat, and bottom-pinned Settings seat. [ui-workspace](../ui-workspace/README.md) owns the Workspace and Session browser rendered into `sidebar.workspaces`; this package neither derives its rows nor owns its view preferences. Collapse into the layout-owned 56px rail remains presentation-local. Contract: the [slot system standard](../../../.agents/notes/implemented/architecture/2026-07-22-slot-type-chain-implementation.md).
The expanded brand row renders `sidebar.brand.mark` and `sidebar.brand.name` as independent single slots, while the collapsed rail renders the same mark slot. Without occupants, the shell uses the fish mark and a local-build fallback: a complete build renders `DSH` with a small `Local Build` caption plus a code badge assembled as `version[-commit][-dirty]` from `DSH_CLIENT_VERSION`, the optional 7-character `DSH_CLIENT_COMMIT_HASH`, and `DSH_CLIENT_GIT_DIRTY=true`; missing version metadata retains the defensive `DSH Local Build` label. A deployment package can replace either value without replacing the New Session control or rail geometry; declaration-aware `slots.inject()` lets such a package activate before or after the sidebar.
The expanded brand row renders `sidebar.brand.mark` and `sidebar.brand.name` as independent single slots, while the collapsed rail renders the same mark slot. Without occupants, the shell uses the fish mark and a localized local-build label. A complete build stacks below it a code badge assembled as `version[-commit][-dirty]` from `DSH_CLIENT_VERSION`, the optional 7-character `DSH_CLIENT_COMMIT_HASH`, and `DSH_CLIENT_GIT_DIRTY=true`; missing version metadata omits the badge. A deployment package can replace either value without replacing the New Session control or rail geometry; declaration-aware `slots.inject()` lets such a package activate before or after the sidebar.
New Session starts the runtime's page-local frontend Session Intent. The runtime targets the explicit Workspace used by a scoped action, otherwise the current Session's Workspace, otherwise the most recently active Workspace; when none exists it clears into the blank New Session page. Workspace-specific controls and the shared picker belong to ui-workspace.
+1 -1
View File
@@ -4,7 +4,7 @@
侧边栏外壳插件:负责品牌行、New Session 操作、布局持有的折叠控件、可感知滚动的区域 seat,以及固定在底部的 Settings seat。[ui-workspace](../ui-workspace/README.zh.md) 持有渲染到 `sidebar.workspaces` 的 Workspace 与 Session 浏览器;本包既不派生其中的行,也不持有其视图偏好。折叠到布局拥有的 56px 轨道仍属于本地呈现行为。约定:[slot 系统标准](../../../.agents/notes/implemented/architecture/2026-07-22-slot-type-chain-implementation.zh.md)。
展开的品牌行把 `sidebar.brand.mark` 与 `sidebar.brand.name` 渲染为两个独立的 single slot,收起轨道则渲染同一个 mark slot。没有占位者时,外壳使用鱼形标记和本地构建 fallback:完整构建显示 `DSH`、小号 `本地构建` 标注,以及把 `DSH_CLIENT_VERSION`、可选的 7 位 `DSH_CLIENT_COMMIT_HASH` 与 `DSH_CLIENT_GIT_DIRTY=true` 组装成的 `version[-commit][-dirty]` 代码徽标;缺少版本元数据时保留防御性的 `DSH 本地构建` 标签。部署包可以单独替换任一值,而无须替换 New Session 控件或轨道几何;声明感知的 `slots.inject()` 让这种包无论先于还是后于侧边栏激活都能生效。
展开的品牌行把 `sidebar.brand.mark` 与 `sidebar.brand.name` 渲染为两个独立的 single slot,收起轨道则渲染同一个 mark slot。没有占位者时,外壳使用鱼形标记和本地化的本地构建标签。完整构建会在标签下方显示代码徽标;该徽标由 `DSH_CLIENT_VERSION`、可选的 7 位 `DSH_CLIENT_COMMIT_HASH` 与 `DSH_CLIENT_GIT_DIRTY=true` 组装成 `version[-commit][-dirty]`;缺少版本元数据时不显示徽标。部署包可以单独替换任一值,而无须替换 New Session 控件或轨道几何;声明感知的 `slots.inject()` 让这种包无论先于还是后于侧边栏激活都能生效。
New Session 会启动运行时的页面局部前端 Session Intent。运行时优先使用作用域操作明确指定的 Workspace,否则使用当前 Session 所属 Workspace,再否则使用最近活跃 Workspace;一个 Workspace 都没有时则清空选择,进入空白 New Session 页面。Workspace 专属控件与共享选择器由 ui-workspace 持有。
@@ -165,24 +165,17 @@
flex-direction: column;
align-items: flex-start;
justify-content: center;
gap: 1px;
height: 24px;
white-space: nowrap;
}
.localBuildName {
font-size: 16px;
line-height: 15px;
.localBuildTitle {
font-size: 12px;
line-height: 13px;
letter-spacing: 0;
}
.localBuildLabel {
color: var(--dsw-alias-label-secondary);
font-size: 7px;
font-weight: 500;
line-height: 8px;
letter-spacing: 0.02em;
}
.iconButton {
flex: none;
display: inline-flex;
@@ -238,15 +231,15 @@
flex: none;
display: inline-flex;
align-items: center;
height: 16px;
padding: 0 4px;
border-radius: 3px;
height: 10px;
padding: 0 3px;
border-radius: 2px;
color: var(--dsw-alias-label-primary-inverted);
background: var(--dsw-alias-label-primary);
font-family: var(--ds-font-family-code);
font-size: 8px;
font-size: 6px;
font-weight: 500;
line-height: 16px;
line-height: 10px;
white-space: nowrap;
}
@@ -156,13 +156,10 @@ export function SidebarRoot({
fallback: buildVersion === undefined
? <span className={css.fallbackBrandName}>{t('brand.localBuild')}</span>
: (
<>
<span className={css.localBuildBrand}>
<span className={css.localBuildName}>{t('brand.name')}</span>
<span className={css.localBuildLabel}>{t('brand.localBuildLabel')}</span>
</span>
<span className={css.localBuildBrand}>
<span className={css.localBuildTitle}>{t('brand.localBuild')}</span>
<span className={css.buildVersion}>{buildVersion}</span>
</>
</span>
),
})}
</span>
@@ -141,21 +141,16 @@ exports[`sidebar shell snapshots > renders the expanded column (wordmark, capsul
class="localBuildBrand"
>
<span
class="localBuildName"
class="localBuildTitle"
>
DSH
DSH Local Build
</span>
<span
class="localBuildLabel"
class="buildVersion"
>
Local Build
1.2.3-rc.4-abc1234-dirty
</span>
</span>
<span
class="buildVersion"
>
1.2.3-rc.4-abc1234-dirty
</span>
</div>
</span>
</span>
@@ -276,21 +271,16 @@ exports[`sidebar shell snapshots > renders the expanded column in the default lo
class="localBuildBrand"
>
<span
class="localBuildName"
class="localBuildTitle"
>
DSH
DSH 本地构建
</span>
<span
class="localBuildLabel"
class="buildVersion"
>
本地构建
1.2.3-rc.4-abc1234-dirty
</span>
</span>
<span
class="buildVersion"
>
1.2.3-rc.4-abc1234-dirty
</span>
</div>
</span>
</span>
@@ -110,8 +110,7 @@ describe('SidebarRoot shell', () => {
options?.fallback ?? null) as SidebarRootComponentProps['renderSlot']}
/>)
expect(screen.getByText('DSH')).toBeTruthy()
expect(screen.getByText('Local Build')).toBeTruthy()
expect(screen.getByText('DSH Local Build')).toBeTruthy()
expect(screen.getByText('1.2.3-rc.4-0123456-dirty')).toBeTruthy()
expect(container.querySelector('svg')).not.toBeNull()
})
@@ -129,8 +128,7 @@ describe('SidebarRoot shell', () => {
options?.fallback ?? null) as SidebarRootComponentProps['renderSlot']}
/>)
expect(screen.getByText('DSH')).toBeTruthy()
expect(screen.getByText('Local Build')).toBeTruthy()
expect(screen.getByText('DSH Local Build')).toBeTruthy()
expect(screen.getByText(expected)).toBeTruthy()
})