Skip to content

Conversation

@sawka
Copy link
Member

@sawka sawka commented Nov 15, 2025

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 15, 2025

Walkthrough

This pull request introduces container query support and responsive design adjustments to the AI panel components. Changes include adding the @container directive to the AIPanel component while removing it from AIPanel header, widening max-width constraints for user messages with responsive variants, refactoring the ThinkingMode button to use dynamic class composition, and adding a new 450px container width token to the Tailwind configuration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • AIPanel container query movement: The @container directive is added to aipanel.tsx but removed from aipanelheader.tsx. Verify that this relocation doesn't break existing container query selectors in child components.
  • Responsive width consistency: Ensure the new @w450 responsive variant in aimessage.tsx aligns with the new --container-w450: 450px token defined in tailwindsetup.css.
  • ThinkingMode conditional visibility: Confirm that the conditional rendering of the mode name span doesn't cause unexpected layout shifts or accessibility issues.
  • CSS token usage: Verify that the new --container-w450 token is properly integrated and utilized throughout the codebase.

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided, making it impossible to assess relevance to the changeset. Add a description explaining the UX improvements, the specific responsive design changes, and how they reduce message overlap.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: improving UX for the thinking mode control with better responsiveness and reduced message overlap.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sawka/better-ux-for-thinkingmode

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a190da and 6c3139e.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • frontend/app/aipanel/aimessage.tsx (1 hunks)
  • frontend/app/aipanel/aipanel.tsx (1 hunks)
  • frontend/app/aipanel/aipanelheader.tsx (1 hunks)
  • frontend/app/aipanel/thinkingmode.tsx (2 hunks)
  • frontend/tailwindsetup.css (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-21T05:09:26.916Z
Learnt from: sawka
Repo: wavetermdev/waveterm PR: 2465
File: frontend/app/onboarding/onboarding-upgrade.tsx:13-21
Timestamp: 2025-10-21T05:09:26.916Z
Learning: In the waveterm codebase, clientData is loaded and awaited in wave.ts before React runs, ensuring it is always available when components mount. This means atoms.client will have data on first render.

Applied to files:

  • frontend/app/aipanel/thinkingmode.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build for TestDriver.ai
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
🔇 Additional comments (6)
frontend/tailwindsetup.css (1)

68-68: LGTM! New container width token added.

The new --container-w450: 450px token is properly placed and follows the existing pattern. This enables the @w450 container query breakpoint used in the ThinkingMode component and user messages.

frontend/app/aipanel/aipanel.tsx (1)

467-467: LGTM! Container query support enabled.

Adding the @container directive to the AIPanel establishes the container query context, allowing child components (like ThinkingMode and AIMessage) to use container-based responsive breakpoints such as @w450.

frontend/app/aipanel/aipanelheader.tsx (1)

19-19: LGTM! Redundant container directive removed.

Correctly removes the @container directive from the header since the parent AIPanel component (in aipanel.tsx) now establishes the container query context. This avoids unnecessary nested container contexts while preserving the responsive @xs: variants.

frontend/app/aipanel/thinkingmode.tsx (3)

5-5: Good addition of the cn utility.

The cn utility import enables dynamic class composition for the conditional styling based on the isOpen state.


68-71: Dynamic class composition improves visual feedback.

The button now dynamically adjusts its background color based on the isOpen state, providing better visual feedback to users when the dropdown is active.


75-77: Smart responsive visibility controls — verified and confirmed.

The conditional visibility logic is correctly implemented. Tailwind v4 generates named container-query variants from the --container-* theme variables defined in the @theme section, and the codebase properly defines this setup in git/frontend/tailwindsetup.css with --container-w450: 450px in the @theme block. The @w450:inline breakpoint is therefore correctly recognized and applied. The implementation addresses the PR objectives as described, and the code will function as intended.

"px-2 rounded-lg [&>*:first-child]:!mt-0",
message.role === "user"
? "py-2 bg-accent-800 text-white max-w-[calc(90%-10px)]"
? "py-2 bg-accent-800 text-white max-w-[calc(100%-50px)] @w450:max-w-[calc(100%-105px)]"
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Responsive width constraints updated for better UX.

The user message max-width changes provide more consistent spacing to prevent overlap with other UI elements. The base width is adjusted to calc(100%-50px), and at container widths ≥450px, it further constrains to calc(100%-105px) to accommodate the expanded ThinkingMode button.

Verify that the @w450 container query breakpoint is properly configured in your Tailwind setup:


🏁 Script executed:

#!/bin/bash
# Check Tailwind configuration for container query setup
rg -n "container.*query|@container" tailwind.config.* 2>/dev/null || echo "No tailwind.config found, checking for Tailwind v4 setup..."
rg -n "containerQueries|container-queries" package.json

Length of output: 59


I need to search more broadly for the Tailwind configuration in this codebase. Let me gather additional information:


🏁 Script executed:

#!/bin/bash
# Find tailwind config file with various extensions
fd -e js -e ts -e cjs -e mjs "tailwind\.config" . 2>/dev/null | head -20

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Check package.json for Tailwind and container-queries
cat package.json | grep -A 5 -B 5 "tailwind\|container-queries" 2>/dev/null

Length of output: 1216


🏁 Script executed:

#!/bin/bash
# Search for @w450 usage in the codebase
rg -n "@w450" . 2>/dev/null

Length of output: 309


🏁 Script executed:

#!/bin/bash
# Look for container query configuration patterns
rg -n "containers|@container" frontend/ --type=tsx --type=ts -C 3 2>/dev/null | head -50

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Check the actual file being reviewed
cat frontend/app/aipanel/aimessage.tsx | sed -n '220,235p'

Length of output: 806


🏁 Script executed:

#!/bin/bash
# Search for tailwind config in package.json or other non-standard locations
cat package.json | grep -i "tailwind" | head -20

Length of output: 150


🏁 Script executed:

#!/bin/bash
# Find all tailwind.config references and CSS files
fd "\.config\." . --type f 2>/dev/null | grep -i tailwind
fd "tailwind\.css\|globals\.css" . --type f 2>/dev/null

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Search for where @w450 might be defined (CSS, schema, type defs)
rg -n "w450|containerQueries|container.*query" . --type=json --type=js --type=ts 2>/dev/null | grep -v node_modules | head -30

Length of output: 309


🏁 Script executed:

#!/bin/bash
# Look for CSS files with custom breakpoint or container definitions
find . -name "*.css" -type f 2>/dev/null | grep -v node_modules | head -10
cat $(find . -name "*.css" -type f 2>/dev/null | grep -v node_modules | head -1)

Length of output: 678


🏁 Script executed:

#!/bin/bash
# Check if there's inline tailwind config in vite.config or similar
fd "vite\.config|next\.config" . -e ts -e js 2>/dev/null | head -5

Length of output: 59


🏁 Script executed:

#!/bin/bash
# Check the tailwindsetup.css file for custom breakpoints
cat frontend/tailwindsetup.css

Length of output: 3062


🏁 Script executed:

#!/bin/bash
# Check vite config for Tailwind theme configuration
cat tsunami/frontend/vite.config.ts

Length of output: 886


🏁 Script executed:

#!/bin/bash
# Also check electron vite config
cat electron.vite.config.ts

Length of output: 6061


🌐 Web query:

Tailwind v4 container query syntax @theme custom breakpoints

💡 Result:

Short summary + examples:

  • Turn an element into a container with @container, then use container-query variants that start with @ (e.g. @sm, @md, @max-md). You can also use @Min-[] / @max-[] arbitrary values and named containers like @container/foo with variants @sm/foo. [1][2]

  • Customize container breakpoints in your CSS with @theme using --container-* variables (and media breakpoints with --breakpoint-*). Example: define new container sizes or override defaults. [1][2]

Examples

  1. Basic container query
<style type="text/tailwindcss"> @import "tailwindcss"; </style>
...
(Here @md applies when the parent container reaches the md container size.) [1][3]
  1. Max / range / arbitrary
...
[1][3]
  1. Named container
...
[1][2]
  1. Define custom container breakpoints via @theme
<style type="text/tailwindcss"> @import "tailwindcss"; @theme { --container-8xl: 96rem; /* or reset all and define your own: --container-*: initial; --container-tablet: 20rem; --container-laptop: 32rem; */ } </style>

Then use @8XL or @tablet as container variants. [1][2]

Notes

  • Tailwind v4 includes built-in container query support (no plugin needed). [3]
  • Use rem for consistency with default breakpoints to avoid ordering surprises, or use arbitrary @min/ @max values for one-offs. [1][2]

Sources
[1] Tailwind CSS docs — Responsive design / Container queries.
[2] StackOverflow discussion: using @container and customizing --container-* in Tailwind v4.
[3] Tailwind v4 beta notes (container query support in core).


🌐 Web query:

Tailwind v4.1 @container @w450 syntax how does it work

💡 Result:

Short answer: Tailwind v4.1 uses @container to turn an element into a CSS Container and then container-query variants to apply utilities based on the parent container’s size. You can use the built‑in named container breakpoints (e.g. @sm, @md, @lg) and also arbitrary container-query ranges with bracket syntax (e.g. @Min-[450px], @max-[28rem]) to target specific container widths.

How it works (example):

  • Make parent a container:
    ...
  • Use container-query variants on children:

    @container-aware text

  • Use an arbitrary width test:

    becomes larger when parent ≥ 450px

Notes:

  • @Min-* / @max-* variants map to container query min-width / max-width; you can stack them to make ranges (@Min-[320px]:@max-[600px]:...).
  • The arbitrary-bracket form follows Tailwind’s arbitrary-value syntax (square brackets) and works the same for container queries as for breakpoint/utility values.

Sources: Tailwind v4 container-query docs and release notes (container queries, @min/@max variants) and examples of arbitrary container-query usage. [1][2][3]

References
[1] Tailwind v4 container-query support & examples (official v4 docs/release notes).
[2] Tailwind docs: container / sizing utilities (shows @container usage and @max/@min variants).
[3] Examples / community threads showing arbitrary @Min-[...] usage for container queries.


@w450 container query variants will not work—@container directive is missing from component hierarchy.

While the @w450 breakpoint is properly defined in frontend/tailwindsetup.css as --container-w450: 450px; and Tailwind v4.1.17 is correctly configured, container query variants like @w450:max-w-[calc(100%-105px)] (line 226) and @w450:inline (line 75) require a parent element marked with @container. A search of the codebase found no @container directive anywhere, meaning these responsive constraints will be silently ignored and never activate.

Add @container to an appropriate parent element in the component hierarchy, or remove the @w450: variants if container queries are not intended.

🤖 Prompt for AI Agents
In frontend/app/aipanel/aimessage.tsx around line 226, the Tailwind container
query variants like "@w450:max-w-[calc(100%-105px)]" (and "@w450:inline" at line
75) won't work because no ancestor element is marked with @container; add an
appropriate @container directive to a parent wrapper (for example the component
root or a nearby container that wraps the message elements) so the @w450
container queries can match, or if container queries are not desired remove the
@w450: variants; ensure the chosen parent is high enough in the component
hierarchy to cover these elements and that the container's inline size (or block
size if used) will trigger the defined --container-w450 breakpoint.

@sawka sawka merged commit 1eea4d9 into main Nov 15, 2025
7 of 8 checks passed
@sawka sawka deleted the sawka/better-ux-for-thinkingmode branch November 15, 2025 00:36
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.

2 participants