Skip to content

Commit 8ae8194

Browse files
committed
🤖 fix: match waveform recording color to current mode
- Recording overlay border/background uses mode color (plan=blue, exec=purple) - WaveformBars use bg-plan-mode or bg-exec-mode based on mode - Recording text uses mode-light variant for better contrast - VoiceInputButton receives mode prop for consistent styling - Transcribing state remains amber (processing indicator)
1 parent 8478e5e commit 8ae8194

File tree

2 files changed

+38
-6
lines changed

2 files changed

+38
-6
lines changed

src/browser/components/ChatInput/VoiceInputButton.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { TooltipWrapper, Tooltip } from "../Tooltip";
99
import { formatKeybind, KEYBINDS } from "@/browser/utils/ui/keybinds";
1010
import { cn } from "@/common/lib/utils";
1111
import type { VoiceInputState } from "@/browser/hooks/useVoiceInput";
12+
import type { UIMode } from "@/common/types/mode";
1213

1314
interface VoiceInputButtonProps {
1415
state: VoiceInputState;
@@ -17,11 +18,18 @@ interface VoiceInputButtonProps {
1718
requiresSecureContext: boolean;
1819
onToggle: () => void;
1920
disabled?: boolean;
21+
mode: UIMode;
22+
}
23+
24+
function getRecordingColorClass(mode: UIMode): string {
25+
return mode === "plan"
26+
? "text-plan-mode-light animate-pulse"
27+
: "text-exec-mode-light animate-pulse";
2028
}
2129

2230
const STATE_CONFIG: Record<VoiceInputState, { label: string; colorClass: string }> = {
2331
idle: { label: "Voice input", colorClass: "text-muted/50 hover:text-muted" },
24-
recording: { label: "Stop recording", colorClass: "text-blue-500 animate-pulse" },
32+
recording: { label: "Stop recording", colorClass: "" }, // handled dynamically
2533
transcribing: { label: "Transcribing...", colorClass: "text-amber-500" },
2634
};
2735

@@ -32,14 +40,19 @@ export const VoiceInputButton: React.FC<VoiceInputButtonProps> = (props) => {
3240
const needsApiKey = !needsHttps && !props.isApiKeySet;
3341
const isDisabledReason = needsHttps || needsApiKey;
3442

43+
const stateConfig = STATE_CONFIG[props.state];
3544
const { label, colorClass } = isDisabledReason
3645
? {
3746
label: needsHttps
3847
? "Voice input (requires HTTPS)"
3948
: "Voice input (requires OpenAI API key)",
4049
colorClass: "text-muted/50",
4150
}
42-
: STATE_CONFIG[props.state];
51+
: {
52+
label: stateConfig.label,
53+
colorClass:
54+
props.state === "recording" ? getRecordingColorClass(props.mode) : stateConfig.colorClass,
55+
};
4356

4457
const Icon = props.state === "transcribing" ? Loader2 : Mic;
4558
const isTranscribing = props.state === "transcribing";

src/browser/components/ChatInput/index.tsx

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,26 +1226,44 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
12261226
className={cn(
12271227
"mb-1 flex min-h-[60px] w-full items-center justify-center gap-3 rounded-md border px-4 py-4 transition-all focus:outline-none",
12281228
voiceInput.state === "recording"
1229-
? "cursor-pointer border-blue-500 bg-blue-500/10"
1229+
? mode === "plan"
1230+
? "cursor-pointer border-plan-mode bg-plan-mode/10"
1231+
: "cursor-pointer border-exec-mode bg-exec-mode/10"
12301232
: "cursor-wait border-amber-500 bg-amber-500/10"
12311233
)}
12321234
aria-label={voiceInput.state === "recording" ? "Stop recording" : "Transcribing..."}
12331235
>
12341236
<WaveformBars
1235-
colorClass={voiceInput.state === "recording" ? "bg-blue-500" : "bg-amber-500"}
1237+
colorClass={
1238+
voiceInput.state === "recording"
1239+
? mode === "plan"
1240+
? "bg-plan-mode"
1241+
: "bg-exec-mode"
1242+
: "bg-amber-500"
1243+
}
12361244
/>
12371245
<span
12381246
className={cn(
12391247
"text-sm font-medium",
1240-
voiceInput.state === "recording" ? "text-blue-500" : "text-amber-500"
1248+
voiceInput.state === "recording"
1249+
? mode === "plan"
1250+
? "text-plan-mode-light"
1251+
: "text-exec-mode-light"
1252+
: "text-amber-500"
12411253
)}
12421254
>
12431255
{voiceInput.state === "recording"
12441256
? `Recording... space to send, ${formatKeybind(KEYBINDS.TOGGLE_VOICE_INPUT)} to stop, esc to cancel`
12451257
: "Transcribing..."}
12461258
</span>
12471259
<WaveformBars
1248-
colorClass={voiceInput.state === "recording" ? "bg-blue-500" : "bg-amber-500"}
1260+
colorClass={
1261+
voiceInput.state === "recording"
1262+
? mode === "plan"
1263+
? "bg-plan-mode"
1264+
: "bg-exec-mode"
1265+
: "bg-amber-500"
1266+
}
12491267
mirrored
12501268
/>
12511269
</button>
@@ -1283,6 +1301,7 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
12831301
requiresSecureContext={voiceInput.requiresSecureContext}
12841302
onToggle={voiceInput.toggle}
12851303
disabled={disabled || isSending}
1304+
mode={mode}
12861305
/>
12871306
</div>
12881307
</>

0 commit comments

Comments
 (0)