Skip to content

Commit 969aa2e

Browse files
committed
Standardize model and effort selectors to use same dropdown pattern
1 parent 1d67617 commit 969aa2e

2 files changed

Lines changed: 49 additions & 28 deletions

File tree

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { SessionConfigOption } from "@agentclientprotocol/sdk";
2-
import { Brain } from "@phosphor-icons/react";
3-
import { Flex, Select, Text } from "@radix-ui/themes";
2+
import { Brain, CaretDown, Check } from "@phosphor-icons/react";
3+
import { Button, DropdownMenu, Flex, Text } from "@radix-ui/themes";
44
import { flattenSelectOptions } from "../stores/sessionStore";
55

66
interface ReasoningLevelSelectorProps {
@@ -10,6 +10,16 @@ interface ReasoningLevelSelectorProps {
1010
disabled?: boolean;
1111
}
1212

13+
const triggerStyle = {
14+
fontSize: "var(--font-size-1)",
15+
color: "var(--gray-11)",
16+
padding: "4px 8px",
17+
height: "auto",
18+
minHeight: "unset",
19+
gap: "6px",
20+
userSelect: "none" as const,
21+
};
22+
1323
export function ReasoningLevelSelector({
1424
thoughtOption,
1525
adapter,
@@ -27,24 +37,9 @@ export function ReasoningLevelSelector({
2737
options.find((opt) => opt.value === activeLevel)?.name ?? activeLevel;
2838

2939
return (
30-
<Select.Root
31-
value={activeLevel}
32-
onValueChange={(value) => onChange?.(value)}
33-
disabled={disabled}
34-
size="1"
35-
>
36-
<Select.Trigger
37-
variant="ghost"
38-
style={{
39-
fontSize: "var(--font-size-1)",
40-
color: "var(--gray-11)",
41-
padding: "4px 8px",
42-
height: "auto",
43-
minHeight: "unset",
44-
gap: "6px",
45-
}}
46-
>
47-
<Flex align="center" gap="1">
40+
<DropdownMenu.Root>
41+
<DropdownMenu.Trigger disabled={disabled}>
42+
<Button variant="ghost" color="gray" size="1" style={triggerStyle}>
4843
<Brain
4944
size={14}
5045
weight="regular"
@@ -53,15 +48,34 @@ export function ReasoningLevelSelector({
5348
<Text size="1">
5449
{adapter === "codex" ? "Reasoning" : "Effort"}: {activeLabel}
5550
</Text>
56-
</Flex>
57-
</Select.Trigger>
58-
<Select.Content position="popper" sideOffset={4}>
51+
<CaretDown
52+
size={10}
53+
weight="bold"
54+
style={{ color: "var(--gray-9)", flexShrink: 0 }}
55+
/>
56+
</Button>
57+
</DropdownMenu.Trigger>
58+
59+
<DropdownMenu.Content align="start" sideOffset={4} size="1">
5960
{options.map((level) => (
60-
<Select.Item key={level.value} value={level.value}>
61-
{level.name}
62-
</Select.Item>
61+
<DropdownMenu.Item
62+
key={level.value}
63+
onSelect={() => onChange?.(level.value)}
64+
>
65+
<Flex align="center" gap="2" style={{ minWidth: "100px" }}>
66+
<Check
67+
size={12}
68+
weight="bold"
69+
style={{
70+
flexShrink: 0,
71+
opacity: level.value === activeLevel ? 1 : 0,
72+
}}
73+
/>
74+
<Text size="1">{level.name}</Text>
75+
</Flex>
76+
</DropdownMenu.Item>
6377
))}
64-
</Select.Content>
65-
</Select.Root>
78+
</DropdownMenu.Content>
79+
</DropdownMenu.Root>
6680
);
6781
}

apps/code/src/renderer/features/sessions/components/UnifiedModelSelector.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {
55
import type { AgentAdapter } from "@features/settings/stores/settingsStore";
66
import {
77
ArrowsClockwise,
8+
CaretDown,
89
Check,
910
Cpu,
1011
Robot,
@@ -74,6 +75,7 @@ export function UnifiedModelSelector({
7475
height: "auto",
7576
minHeight: "unset",
7677
gap: "6px",
78+
userSelect: "none" as const,
7779
};
7880

7981
if (isConnecting) {
@@ -122,6 +124,11 @@ export function UnifiedModelSelector({
122124
{ADAPTER_ICONS[adapter]}
123125
</Flex>
124126
<Text size="1">{currentLabel ?? "Model"}</Text>
127+
<CaretDown
128+
size={10}
129+
weight="bold"
130+
style={{ color: "var(--gray-9)", flexShrink: 0 }}
131+
/>
125132
</Button>
126133
</DropdownMenu.Trigger>
127134

0 commit comments

Comments
 (0)