-
Notifications
You must be signed in to change notification settings - Fork 18
Redesign chat tool-response UI on a unified design system #1812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sidneyswift
wants to merge
21
commits into
test
Choose a base branch
from
claude/chat-response-ui-design-i1qbaw
base: test
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+8,472
−2,143
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f18f37d
feat(chat-tools): add unified tool-response design system + global er…
claude 1b55abe
feat(chat-tools): migrate tool-response cards to unified design system
claude 07f0c00
fix(chat-tools): remove unused ToolCardBody import
claude 7214fe2
docs(tool-ui-audit): complete spreadsheet with artist/search/media to…
claude bcad407
refactor(chat-tools): address review — DRY humanize util, barrel expo…
claude fa41b5a
fix(chat-tools): gate tool-error retry to the latest message
claude 5ed1193
docs(chat-tools): add light/dark gallery screenshots of redesigned to…
claude 1c06ca4
fix(chat-tools): address review findings + correct dark-mode screenshots
claude e7f3ca0
fix(chat-tools): refine review follow-ups (cubic)
claude 44de97f
refactor(chat-tools): resolve remaining review threads
claude 1144eb4
test(chat-tools): add Storybook for verifying tool-response UI states
claude fb85f64
refactor(chat-tools): registry for tool skeletons + hostname-safe soc…
claude cbf8c1f
test(storybook): isolate QueryClient per story to prevent cache leakage
claude 547454f
refactor(chat-tools): address review nits
claude eed770d
feat(chat-tools): plain-English generic tool card for unknown/MCP tools
claude 70989de
wip(chat-tools): design-pass motion/polish (Spotify + in-progress bat…
claude 91f56cc
feat(chat-tools): design-pass — motion, data-viz, clarity across all …
claude 6525c21
docs(tool-ui-audit): after-state screenshots (all states) + before/af…
claude 50cb587
fix(chat-tools): address design-pass review (a11y, security, correctn…
claude e5dafbe
fix(chat-tools): reject protocol-relative video URLs; key-based avata…
claude 6ec2cbf
refactor(chat-tools): extract ArtistAvatar into its own file
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import type { StorybookConfig } from "@storybook/nextjs-vite"; | ||
|
|
||
| const config: StorybookConfig = { | ||
| stories: ["../components/**/*.stories.@(ts|tsx)"], | ||
| addons: [], | ||
| framework: { | ||
| name: "@storybook/nextjs-vite", | ||
| options: {}, | ||
| }, | ||
| staticDirs: ["../public"], | ||
| }; | ||
|
|
||
| export default config; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| import React, { useEffect, useState } from "react"; | ||
| import type { Preview } from "@storybook/nextjs-vite"; | ||
| import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; | ||
| import { StoryBoundary } from "../components/VercelChat/tools/__stories__/StoryBoundary"; | ||
| import "../app/globals.css"; | ||
|
|
||
| /** | ||
| * Per-story wrapper: a fresh QueryClient (so cache never leaks between stories) | ||
| * plus the app's real `.dark` class toggle driven by the toolbar. | ||
| */ | ||
| function StoryWrapper({ | ||
| theme, | ||
| children, | ||
| }: { | ||
| theme: string; | ||
| children: React.ReactNode; | ||
| }) { | ||
| // useState initializer runs once per story mount → isolated cache per story. | ||
| const [queryClient] = useState( | ||
| () => new QueryClient({ defaultOptions: { queries: { retry: false } } }), | ||
| ); | ||
| useEffect(() => { | ||
| const root = document.documentElement; | ||
| root.classList.toggle("dark", theme === "dark"); | ||
| root.style.colorScheme = theme; | ||
| }, [theme]); | ||
| return ( | ||
| <QueryClientProvider client={queryClient}>{children}</QueryClientProvider> | ||
| ); | ||
| } | ||
|
|
||
| const preview: Preview = { | ||
| parameters: { | ||
| layout: "padded", | ||
| controls: { expanded: true }, | ||
| backgrounds: { disable: true }, | ||
| }, | ||
| globalTypes: { | ||
| theme: { | ||
| description: "Color theme", | ||
| defaultValue: "light", | ||
| toolbar: { | ||
| title: "Theme", | ||
| icon: "circlehollow", | ||
| items: [ | ||
| { value: "light", title: "Light", icon: "sun" }, | ||
| { value: "dark", title: "Dark", icon: "moon" }, | ||
| ], | ||
| dynamicTitle: true, | ||
| }, | ||
| }, | ||
| }, | ||
| decorators: [ | ||
| (Story, context) => ( | ||
| <StoryWrapper theme={context.globals.theme}> | ||
| <div className="bg-background p-6 text-foreground"> | ||
| <StoryBoundary label={context.title || "Story"}> | ||
| <Story /> | ||
| </StoryBoundary> | ||
| </div> | ||
| </StoryWrapper> | ||
| ), | ||
| ], | ||
| }; | ||
|
|
||
| export default preview; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { ToolUIPart, getToolOrDynamicToolName, DynamicToolUIPart } from "ai"; | ||
| import GenericToolCard from "./tools/GenericToolCard"; | ||
| import { TOOL_CALL_SKELETONS } from "./toolCallSkeletons"; | ||
|
|
||
| /** | ||
| * Renders the loading state for an in-flight tool call: a bespoke skeleton when | ||
| * the tool has one (see TOOL_CALL_SKELETONS), otherwise the generic tool card, | ||
| * which explains the step in plain English and echoes its input so repeated | ||
| * calls read as distinct, intentional steps (not a frozen loop). | ||
| */ | ||
| export function getToolCallComponent(part: ToolUIPart | DynamicToolUIPart) { | ||
| const { toolCallId } = part; | ||
| const toolName = getToolOrDynamicToolName(part); | ||
| const skeleton = TOOL_CALL_SKELETONS[toolName]; | ||
| if (skeleton) return <div key={toolCallId}>{skeleton}</div>; | ||
| return ( | ||
| <div key={toolCallId}> | ||
| <GenericToolCard | ||
| name={toolName} | ||
| input={(part as { input?: unknown }).input} | ||
| state="loading" | ||
| /> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { ToolUIPart, getToolOrDynamicToolName, DynamicToolUIPart } from "ai"; | ||
| import { ToolError } from "./tools/shared/ToolError"; | ||
|
|
||
| /** | ||
| * Unified error surface for any tool that resolves to `output-error`. | ||
| * Without this, failed tools fell through to the loading skeleton and | ||
| * appeared to hang forever. | ||
| */ | ||
| export function getToolErrorComponent( | ||
| part: ToolUIPart | DynamicToolUIPart, | ||
| onRetry?: () => void, | ||
| ) { | ||
| const { toolCallId } = part; | ||
| const toolName = getToolOrDynamicToolName(part); | ||
| // `errorText` is a runtime-populated field not yet in ToolUIPart's public type. | ||
| const errorText = (part as { errorText?: string }).errorText; | ||
| return ( | ||
| <div key={toolCallId}> | ||
| <ToolError title={toolName} message={errorText} onRetry={onRetry} /> | ||
| </div> | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Global StoryBoundary in preview.tsx masks React render errors across all stories, weakening regression detection in visual tests and manual review.
Prompt for AI agents