From 89b9c4fe6354657e9da4d2afd8ac44458809b1cc Mon Sep 17 00:00:00 2001 From: Mark McLaughlin Date: Thu, 5 Feb 2026 11:17:13 -0800 Subject: [PATCH] refactor: export Card component directly and explicitly define styles for the information variant. --- .../cli/src/ui/components/shared/Card.tsx | 18 +++------- .../shared/__snapshots__/Card.test.tsx.snap | 34 +++++++++---------- 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/packages/cli/src/ui/components/shared/Card.tsx b/packages/cli/src/ui/components/shared/Card.tsx index 73262a2ee5..06face2625 100644 --- a/packages/cli/src/ui/components/shared/Card.tsx +++ b/packages/cli/src/ui/components/shared/Card.tsx @@ -25,7 +25,7 @@ export interface CardProps { variant?: 'information' | 'success' | 'warning' | 'error' | 'confirmation'; } -const CardDisplay: React.FC = ({ +export const Card: React.FC = ({ variant = 'information', title, prefix = true, @@ -42,6 +42,8 @@ const CardDisplay: React.FC = ({ return { border: theme.status.success, text: theme.status.success }; case 'confirmation': return { border: theme.border.focused, text: theme.text.link }; + case 'information': + return { border: theme.border.default, text: theme.text.primary }; default: return { border: theme.border.default, text: theme.text.primary }; } @@ -57,6 +59,8 @@ const CardDisplay: React.FC = ({ return TOOL_STATUS.WARNING; case 'confirmation': return TOOL_STATUS.CONFIRMING; + case 'information': + return TOOL_STATUS.INFORMATION; default: return TOOL_STATUS.INFORMATION; } @@ -127,15 +131,3 @@ const CardDisplay: React.FC = ({ ); }; - -export const Card: React.FC = ({ - title, - prefix, - suffix, - children, - variant, -}) => ( - - {children} - -); diff --git a/packages/cli/src/ui/components/shared/__snapshots__/Card.test.tsx.snap b/packages/cli/src/ui/components/shared/__snapshots__/Card.test.tsx.snap index c8052adae9..85204eb523 100644 --- a/packages/cli/src/ui/components/shared/__snapshots__/Card.test.tsx.snap +++ b/packages/cli/src/ui/components/shared/__snapshots__/Card.test.tsx.snap @@ -1,38 +1,38 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Card > renders a 'confirmation' card with prefix=true 1`] = ` -"╭ ? Shell node -v && which gemini ─────────────────────────────────────────────────────────────────╮ -│ ls /usr/local/bin | grep 'xattr' │ -╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ +"╭ ? Shell node -v && which gemini ─────────────────────────────────────────────────────────────────╮ +│ ls /usr/local/bin | grep 'xattr' │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ " `; exports[`Card > renders a 'error' card with prefix=true 1`] = ` -"╭ x Error 429 You exceeded your current quota ─────────────────────────────────────────────────────╮ -│ Go to https://aistudio.google.com/apikey to upgrade your quota tier, or submit a quota increase │ -│ request in https://ai.google.dev/gemini-api/docs/rate-limits │ -╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ +"╭ x Error 429 You exceeded your current quota ─────────────────────────────────────────────────────╮ +│ Go to https://aistudio.google.com/apikey to upgrade your quota tier, or submit a quota increase │ +│ request in https://ai.google.dev/gemini-api/docs/rate-limits │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ " `; exports[`Card > renders a 'information' card with prefix=true 1`] = ` -"╭ ℹ Delegate to agent Delegating to agent 'cli_help' ──────────────────────────────────────────────╮ -│ 🤖💭 Execution limit reached (ERROR_NO_COMPLETE_TASK_CALL). Attempting one final recovery turn │ -│ with a grace period. │ -╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ +"╭ ℹ Delegate to agent Delegating to agent 'cli_help' ──────────────────────────────────────────────╮ +│ 🤖💭 Execution limit reached (ERROR_NO_COMPLETE_TASK_CALL). Attempting one final recovery turn │ +│ with a grace period. │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ " `; exports[`Card > renders a 'success' card with prefix=true 1`] = ` -"╭ ✓ ReadFolder /usr/local/bin ─────────────────────────────────────────────────────────────────────╮ -│ Listed 39 item(s). │ -╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ +"╭ ✓ ReadFolder /usr/local/bin ─────────────────────────────────────────────────────────────────────╮ +│ Listed 39 item(s). │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ " `; exports[`Card > renders a 'warning' card with prefix=true 1`] = ` -"╭ ⚠ Gemini CLI update available 0.26.0 → 0.27.0 ───────────────────────────────────────────────────╮ -│ Installed via Homebrew. Please update with "brew upgrade gemini-cli". │ -╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ +"╭ ⚠ Gemini CLI update available 0.26.0 → 0.27.0 ───────────────────────────────────────────────────╮ +│ Installed via Homebrew. Please update with "brew upgrade gemini-cli". │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ " `;