Skip to content

Commit b7aa9a6

Browse files
authored
🤖 refactor: align tailwind dark theme utilities (#628)
## Summary - migrate globals.css to Tailwind v4 theming with new dark surface tokens and utilities - replace inline plan/assistant chip styling across tool calls, AI view, markdown, and token breakdown - point PTY service types at @homebridge/node-pty-prebuilt-multiarch to unblock typecheck ## Testing - make typecheck _Generated with _
1 parent 13c3c91 commit b7aa9a6

File tree

6 files changed

+324
-352
lines changed

6 files changed

+324
-352
lines changed

src/browser/components/AIView.tsx

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -416,14 +416,7 @@ const AIViewInner: React.FC<AIViewProps> = ({
416416
/>
417417
</div>
418418
{isAtCutoff && (
419-
<div
420-
className="text-edit-mode bg-edit-mode/10 my-5 px-[15px] py-3 text-center text-xs font-medium"
421-
style={{
422-
borderBottom: "3px solid",
423-
borderImage:
424-
"repeating-linear-gradient(45deg, var(--color-editing-mode), var(--color-editing-mode) 10px, transparent 10px, transparent 20px) 1",
425-
}}
426-
>
419+
<div className="edit-cutoff-divider text-edit-mode bg-edit-mode/10 my-5 px-[15px] py-3 text-center text-xs font-medium">
427420
⚠️ Messages below this line will be removed when you submit the edit
428421
</div>
429422
)}
@@ -470,21 +463,7 @@ const AIViewInner: React.FC<AIViewProps> = ({
470463
<button
471464
onClick={jumpToBottom}
472465
type="button"
473-
className="font-primary absolute bottom-2 left-1/2 z-[100] -translate-x-1/2 cursor-pointer rounded-[20px] border px-2 py-1 text-xs font-medium text-white shadow-[0_4px_12px_rgba(0,0,0,0.3)] backdrop-blur-[1px] transition-all duration-200 hover:scale-105 active:scale-95"
474-
style={{
475-
background: "hsl(from var(--color-assistant-border) h s l / 0.1)",
476-
borderColor: "hsl(from var(--color-assistant-border) h s l / 0.4)",
477-
}}
478-
onMouseEnter={(e) => {
479-
const target = e.currentTarget;
480-
target.style.background = "hsl(from var(--color-assistant-border) h s l / 0.4)";
481-
target.style.borderColor = "hsl(from var(--color-assistant-border) h s l / 0.6)";
482-
}}
483-
onMouseLeave={(e) => {
484-
const target = e.currentTarget;
485-
target.style.background = "hsl(from var(--color-assistant-border) h s l / 0.1)";
486-
target.style.borderColor = "hsl(from var(--color-assistant-border) h s l / 0.4)";
487-
}}
466+
className="assistant-chip font-primary text-foreground hover:assistant-chip-hover absolute bottom-2 left-1/2 z-[100] -translate-x-1/2 cursor-pointer rounded-[20px] px-2 py-1 text-xs font-medium shadow-[0_4px_12px_rgba(0,0,0,0.3)] backdrop-blur-[1px] transition-all duration-200 hover:scale-105 active:scale-95"
488467
>
489468
Press {formatKeybind(KEYBINDS.JUMP_TO_BOTTOM)} to jump to bottom
490469
</button>

src/browser/components/Messages/MarkdownComponents.tsx

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -149,29 +149,14 @@ export const markdownComponents = {
149149
details: ({ children, open }: DetailsProps) => (
150150
<details
151151
open={open}
152-
style={{
153-
margin: "0.5em 0",
154-
padding: "0.25em 0.5em",
155-
border: "1px solid rgba(255, 255, 255, 0.1)",
156-
borderRadius: "4px",
157-
background: "var(--color-code-bg)",
158-
}}
152+
className="bg-code-bg my-2 rounded border border-white/10 px-2 py-1 text-sm"
159153
>
160154
{children}
161155
</details>
162156
),
163157

164158
summary: ({ children }: SummaryProps) => (
165-
<summary
166-
style={{
167-
cursor: "pointer",
168-
fontWeight: 600,
169-
padding: "0.25em 0",
170-
userSelect: "none",
171-
}}
172-
>
173-
<span style={{ marginLeft: "0.35em" }}>{children}</span>
174-
</summary>
159+
<summary className="cursor-pointer py-1 pl-1 font-semibold select-none">{children}</summary>
175160
),
176161

177162
// Custom code block renderer with async Shiki highlighting

src/browser/components/RightSidebar/ConsumerBreakdown.tsx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,27 +60,18 @@ const ConsumerBreakdownComponent: React.FC<ConsumerBreakdownProps> = ({ consumer
6060
{consumer.fixedTokens && consumer.variableTokens ? (
6161
<>
6262
<div
63-
className="h-full transition-[width] duration-300"
64-
style={{
65-
width: `${fixedPercentage}%`,
66-
background: "var(--color-token-fixed)",
67-
}}
63+
className="bg-token-fixed h-full transition-[width] duration-300"
64+
style={{ width: `${fixedPercentage}%` }}
6865
/>
6966
<div
70-
className="h-full transition-[width] duration-300"
71-
style={{
72-
width: `${variablePercentage}%`,
73-
background: "var(--color-token-variable)",
74-
}}
67+
className="bg-token-variable h-full transition-[width] duration-300"
68+
style={{ width: `${variablePercentage}%` }}
7569
/>
7670
</>
7771
) : (
7872
<div
79-
className="h-full transition-[width] duration-300"
80-
style={{
81-
width: `${consumer.percentage}%`,
82-
background: "linear-gradient(90deg, #4a9eff 0%, #6b5ce7 100%)",
83-
}}
73+
className="h-full bg-[linear-gradient(90deg,var(--color-token-input)_0%,var(--color-token-output)_100%)] transition-[width] duration-300"
74+
style={{ width: `${consumer.percentage}%` }}
8475
/>
8576
)}
8677
</div>

src/browser/components/tools/BashToolCall.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
LoadingDots,
1414
} from "./shared/ToolPrimitives";
1515
import { useToolExpansion, getStatusDisplay, type ToolStatus } from "./shared/toolUtils";
16+
import { cn } from "@/common/lib/utils";
1617
import { TooltipWrapper, Tooltip } from "../Tooltip";
1718

1819
interface BashToolCallProps {
@@ -69,22 +70,21 @@ export const BashToolCall: React.FC<BashToolCallProps> = ({
6970
</TooltipWrapper>
7071
<span className="text-text font-monospace max-w-96 truncate">{args.script}</span>
7172
<span
72-
className="ml-2 text-[10px] whitespace-nowrap [@container(max-width:500px)]:hidden"
73-
style={{
74-
color: isPending ? "var(--color-pending)" : "var(--color-text-secondary)",
75-
}}
73+
className={cn(
74+
"ml-2 text-[10px] whitespace-nowrap [@container(max-width:500px)]:hidden",
75+
isPending ? "text-pending" : "text-text-secondary"
76+
)}
7677
>
7778
timeout: {args.timeout_secs ?? BASH_DEFAULT_TIMEOUT_SECS}s
7879
{result && ` • took ${formatDuration(result.wall_duration_ms)}`}
7980
{!result && isPending && elapsedTime > 0 && ` • ${formatDuration(elapsedTime)}`}
8081
</span>
8182
{result && (
8283
<span
83-
className="ml-2 inline-block shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium whitespace-nowrap"
84-
style={{
85-
background: result.exitCode === 0 ? "#4caf50" : "#f44336",
86-
color: "white",
87-
}}
84+
className={cn(
85+
"ml-2 inline-block shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium whitespace-nowrap",
86+
result.exitCode === 0 ? "bg-success text-on-success" : "bg-danger text-on-danger"
87+
)}
8888
>
8989
{result.exitCode}
9090
</span>

src/browser/components/tools/ProposePlanToolCall.tsx

Lines changed: 20 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ export const ProposePlanToolCall: React.FC<ProposePlanToolCallProps> = ({
5151

5252
const [isHovered, setIsHovered] = useState(false);
5353

54+
const controlButtonClasses =
55+
"px-2 py-1 text-[10px] font-mono rounded-sm cursor-pointer transition-all duration-150 active:translate-y-px";
5456
const statusDisplay = getStatusDisplay(status);
5557

5658
return (
@@ -63,21 +65,8 @@ export const ProposePlanToolCall: React.FC<ProposePlanToolCallProps> = ({
6365

6466
{expanded && (
6567
<ToolDetails>
66-
<div
67-
className="rounded-md p-3 shadow-md"
68-
style={{
69-
background:
70-
"linear-gradient(135deg, color-mix(in srgb, var(--color-plan-mode), transparent 92%) 0%, color-mix(in srgb, var(--color-plan-mode), transparent 95%) 100%)",
71-
border: "1px solid color-mix(in srgb, var(--color-plan-mode), transparent 70%)",
72-
}}
73-
>
74-
<div
75-
className="mb-3 flex items-center gap-2 pb-2"
76-
style={{
77-
borderBottom:
78-
"1px solid color-mix(in srgb, var(--color-plan-mode), transparent 80%)",
79-
}}
80-
>
68+
<div className="plan-surface rounded-md p-3 shadow-md">
69+
<div className="plan-divider mb-3 flex items-center gap-2 border-b pb-2">
8170
<div className="flex flex-1 items-center gap-2">
8271
<div className="text-base">📋</div>
8372
<div className="text-plan-mode font-mono text-[13px] font-semibold">
@@ -91,34 +80,18 @@ export const ProposePlanToolCall: React.FC<ProposePlanToolCallProps> = ({
9180
onClick={openModal}
9281
disabled={startHereDisabled}
9382
className={cn(
94-
"px-2 py-1 text-[10px] font-mono rounded-sm cursor-pointer transition-all duration-150",
95-
"active:translate-y-px",
96-
startHereDisabled ? "opacity-50 cursor-not-allowed" : "hover:text-plan-mode"
83+
controlButtonClasses,
84+
"plan-chip",
85+
startHereDisabled
86+
? "cursor-not-allowed opacity-50"
87+
: "hover:plan-chip-hover active:plan-chip-active"
9788
)}
98-
style={{
99-
color: "var(--color-plan-mode)",
100-
background: "color-mix(in srgb, var(--color-plan-mode), transparent 90%)",
101-
border:
102-
"1px solid color-mix(in srgb, var(--color-plan-mode), transparent 70%)",
103-
}}
104-
onMouseEnter={(e) => {
89+
onMouseEnter={() => {
10590
if (!startHereDisabled) {
10691
setIsHovered(true);
107-
(e.currentTarget as HTMLButtonElement).style.background =
108-
"color-mix(in srgb, var(--color-plan-mode), transparent 85%)";
109-
(e.currentTarget as HTMLButtonElement).style.borderColor =
110-
"color-mix(in srgb, var(--color-plan-mode), transparent 60%)";
111-
}
112-
}}
113-
onMouseLeave={(e) => {
114-
setIsHovered(false);
115-
if (!startHereDisabled) {
116-
(e.currentTarget as HTMLButtonElement).style.background =
117-
"color-mix(in srgb, var(--color-plan-mode), transparent 90%)";
118-
(e.currentTarget as HTMLButtonElement).style.borderColor =
119-
"color-mix(in srgb, var(--color-plan-mode), transparent 70%)";
12092
}
12193
}}
94+
onMouseLeave={() => setIsHovered(false)}
12295
>
12396
{isHovered && <span className="mr-1">{buttonEmoji}</span>}
12497
{buttonLabel}
@@ -128,52 +101,21 @@ export const ProposePlanToolCall: React.FC<ProposePlanToolCallProps> = ({
128101
)}
129102
<button
130103
onClick={() => void copyToClipboard(args.plan)}
131-
className="text-muted hover:text-plan-mode cursor-pointer rounded-sm bg-transparent px-2 py-1 font-mono text-[10px] transition-all duration-150 active:translate-y-px"
132-
style={{
133-
border: "1px solid rgba(136, 136, 136, 0.3)",
134-
}}
135-
onMouseEnter={(e) => {
136-
(e.currentTarget as HTMLButtonElement).style.background =
137-
"color-mix(in srgb, var(--color-plan-mode), transparent 85%)";
138-
(e.currentTarget as HTMLButtonElement).style.borderColor =
139-
"color-mix(in srgb, var(--color-plan-mode), transparent 60%)";
140-
}}
141-
onMouseLeave={(e) => {
142-
(e.currentTarget as HTMLButtonElement).style.background = "transparent";
143-
(e.currentTarget as HTMLButtonElement).style.borderColor =
144-
"rgba(136, 136, 136, 0.3)";
145-
}}
104+
className={cn(
105+
controlButtonClasses,
106+
"plan-chip-ghost hover:plan-chip-ghost-hover"
107+
)}
146108
>
147109
{copied ? "✓ Copied" : "Copy"}
148110
</button>
149111
<button
150112
onClick={() => setShowRaw(!showRaw)}
151113
className={cn(
152-
"px-2 py-1 text-[10px] font-mono rounded-sm cursor-pointer transition-all duration-150 active:translate-y-px hover:text-plan-mode"
114+
controlButtonClasses,
115+
showRaw
116+
? "plan-chip hover:plan-chip-hover active:plan-chip-active"
117+
: "plan-chip-ghost text-muted hover:plan-chip-ghost-hover"
153118
)}
154-
style={{
155-
color: showRaw ? "var(--color-plan-mode)" : "#888",
156-
background: showRaw
157-
? "color-mix(in srgb, var(--color-plan-mode), transparent 90%)"
158-
: "transparent",
159-
border: showRaw
160-
? "1px solid color-mix(in srgb, var(--color-plan-mode), transparent 70%)"
161-
: "1px solid rgba(136, 136, 136, 0.3)",
162-
}}
163-
onMouseEnter={(e) => {
164-
(e.currentTarget as HTMLButtonElement).style.background =
165-
"color-mix(in srgb, var(--color-plan-mode), transparent 85%)";
166-
(e.currentTarget as HTMLButtonElement).style.borderColor =
167-
"color-mix(in srgb, var(--color-plan-mode), transparent 60%)";
168-
}}
169-
onMouseLeave={(e) => {
170-
(e.currentTarget as HTMLButtonElement).style.background = showRaw
171-
? "color-mix(in srgb, var(--color-plan-mode), transparent 90%)"
172-
: "transparent";
173-
(e.currentTarget as HTMLButtonElement).style.borderColor = showRaw
174-
? "color-mix(in srgb, var(--color-plan-mode), transparent 70%)"
175-
: "rgba(136, 136, 136, 0.3)";
176-
}}
177119
>
178120
{showRaw ? "Show Markdown" : "Show Text"}
179121
</button>
@@ -191,13 +133,7 @@ export const ProposePlanToolCall: React.FC<ProposePlanToolCallProps> = ({
191133
)}
192134

193135
{status === "completed" && (
194-
<div
195-
className="text-muted mt-3 pt-3 text-[11px] leading-normal italic"
196-
style={{
197-
borderTop:
198-
"1px solid color-mix(in srgb, var(--color-plan-mode), transparent 80%)",
199-
}}
200-
>
136+
<div className="plan-divider text-muted mt-3 border-t pt-3 text-[11px] leading-normal italic">
201137
Respond with revisions or switch to Exec mode (
202138
<span className="font-primary not-italic">
203139
{formatKeybind(KEYBINDS.TOGGLE_MODE)}

0 commit comments

Comments
 (0)