Repository navigation
fix(web): prevent 'last saved at' label from vertical stacking in agent home card - #16756
Conversation
…nt home card The Chinese label "上次保存于" was wrapping character-by-character when the card width was constrained, causing a vertical layout. This change adds whitespace-nowrap to the label and lets the timestamp truncate instead of pushing the label.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughModifies the ChangesHomeCard Time Display
Estimated code review effort: 1 (Trivial) | ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
wangq8
left a comment
There was a problem hiding this comment.
Review: PR #16756 — fix(web): prevent 'last saved at' label from vertical stacking in agent home card
Author: euvre | +11/-7 | 1 file
Summary
Fixes a CSS layout bug where the Chinese label "上次保存于" wraps character-by-character in narrow agent home cards. The fix uses three complementary CSS techniques: min-w-0 on flex containers to allow proper shrinking, whitespace-nowrap on the label <span> to keep it horizontal, and truncate on the timestamp as the overflow pressure valve.
✅ What's Good
-
Correct CSS diagnosis — The root cause is Flexbox's default
min-width: auto, which prevents children from shrinking below their content size. Addingmin-w-0is the canonical fix. -
Consistent overflow hierarchy — The label gets
whitespace-nowrap(must always be readable), the timestamp getstruncate(can be ellipsized when space is tight). This is the right priority. -
truncatevswhitespace-nowraponTime—truncatein Tailwind is shorthand foroverflow: hidden; text-overflow: ellipsis; white-space: nowrap, so it retains the nowrap behavior while safely handling overflow. Smart upgrade. -
Scoped, single-file change — +11/-7, trivially reviewable.
🔍 Observations
1. Label colon placement (minor i18n note)
The colon is hardcoded after the label:
<span className="whitespace-nowrap">{t('flow.lastSavedAt')}:</span>Some locales (French, Arabic) may place the colon differently or need a non-breaking space before it. This is an existing convention throughout the codebase — not introduced by this PR. Worth noting for a future i18n pass but out of scope here.
2. else branch unchanged
When showReleaseTime is false, the code renders <Time time={data.update_time} /> directly — no min-w-0 or truncation wrapper. In practice, this is a standalone element without a sibling label, so wrapping isn't an issue. No action needed.
🧪 Verified Through Code Review
truncate=overflow: hidden+text-overflow: ellipsis+white-space: nowrap→ correctmin-w-0on nested flex containers → allows ellipsis to kick in- Label
<span>withwhitespace-nowrap→ prevents character-by-character wrapping - No style leakage to other callers of
HomeCard
Verdict
LGTM — clean, correct CSS fix. Ready to merge.
Summary
The Chinese label "上次保存于" in the agent home card was wrapping character-by-character when the card width was constrained, causing it to display vertically instead of horizontally. This PR fixes that by keeping the label on a single line and letting the timestamp truncate if space is limited.
Changes
whitespace-nowrapto thelastSavedAt/publishedAtlabels inHomeCard.truncateto the timestamp so it no longer pushes the label out of its bounding box.min-w-0to the flex containers to allow proper overflow handling in nested flex layouts.Checklist
web/src/components/home-card.tsx./kind bug
/label ci