Skip to content

Commit cdbc969

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 8b4dd97 commit cdbc969

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
@@ -1040,26 +1040,44 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
10401040
className={cn(
10411041
"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",
10421042
voiceInput.state === "recording"
1043-
? "cursor-pointer border-blue-500 bg-blue-500/10"
1043+
? mode === "plan"
1044+
? "cursor-pointer border-plan-mode bg-plan-mode/10"
1045+
: "cursor-pointer border-exec-mode bg-exec-mode/10"
10441046
: "cursor-wait border-amber-500 bg-amber-500/10"
10451047
)}
10461048
aria-label={voiceInput.state === "recording" ? "Stop recording" : "Transcribing..."}
10471049
>
10481050
<WaveformBars
1049-
colorClass={voiceInput.state === "recording" ? "bg-blue-500" : "bg-amber-500"}
1051+
colorClass={
1052+
voiceInput.state === "recording"
1053+
? mode === "plan"
1054+
? "bg-plan-mode"
1055+
: "bg-exec-mode"
1056+
: "bg-amber-500"
1057+
}
10501058
/>
10511059
<span
10521060
className={cn(
10531061
"text-sm font-medium",
1054-
voiceInput.state === "recording" ? "text-blue-500" : "text-amber-500"
1062+
voiceInput.state === "recording"
1063+
? mode === "plan"
1064+
? "text-plan-mode-light"
1065+
: "text-exec-mode-light"
1066+
: "text-amber-500"
10551067
)}
10561068
>
10571069
{voiceInput.state === "recording"
10581070
? `Recording... space to send, ${formatKeybind(KEYBINDS.TOGGLE_VOICE_INPUT)} to stop, esc to cancel`
10591071
: "Transcribing..."}
10601072
</span>
10611073
<WaveformBars
1062-
colorClass={voiceInput.state === "recording" ? "bg-blue-500" : "bg-amber-500"}
1074+
colorClass={
1075+
voiceInput.state === "recording"
1076+
? mode === "plan"
1077+
? "bg-plan-mode"
1078+
: "bg-exec-mode"
1079+
: "bg-amber-500"
1080+
}
10631081
mirrored
10641082
/>
10651083
</button>
@@ -1097,6 +1115,7 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
10971115
requiresSecureContext={voiceInput.requiresSecureContext}
10981116
onToggle={voiceInput.toggle}
10991117
disabled={disabled || isSending}
1118+
mode={mode}
11001119
/>
11011120
</div>
11021121
</>

0 commit comments

Comments
 (0)