Skip to content

feat: UI updates to ChatInterface component and global styles. Changi…#218

Merged
viper151 merged 2 commits intomainfrom
feature/modernize-tool-design
Oct 31, 2025
Merged

feat: UI updates to ChatInterface component and global styles. Changi…#218
viper151 merged 2 commits intomainfrom
feature/modernize-tool-design

Conversation

@viper151
Copy link
Contributor

@viper151 viper151 commented Oct 31, 2025

…ng how tools look like

Summary by CodeRabbit

Release Notes

  • UI/UX Improvements
    • Tool results now display with color-coded significance, descriptive badges, and improved formatting.
    • Search tools show in a more compact, streamlined layout with better input details visibility.
    • Collapsible sections animate smoothly with rotating indicators for improved interactivity.
    • Enhanced file and diff viewing with refined styling and better copy interactions.
    • Improved keyboard navigation and responsive behavior across dropdowns and collapsible sections.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 31, 2025

Walkthrough

The PR enhances the chat interface's tool message rendering by introducing specialized UI for search tools (Grep/Glob), propagating structured tool results via a new toolUseResult field, improving tool input/result presentation with collapsible sections and color-coded badges, and adding CSS animations for expandable details elements.

Changes

Cohort / File(s) Summary
Tool message rendering and result propagation
src/components/ChatInterface.jsx
Implements specialized compact UI for Grep/Glob tools; adds structured toolUseResult data propagation on tool-use messages; enhances tool input panels with collapsible, descriptive sections; introduces color-coded result badges (success/error, New File, Tool Result); conditionally hides results for Edit/Write/Bash tools unless error occurs; updates component signature to expose additional props (onNavigateToSession, onShowSettings, autoExpandTools, showRawParameters, showThinking, onTaskClick, onShowAllTasks, onInputFocusChange, externalMessageUpdate).
Details animation styling
src/index.css
Adds 200ms cubic-bezier transition for details/chevron elements; rotates chevron 180° when details are open.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • ChatInterface.jsx contains heterogeneous changes across multiple tool-rendering branches, requiring separate verification for Grep/Glob vs. other tools.
  • New toolUseResult data propagation and conditional rendering logic require validation of backward compatibility.
  • Multiple UI sections updated with collapsible patterns—verify consistency and edge cases for missing/error results.
  • CSS changes are trivial but verify animation timing visually.

Poem

🐰 A search tool shines in compact dress,
With badges bold and results blessed,
Chevrons spin with grace and flair,
Details bloom and collapse with care—
Tools now strut their finest show,
Making chat delightfully glow!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "feat: UI updates to ChatInterface component and global styles. Changing how tools look like." is clearly related to the main changes in the changeset. The raw summary confirms that the primary modifications involve rendering logic updates for tool messages, UI/UX enhancements, styling improvements with new animation behaviors in global CSS, and enhanced presentation of tool results. The title accurately captures these core changes, though it could be more specific about the nature of the improvements (e.g., modernized tool card design, structured tool result rendering). The title is not misleading or off-topic, and it adequately summarizes what a developer scanning the history would expect from this changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)

✅ Unit Test PR creation complete.

  • Create PR with unit tests
  • Commit unit tests in branch feature/modernize-tool-design
  • Post copyable unit tests in a comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/ChatInterface.jsx (1)

511-556: Edit diff reconstruction only reverts first occurrence

currentContent.replace(...) undoes only the first match of new_string. If the snippet appears multiple times, the “before” view is wrong. Use replaceAll (with fallback) to revert all occurrences, or fetch the exact pre/post from backend when available.

- const oldContent = currentContent.replace(input.new_string, input.old_string);
+ const oldContent =
+   (typeof currentContent.replaceAll === 'function'
+     ? currentContent.replaceAll(input.new_string, input.old_string)
+     : currentContent.split(input.new_string).join(input.old_string));

Optional: prefer the existing authenticatedFetch('/api/git/file-with-diff') path (used later) to obtain accurate old/new content.

Also applies to: 569-590

🧹 Nitpick comments (1)
src/components/ChatInterface.jsx (1)

4151-4158: Remove inline <style> chevron rule; rely on global CSS

Inline details[open] .details-chevron duplicates index.css and risks drift. Prefer a single source in CSS.

-  <style>
-    {`
-      details[open] .details-chevron {
-        transform: rotate(180deg);
-      }
-    `}
-  </style>
+  {/* Chevron rotation handled in src/index.css */}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bf1b3e7 and c4e1966.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • src/components/ChatInterface.jsx (20 hunks)
  • src/index.css (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/components/ChatInterface.jsx (2)
src/App.jsx (4)
  • autoExpandTools (58-58)
  • showRawParameters (59-59)
  • sendByCtrlEnter (62-62)
  • isInputFocused (55-55)
src/components/TodoList.jsx (1)
  • TodoList (5-89)
🔇 Additional comments (4)
src/index.css (1)

829-839: Narrow the selectors to avoid unintended matches and duration conflicts

Using summary svg[class*="group-open"] and summary svg[class*="transition-transform"] is overly broad and can override Tailwind utilities unexpectedly. You already have .details-chevron—target that instead and drop the substring selectors.
[Suggest_recommended_refactor]

Apply:

-  details[open] summary svg[class*="group-open"] {
-    transform: rotate(180deg);
-  }
+  /* Let .details-chevron be the sole rotation target */
+  /* Rotation for open state is already handled by details[open] .details-chevron */
@@
-  .details-chevron,
-  summary svg[class*="transition-transform"] {
-    transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
-  }
+  /* Smooth chevron transition */
+  .details-chevron {
+    transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
+  }
src/components/ChatInterface.jsx (3)

419-463: Minimized Grep/Glob header: concise and readable — LGTM

Good UX to collapse frequent search tools and show key params inline; parsing is guarded. Nice touch linking to results.


1034-1081: Structured Grep/Glob results rendering — LGTM

Solid use of structured toolUseResult with file open callbacks and scrollable list. Good typography and affordances.

If toolData.numFiles can disagree with filenames.length, consider showing both or trusting one source consistently.


2481-2484: toolUseResult propagation attached to tool results — LGTM

The shape extension is backward‑compatible (null-safe) and enables richer rendering for search tools.

Also applies to: 2567-2571

Comment on lines +449 to +457
<a
href={`#tool-result-${message.toolId}`}
className="flex-shrink-0 text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors flex items-center gap-1"
>
<span>results</span>
<svg className="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
</svg>
</a>
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Sanitize anchor IDs to avoid invalid fragments and collisions

message.toolId may contain spaces/special chars. Use a sanitized ID for both href and id to ensure valid, unique anchors.

- href={`#tool-result-${message.toolId}`}
+ href={`#tool-result-${String(message.toolId ?? '').replace(/[^a-zA-Z0-9_-]/g, '-')}`}
@@
- id={`tool-result-${message.toolId}`}
+ id={`tool-result-${String(message.toolId ?? '').replace(/[^a-zA-Z0-9_-]/g, '-')}`}

Please verify whether toolId is guaranteed unique per message; if not, consider appending the array index or timestamp to the slug.

Also applies to: 929-930


🏁 Script executed:

#!/bin/bash
# Inspect target lines in ChatInterface.jsx
sed -n '440,465p' src/components/ChatInterface.jsx
echo "---"
sed -n '920,935p' src/components/ChatInterface.jsx

Length of output: 2265


🏁 Script executed:

#!/bin/bash
# Search for toolId usage and its source
rg -nP -C5 'message\.toolId' src/components/ChatInterface.jsx | head -80

Length of output: 2039


🏁 Script executed:

#!/bin/bash
# Search for where toolId is assigned or originates
rg -nP 'toolId\s*[:=]' src/components/ChatInterface.jsx | head -40

Length of output: 401


🏁 Script executed:

#!/bin/bash
# Look for unique/identifier generation patterns in the component
rg -nP '(uuid|crypto|timestamp|index|Math\.random)' src/components/ChatInterface.jsx

Length of output: 4393


🏁 Script executed:

#!/bin/bash
# Search for anchor id patterns elsewhere in the codebase
rg -nP 'id=\{' src/components/ChatInterface.jsx | head -20

Length of output: 60


🏁 Script executed:

#!/bin/bash
# Find where blobIdx is defined and its scope
rg -nP -B10 'blobIdx\s*=|for\s*\(\s*.*\s+blobIdx' src/components/ChatInterface.jsx | head -60

Length of output: 594


🏁 Script executed:

#!/bin/bash
# Check what toolCallId values look like (from API responses or comments)
rg -nP -C3 'toolCallId' src/components/ChatInterface.jsx | head -40

Length of output: 1320


🏁 Script executed:

#!/bin/bash
# Verify message index is passed to MessageComponent for rendering
rg -nP 'MessageComponent|message.*index' src/components/ChatInterface.jsx | grep -A2 -B2 'index='

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Search for where toolId is used as a key or identifier elsewhere
rg -nP '\btoolId\b' src/components/ChatInterface.jsx | wc -l

Length of output: 2


🏁 Script executed:

#!/bin/bash
# Find where visibleMessages is defined and how messages are collected
rg -nP 'visibleMessages\s*=' src/components/ChatInterface.jsx | head -20

Length of output: 46


🏁 Script executed:

#!/bin/bash
# Check if messages from different sessions can appear together
rg -nP 'visibleMessages|chatMessages' src/components/ChatInterface.jsx | grep -E '(const|let|filter|concat|\.map)' | head -30

Length of output: 256


🏁 Script executed:

#!/bin/bash
# Look at the message rendering context to understand data flow
sed -n '4340,4360p' src/components/ChatInterface.jsx

Length of output: 783


🏁 Script executed:

#!/bin/bash
# Check if there's any deduplication or ID collision handling
rg -nP '(duplicate|collision|unique|Set\(|toolId)' src/components/ChatInterface.jsx | grep -v 'toolId.*=\|toolId.*:' | head -20

Length of output: 291


🏁 Script executed:

#!/bin/bash
# Check the visibleMessages computation to understand data sources
sed -n '3493,3550p' src/components/ChatInterface.jsx

Length of output: 2419


🏁 Script executed:

#!/bin/bash
# Search for whether multiple sessions/datasets can coexist in visibleMessages
rg -nP 'chatMessages|visibleMessages' src/components/ChatInterface.jsx | grep -E 'filter|slice|concat|\.\.\.' | head -20

Length of output: 57


🏁 Script executed:

#!/bin/bash
# Check if toolCallId format from API is documented or validated anywhere
rg -nP 'toolCallId|call_' src/components/ChatInterface.jsx | grep -v '\.replace\|toolId\|:' | head -20

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Search for API documentation or type hints about toolCallId format
rg -nP 'toolCallId|tool.*Id.*:.*string' src/ --type=ts --type=js | head -20

Length of output: 486


🏁 Script executed:

#!/bin/bash
# Check if there are existing sanitization utilities or patterns in codebase
rg -nP 'sanitize|escape|replace.*special' src/ --type=js --type=ts | head -20

Length of output: 874


Sanitize anchor IDs and use message index to guarantee uniqueness

External API sources (toolCallId, part.id) may contain special characters; HTML id attributes require [a-zA-Z0-9_-] subset. Additionally, use message index to ensure anchors remain unique even if toolIds collide.

Apply at lines 450 (href) and 929 (id):

- href={`#tool-result-${message.toolId}`}
+ href={`#tool-result-${index}-${String(message.toolId ?? '').replace(/[^a-zA-Z0-9_-]/g, '-')}`}
- id={`tool-result-${message.toolId}`}
+ id={`tool-result-${index}-${String(message.toolId ?? '').replace(/[^a-zA-Z0-9_-]/g, '-')}`}

This pattern aligns with existing sanitization practices in the codebase (e.g., PRDEditor.jsx line 547).

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/components/ChatInterface.jsx around lines 449 to 457 (href) and line 929
(id), the anchor href/id use message.toolId (and other external IDs) directly
which may include disallowed characters and can collide; sanitize the ID to only
[a-zA-Z0-9_-] (e.g. strip/replace invalid chars) and append the message index
(or a per-message unique index) to guarantee uniqueness; update the href to
`#tool-result-{sanitizedId}-{index}` and the corresponding element id at line
929 to match the same sanitizedId-index pattern so anchors are safe and unique
across messages.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 31, 2025

Note

Unit test generation is an Early Access feature. Expect some limitations and changes as we gather feedback and continue to improve it.


Generating unit tests... This may take up to 20 minutes.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 31, 2025

UTG Post-Process Complete

No new issues were detected in the generated code and all check runs have completed. The unit test generation process has completed successfully.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 31, 2025

Creating a PR to put the unit tests in...

The changes have been created in this pull request: View PR

@viper151 viper151 merged commit b612035 into main Oct 31, 2025
1 check passed
@viper151 viper151 deleted the feature/modernize-tool-design branch October 31, 2025 07:49
DumoeDss pushed a commit to atelierai/claudecodeui that referenced this pull request Nov 4, 2025
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