Skip to content

fix(web): prevent 'last saved at' label from vertical stacking in agent home card - #16756

Merged
wangq8 merged 2 commits into
infiniflow:mainfrom
euvre:fix-agent-home-card-last-saved-at-text-layout
Jul 9, 2026
Merged

wangq8 merged 2 commits into
infiniflow:mainfrom
euvre:fix-agent-home-card-last-saved-at-text-layout

Conversation

@euvre

@euvre euvre commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Added whitespace-nowrap to the lastSavedAt / publishedAt labels in HomeCard.
  • Added truncate to the timestamp so it no longer pushes the label out of its bounding box.
  • Added min-w-0 to the flex containers to allow proper overflow handling in nested flex layouts.

Checklist

  • I have verified the fix with the existing UI layout.
  • The change is scoped to web/src/components/home-card.tsx.
  • CI checks are expected to run.

/kind bug
/label ci

…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.
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. labels Jul 8, 2026
@euvre euvre added the ci Continue Integration label Jul 8, 2026
@coderabbitai

coderabbitai Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 13a38883-a8bd-4c54-9069-3339d42dcffd

📥 Commits

Reviewing files that changed from the base of the PR and between 8e3bbad and 1c81ba3.

📒 Files selected for processing (1)
  • web/src/components/home-card.tsx

📝 Walkthrough

Walkthrough

Modifies the Time component's CSS class from whitespace-nowrap to truncate and restructures the showReleaseTime conditional block in HomeCard with additional layout wrappers and dedicated <span> elements for localized labels, replacing template-string concatenation.

Changes

HomeCard Time Display

Layer / File(s) Summary
Time truncation and release layout
web/src/components/home-card.tsx
Time component now uses truncate instead of whitespace-nowrap; showReleaseTime block adds min-w-0 wrappers and renders localized labels via <span> elements instead of interpolated strings.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

A hop, a tweak, a truncated line,
Labels now in spans align,
Min-w-0 keeps the layout tight,
This bunny's diff is small but right! 🐰
Off I hop into the night~

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly names the agent home card layout fix and matches the main change.
Description check ✅ Passed The description includes the required summary, context, change details, and checklist items.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@wangq8 wangq8 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. Correct CSS diagnosis — The root cause is Flexbox's default min-width: auto, which prevents children from shrinking below their content size. Adding min-w-0 is the canonical fix.

  2. Consistent overflow hierarchy — The label gets whitespace-nowrap (must always be readable), the timestamp gets truncate (can be ellipsized when space is tight). This is the right priority.

  3. truncate vs whitespace-nowrap on Time — truncate in Tailwind is shorthand for overflow: hidden; text-overflow: ellipsis; white-space: nowrap, so it retains the nowrap behavior while safely handling overflow. Smart upgrade.

  4. 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 → correct
  • min-w-0 on nested flex containers → allows ellipsis to kick in
  • Label <span> with whitespace-nowrap → prevents character-by-character wrapping
  • No style leakage to other callers of HomeCard

Verdict

LGTM — clean, correct CSS fix. Ready to merge.

@wangq8
wangq8 merged commit 3ec9187 into infiniflow:main Jul 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants