Skip to content

[UI][BugFix] Fix the UI could look weird when the window size is small [1/n]#342

Merged
XinweiHe merged 3 commits intomainfrom
xinwei_trace_and_span_small_window_fix_v1
Nov 24, 2025
Merged

[UI][BugFix] Fix the UI could look weird when the window size is small [1/n]#342
XinweiHe merged 3 commits intomainfrom
xinwei_trace_and_span_small_window_fix_v1

Conversation

@XinweiHe
Copy link
Collaborator

@XinweiHe XinweiHe commented Nov 22, 2025

Summary

as titled.

Type of Change

  • feat - A new feature
  • fix - A bug fix
  • docs - Documentation only changes
  • style - Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • refactor - A code change that neither fixes a bug nor adds a feature
  • perf - A code change that improves performance
  • test - Adding missing tests or correcting existing tests
  • build - Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
  • ci - Changes to our Cl configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
  • chore - Other changes that don't modify sc or test files
  • revert - Reverts a previous commit
  • security - A security fix or improvement
  • github - Changes to our GitHub configuration files and scripts
  • other (please describe):

Details

Screenshots / Recordings (if applicable)

  1. default
Screenshot 2025-11-23 at 4 18 38 PM
  1. smaller window
Screenshot 2025-11-23 at 4 19 11 PM

Checklist

  • I have read the CONTRIBUTING.md
  • I have added/updated tests where applicable
  • I have added screenshots or recordings for UI changes (if applicable)
  • I have updated documentation where necessary

@XinweiHe XinweiHe requested a review from a team as a code owner November 22, 2025 19:58
@greptile-apps
Copy link

greptile-apps bot commented Nov 22, 2025

Greptile Overview

Greptile Summary

improved responsive UI by implementing container queries to progressively hide badges at small window sizes, preventing overflow and visual clutter. Trace.tsx properly implements container queries with @container wrapper, while function name truncation was added to Span.tsx.

  • Trace.tsx: refactored badge layout from justify-between to flexbox with spacer, added @container class to wrapper divs (lines 846, 906), and implemented responsive hiding of badges (environment at 300px, span count at 400px, duration at 450px, error/warning icons at 520px/550px, timestamp at 580px, share/collapse at 600px)
  • Span.tsx: similar badge layout refactor and added function name truncation logic (50 chars), but missing @container class on wrapper div at line 166, causing container queries to fail
  • both files converted buttons to Badge components for consistency

Confidence Score: 1/5

  • this PR has a critical bug that breaks the responsive UI functionality for span components
  • the Span component uses container queries throughout (@[300px]:, @[500px]:, @[550px]:) but lacks the required @container class on its wrapper div (line 166), causing all responsive hiding to fail and badges to overflow at small widths - the exact issue this PR aims to fix
  • pay close attention to ui/src/components/explore/span/Span.tsx - the missing @container class will cause container queries to fail

Important Files Changed

File Analysis

Filename Score Overview
ui/src/components/explore/Trace.tsx 4/5 implemented responsive UI using container queries with proper @container wrapper; badges progressively hide at various breakpoints (300px-600px) to prevent overflow
ui/src/components/explore/span/Span.tsx 1/5 added container queries to hide badges at small sizes, but missing @container class on wrapper div (line 166) causing queries to fail; also added function name truncation logic

Sequence Diagram

sequenceDiagram
    participant User
    participant Browser
    participant Trace
    participant Span
    
    User->>Browser: Resize window to small width
    Browser->>Trace: Trigger container query evaluation
    Trace->>Trace: Check @container width
    alt Width < 300px
        Trace->>Trace: Hide environment badge
    end
    alt Width < 400px
        Trace->>Trace: Hide span count badge
    end
    alt Width < 450px
        Trace->>Trace: Hide duration badge
    end
    alt Width < 520px
        Trace->>Trace: Hide error icon badge
    end
    alt Width < 550px
        Trace->>Trace: Hide warning icon badge
    end
    alt Width < 580px
        Trace->>Trace: Hide timestamp badge
    end
    alt Width < 600px
        Trace->>Trace: Hide share & collapse badges
    end
    
    User->>Trace: Click to expand trace
    Trace->>Span: Render child spans
    Browser->>Span: Trigger container query evaluation
    Span->>Span: Check @container width (FAILS - no @container class)
    Note over Span: Container queries don't work!<br/>Badges remain visible regardless of width
    Span-->>Browser: Badges overflow at small widths
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

{/* Share Dialog */}
<Dialog open={shareDialogOpen} onOpenChange={setShareDialogOpen}>
<DialogContent className="sm:max-w-md">
<DialogContent className="@[640px]:max-w-md">
Copy link

Choose a reason for hiding this comment

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

logic: container query @[640px]: won't work here because DialogContent is rendered outside any element with the @container class (it's at the root level, after line 1229). revert to sm:max-w-md or wrap Dialog in a container.

Suggested change
<DialogContent className="@[640px]:max-w-md">
<DialogContent className="sm:max-w-md">
Prompt To Fix With AI
This is a comment left during a code review.
Path: ui/src/components/explore/Trace.tsx
Line: 1233:1233

Comment:
**logic:** container query `@[640px]:` won't work here because `DialogContent` is rendered outside any element with the `@container` class (it's at the root level, after line 1229). revert to `sm:max-w-md` or wrap Dialog in a container.

```suggestion
        <DialogContent className="sm:max-w-md">
```

How can I resolve this? If you propose a fix, please make it concise.

@XinweiHe
Copy link
Collaborator Author

@greptile can you rate the code changes

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Additional Comments (1)

  1. ui/src/components/explore/span/Span.tsx, line 166-174 (link)

    logic: container queries (@[300px]:, @[500px]:, etc.) used throughout this component won't work because this wrapper div lacks the @container class

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@XinweiHe XinweiHe merged commit dcd36c7 into main Nov 24, 2025
8 checks passed
@XinweiHe XinweiHe deleted the xinwei_trace_and_span_small_window_fix_v1 branch November 24, 2025 00:34
XinweiHe added a commit that referenced this pull request Jan 23, 2026
…_window_fix_v1

[UI][BugFix] Fix the UI could look weird when the window size is small [1/n]
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.

1 participant