Repository navigation
feat(workbench): show compact relative timestamps in desktop sidebar conversation rows - #7243
Open
YayoiNanoka wants to merge 1 commit into
Open
YayoiNanoka wants to merge 1 commit into
YayoiNanoka wants to merge 1 commit into
Conversation
YayoiNanoka
force-pushed
the
feat/sidebar-relative-time
branch
from
November 27, 2026 04:55
7352dfa to
a417d84
Compare
…conversation rows Display compact, width-stable relative timestamps (now / 刚刚 / 剛剛, m, h, d, mo, y) in the trailing slot of idle, read desktop sidebar conversation rows using a single shared minute-aligned clock and zero-layout-shift geometry. Generated-by: Antigravity (Gemini)
YayoiNanoka
force-pushed
the
feat/sidebar-relative-time
branch
from
November 28, 2026 08:28
a417d84 to
d2fae11
Compare
YayoiNanoka
marked this pull request as ready for review
November 28, 2026 08:38
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Problem
In Maka's desktop left sidebar (
WorkspaceBrowser.tsx), idle and read conversation rows currently leave their trailing slot empty until hovered or selected. Users scanning a busy sidebar have no at-a-glance recency cue for older conversations, and any naive inline timestamp either shifts conversation titles horizontally on hover or spawns per-row timers that scale poorly with long conversation histories.Solution
products/maka/workbench/app/sidebarRelativeTime.ts,products/maka/workbench/locales/*.json): Formatssession.updatedAt(ms) against an injectable clock with localized sub-minute labels across all 12 workbench locales (nowinen,刚刚inzh-CN,剛剛inzh-TW/zh-HK,今inja,방금inko,jetztinde,ahoraines,<1minfr,orainit,agorainpt-BR,сейч.inru), deterministic floored compact units (1m–59m,1h–23h,1d–29d,1mo–11mo,1y+), future clock-skew clamping tonow, and empty-string degradation for invalid or non-positive timestamps.WorkspaceBrowser.tsx): Maintains one sharedrelativeTimeNowsignal perWorkspaceBrowsergated onplatform.idiom !== 'terminal' && lifecycle() === 'active', aligned to wall-clock minute boundaries vianextMinuteTickDelay, cleaned up on unmount/background, and immediately refreshed on return toactive. Becauselane()does not depend on the clock signal, minute ticks update only visible idle-time<Text>bindings in place (O(1)timer regardless of list length).WorkspaceBrowser.tsx,DESIGN.md): Shares the desktop row's right-aligned trailing slot (right: 8, aligned with the32 pt⋯icon spine) with strict mutual exclusion (actionsShown>workingspinner >hasUnreaddot > relative timestamp), reusesmenuDetailTextStyle(12/16 pt) withtabular-nums, scales trailing title clearance (16 ptat default text size,24 ptwhenfontScale() > 1) so'11mo'never clips or collides with titles ordesktopCaption()even atBROWSER_MIN = 192 ptandmaxTextSize(1.3×), and tracks nativeonFocusIn/onFocusOuton the row container so keyboard focus on the conversation row or⋯button cleanly reveals⋯and suppresses the overlaid timestamp with zero overlap or layout shift.点击展开中文
要解决的问题
在 Rust Maka 桌面端左侧边栏(
WorkspaceBrowser.tsx)中,处于空闲且已读状态的对话行在未悬停、未选中时,右侧尾部槽位完全空白,用户浏览对话列表时缺少直观的活跃时间提示;如果直接内联渲染时间戳,容易在悬停切换⋯菜单按钮时引发标题水平抖动,或为每行创建独立定时器造成性能浪费。当前解决方案
sidebarRelativeTime.ts、products/maka/workbench/locales/*.json):小于 1 分钟或存在未来时钟偏差时显示 12 语言本地化短标签(en:now、zh-CN:刚刚、zh-TW/zh-HK:剛剛、ja:今、ko:방금等);1 分钟及以上使用宽度稳定的紧凑单位(1m–59m、1h–23h、1d–29d、1mo–11mo、1y+);无效或非正时间戳静默降级为空字符串。WorkspaceBrowser.tsx):在WorkspaceBrowser作用域维护唯一的分钟对齐共享时钟信号(O(1)定时器),仅在桌面端且lifecycle() === 'active'时运行,后台自动暂停、回到前台立即追平、卸载时通过cleanup清理,且每分钟跳变仅就地更新可见空闲行的文本绑定。WorkspaceBrowser.tsx、DESIGN.md):桌面端行尾固定槽位按严格互斥优先级展示:actionsShown(⋯按钮)>working加载指示器 >hasUnread未读圆点 > 紧凑相对时间。时间标签复用menuDetailTextStyle(12/16 pt)与等宽数字(tabular-nums),与行尾8 pt图标基准线对齐,标题按钮根据fontScale()预留16 pt/24 pt右侧净空,确保在最窄侧边栏(192 pt)与最大字号(1.3×)下不裁剪、不与标题或desktopCaption()重叠,且在空闲/未读/运行中/悬停/键盘聚焦/选中态之间标题位置保持零位移;同时通过行容器原生onFocusIn/onFocusOut确保键盘Tab聚焦到行或⋯按钮时隐藏时间标签,避免图标与文字重叠。验证情况
node scripts/i18n/check.mjs:通过(全部 12 个语言目录校验通过,zh-HK.json遵循 overlay 继承规则)。node --test products/maka/workbench/tests/*.test.mjs:324/324 通过(含sidebar-relative-time.test.mjs全部边界、时钟偏差、无效输入与分钟对齐测试)。cargo test --locked -p maka-workbench --lib:100/100 通过(含行为级无头布局测试sidebar_relative_time_shares_trailing_slot_without_layout_shift,验证窄侧边栏与1.0×/1.3×字号下全部 11 种本地化"now"标签、标题与desktopCaption()无重叠零位移、冒泡等待子会话不显示冗余时间戳、键盘TabonFocusIn/onFocusOut及共享时钟后台暂停/前台追平)。cargo fmt --all -- --check、biome format plugins/ products/、node scripts/asf-license-headers.mjs check、tsc -p products/maka/bundle/tsconfig.json、node scripts/ci.mjs run contracts、node scripts/ci.mjs run product全部通过。native-desktop渲染器中截取改动前后对比图(Dark / Light 主题),确认实际视觉排版、对齐与对比度表现一致。Verification
Automated checks run locally (rebased onto
origin/main):cargo fmt --all -- --check— passednpx biome format plugins/ products/— passednode scripts/asf-license-headers.mjs check— passednode scripts/i18n/check.mjs— passed (12 locales)npx tsc -p products/maka/bundle/tsconfig.json— passednode --test products/maka/workbench/tests/*.test.mjs— 324 passed, 0 failedcargo test --locked -p maka-workbench --lib— 100 passed, 0 failed (1 unrelated ignored)node scripts/ci.mjs run contracts— passed (includesui_types+tsc)node scripts/ci.mjs run product— passedAI use
Select exactly one:
Tool(s) and scope: Antigravity (Gemini) assisted with implementing the compact relative-time formatter, 12-locale catalog entries, shared minute-aligned clock, trailing-slot layout updates, unit and headless layout tests, and PR documentation.
Checklist
Does this PR entail a breaking change or persisted-data migration?
upgrade_compat.rscoverage under Summary aboveDoes this PR entail a change in behavior?