这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@samdickson22
Copy link
Contributor

@samdickson22 samdickson22 commented Aug 30, 2025

What problem(s) was I solving?

Fixed visual layout shifts in the message stream that occurred when relative timestamps dynamically updated (e.g., from "just now" to "1 minute ago"). These layout shifts were distracting to users, causing text to jump horizontally while they were typing or reading the conversation history.

Related issues:

  • ENG-1833: timestamp changes to "1 minute ago" and this causes the thought text to shift around

What user-facing changes did I ship?

Visual Stability

  • Eliminated all horizontal layout shifts when timestamps update
  • Messages remain perfectly aligned as time passes, providing a stable reading experience
  • No more distracting text jumps while composing prompts

Shortened Timestamp Format

  • Changed "less than a minute ago" → "<1 minute ago" (saves space)
  • Changed "about X hours ago" → "~X hours ago" (more concise)
  • Timestamps now fit comfortably in their allocated space

How I implemented it

Fixed-Width Containers

Applied 160px fixed-width containers to timestamp elements in:

  • ConversationContent.tsx: Both the main message view and sub-task paths
  • TaskGroup.tsx: Task group timestamp displays
  • Changed from shrink-0 (flexible) to w-[160px] (fixed) width
  • Added justify-end and text-right for proper right-alignment

Timestamp Text Formatting

Modified formatTimestamp() function in formatting.ts:

  • Post-processes date-fns output to shorten common strings
  • Uses string replacement since these messages come from the library
  • Maintains all existing functionality while reducing text length

CSS Classes Applied

  • Container: w-[160px] justify-end (replaces shrink-0)
  • Text spans: Added text-right block for consistent alignment
  • Ensures timestamps stay right-aligned within their fixed container

How to verify it

  • I have ensured make check test passes

Manual Testing

  1. Open a session and send a message
  2. Watch the timestamp change from "just now" to "<1 minute ago"
    • Verify no horizontal shifting of message content
    • Confirm timestamp remains right-aligned
  3. Wait for timestamps to show "~2 hours ago" format
    • Check that the ~ prefix displays correctly
  4. Resize the window to various widths
    • Ensure timestamps maintain their position
  5. Test in both light and dark themes
  6. Check TaskGroup expanded views for proper timestamp alignment

Description for the changelog

Fixed timestamp layout shifts in conversation view by applying fixed-width containers to prevent visual jumps when relative timestamps update. Also shortened timestamp formats for better space efficiency ("less than a minute ago" → "<1 minute ago", "about X hours ago" → "~X hours ago").

Apply fixed-width containers (160px) to timestamp elements to prevent
visual jumps when relative timestamps update from shorter to longer
strings. Also shortened timestamp text to fit better:
- 'less than a minute ago' → '<1 minute ago'
- 'about X hours ago' → '~X hours ago'

The fixed width eliminates all layout shifts while maintaining clean
right-aligned timestamps across all messages.
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to d27f71a in 53 seconds. Click for details.
  • Reviewed 78 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. humanlayer-wui/src/components/internal/SessionDetail/views/ConversationContent.tsx:294
  • Draft comment:
    Fixed right-side container by setting a fixed width (w-[160px]) and explicit text alignment (justify-end, text-right block) to prevent timestamp layout shifts. Verify that the fixed width works well on various screen sizes.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to verify that the fixed width works well on various screen sizes. This falls under the category of asking the author to ensure the behavior is intended or to double-check things, which is against the rules.
2. humanlayer-wui/src/components/internal/SessionDetail/views/TaskGroup.tsx:267
  • Draft comment:
    Applied a fixed width and right alignment (w-[160px] text-right, plus 'text-right block' on the timestamp) in TaskGroup to prevent layout shifts. Ensure consistency across components.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is purely informative, explaining what changes were made and why. It doesn't provide a suggestion, ask for confirmation, or point out a potential issue. It violates the rule against making purely informative comments.
3. humanlayer-wui/src/utils/formatting.ts:27
  • Draft comment:
    Improved relative timestamp formatting by replacing verbose strings with concise versions (e.g., '<1 minute ago' and '~X hours ago'). Confirm that these replacements align with localization needs if applicable.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to confirm that the replacements align with localization needs. This falls under the rule of not asking the author to confirm their intention or ensure behavior is intended. The comment does not provide a specific code suggestion or ask for a specific test to be written.

Workflow ID: wflow_9e2W2U0oZYa9jgSv

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@samdickson22 samdickson22 changed the title Fix timestamp layout shifts in message stream sam/eng-1883 - Fix timestamp layout shifts in message stream Aug 30, 2025
@samdickson22 samdickson22 changed the title sam/eng-1883 - Fix timestamp layout shifts in message stream sam/eng-1833 - Fix timestamp layout shifts in message stream Sep 2, 2025
@balanceiskey balanceiskey merged commit ce56fdd into humanlayer:main Sep 3, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants