Skip to content

Commit f289f0c

Browse files
committed
feat: Relocate the 'plan mode' toggle from AccessModePopover to Composer as a checkbox.
1 parent 7dc3a07 commit f289f0c

2 files changed

Lines changed: 16 additions & 14 deletions

File tree

src/components/codex/Composer.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import {
1515
SelectTrigger,
1616
SelectValue,
1717
} from '@/components/ui/select';
18-
import { Monitor, Settings, Split } from 'lucide-react';
18+
import { Checkbox } from '@/components/ui/checkbox';
19+
import { ListChecks, Monitor, Settings, Split } from 'lucide-react';
1920
import { useLayoutStore } from '@/stores';
2021
import { useConfigStore, type ThreadCwdMode } from '@/stores/codex';
2122

@@ -38,7 +39,8 @@ export function Composer({
3839
}: ComposerProps) {
3940
const [images, setImages] = useState<string[]>([]);
4041
const { isConfigLess, setIsConfigLess } = useLayoutStore();
41-
const { threadCwdMode, setThreadCwdMode } = useConfigStore();
42+
const { threadCwdMode, setThreadCwdMode, collaborationMode, setCollaborationMode } =
43+
useConfigStore();
4244

4345
const handleSend = async (message: string) => {
4446
await onSend(message, images);
@@ -75,7 +77,6 @@ export function Composer({
7577
<SkillsPopover />
7678
</>
7779
)}
78-
<AccessModePopover />
7980
<ModelReasonSelector />
8081
</InputArea>
8182

@@ -102,6 +103,17 @@ export function Composer({
102103
</SelectItem>
103104
</SelectContent>
104105
</Select>
106+
<label className="mr-1 inline-flex cursor-pointer items-center gap-2 rounded-md px-2 py-1 text-xs hover:bg-accent/60">
107+
<Checkbox
108+
checked={collaborationMode === 'plan'}
109+
onCheckedChange={(checked) =>
110+
setCollaborationMode(checked === true ? 'plan' : 'default')
111+
}
112+
/>
113+
<ListChecks className="h-3.5 w-3.5 text-muted-foreground" />
114+
<span>Plan</span>
115+
</label>
116+
<AccessModePopover />
105117
</div>
106118
</div>
107119
);

src/components/codex/selector/AccessModePopover.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { useState } from 'react';
33
import type { SandboxMode } from '@/bindings/v2';
44
import { Button } from '@/components/ui/button';
55
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
6-
import { Switch } from '@/components/ui/switch';
76
import { useConfigStore } from '@/stores/codex';
87
import { cn } from '@/lib/utils';
98

@@ -19,7 +18,7 @@ const ACCESS_MODE_OPTIONS: Array<{
1918

2019
export function AccessModePopover() {
2120
const [open, setOpen] = useState(false);
22-
const { sandbox, setAccessMode, collaborationMode, setCollaborationMode } = useConfigStore();
21+
const { sandbox, setAccessMode } = useConfigStore();
2322
const selected =
2423
ACCESS_MODE_OPTIONS.find((item) => item.sandbox === sandbox) ?? ACCESS_MODE_OPTIONS[0];
2524

@@ -33,15 +32,6 @@ export function AccessModePopover() {
3332
</PopoverTrigger>
3433
<PopoverContent className="w-72 p-1" align="start">
3534
<div className="space-y-1">
36-
<div className="flex items-center justify-between rounded-md px-2 py-1.5">
37-
<span className="text-xs font-medium">plan mode</span>
38-
<Switch
39-
checked={collaborationMode === 'plan'}
40-
onCheckedChange={(checked) => {
41-
setCollaborationMode(checked ? 'plan' : 'default');
42-
}}
43-
/>
44-
</div>
4535
{ACCESS_MODE_OPTIONS.map((item) => {
4636
const Icon = item.icon;
4737
const isActive = item.sandbox === sandbox;

0 commit comments

Comments
 (0)