|
1 | 1 | import { useAuthStore } from "@features/auth/stores/authStore"; |
2 | 2 | import { FolderPicker } from "@features/folder-picker/components/FolderPicker"; |
3 | | -import { useSettingsStore } from "@features/settings/stores/settingsStore"; |
| 3 | +import { |
| 4 | + type SendMessagesWith, |
| 5 | + useSettingsStore, |
| 6 | +} from "@features/settings/stores/settingsStore"; |
4 | 7 | import { useMeQuery } from "@hooks/useMeQuery"; |
5 | 8 | import { useProjectQuery } from "@hooks/useProjectQuery"; |
6 | 9 | import { useSetHeaderContent } from "@hooks/useSetHeaderContent"; |
@@ -56,10 +59,14 @@ export function SettingsView() { |
56 | 59 | createPR, |
57 | 60 | cursorGlow, |
58 | 61 | desktopNotifications, |
| 62 | + autoConvertLongText, |
| 63 | + sendMessagesWith, |
59 | 64 | setAutoRunTasks, |
60 | 65 | setCreatePR, |
61 | 66 | setCursorGlow, |
62 | 67 | setDesktopNotifications, |
| 68 | + setAutoConvertLongText, |
| 69 | + setSendMessagesWith, |
63 | 70 | } = useSettingsStore(); |
64 | 71 | const terminalLayoutMode = useTerminalLayoutStore( |
65 | 72 | (state) => state.terminalLayoutMode, |
@@ -160,6 +167,30 @@ export function SettingsView() { |
160 | 167 | [terminalLayoutMode, setTerminalLayout], |
161 | 168 | ); |
162 | 169 |
|
| 170 | + const handleAutoConvertLongTextChange = useCallback( |
| 171 | + (checked: boolean) => { |
| 172 | + track(ANALYTICS_EVENTS.SETTING_CHANGED, { |
| 173 | + setting_name: "auto_convert_long_text", |
| 174 | + new_value: checked, |
| 175 | + old_value: autoConvertLongText, |
| 176 | + }); |
| 177 | + setAutoConvertLongText(checked); |
| 178 | + }, |
| 179 | + [autoConvertLongText, setAutoConvertLongText], |
| 180 | + ); |
| 181 | + |
| 182 | + const handleSendMessagesWithChange = useCallback( |
| 183 | + (value: SendMessagesWith) => { |
| 184 | + track(ANALYTICS_EVENTS.SETTING_CHANGED, { |
| 185 | + setting_name: "send_messages_with", |
| 186 | + new_value: value, |
| 187 | + old_value: sendMessagesWith, |
| 188 | + }); |
| 189 | + setSendMessagesWith(value); |
| 190 | + }, |
| 191 | + [sendMessagesWith, setSendMessagesWith], |
| 192 | + ); |
| 193 | + |
163 | 194 | const handleWorktreeLocationChange = async (newLocation: string) => { |
164 | 195 | setLocalWorktreeLocation(newLocation); |
165 | 196 | try { |
@@ -341,20 +372,48 @@ export function SettingsView() { |
341 | 372 | <Flex direction="column" gap="3"> |
342 | 373 | <Heading size="3">Chat</Heading> |
343 | 374 | <Card> |
344 | | - <Flex align="center" justify="between"> |
345 | | - <Flex direction="column" gap="1"> |
346 | | - <Text size="1" weight="medium"> |
347 | | - Desktop notifications |
348 | | - </Text> |
349 | | - <Text size="1" color="gray"> |
350 | | - Show notifications when the agent finishes working on a task |
351 | | - </Text> |
| 375 | + <Flex direction="column" gap="4"> |
| 376 | + <Flex align="center" justify="between"> |
| 377 | + <Flex direction="column" gap="1"> |
| 378 | + <Text size="1" weight="medium"> |
| 379 | + Desktop notifications |
| 380 | + </Text> |
| 381 | + <Text size="1" color="gray"> |
| 382 | + Show notifications when the agent finishes working on a |
| 383 | + task |
| 384 | + </Text> |
| 385 | + </Flex> |
| 386 | + <Switch |
| 387 | + checked={desktopNotifications} |
| 388 | + onCheckedChange={setDesktopNotifications} |
| 389 | + size="1" |
| 390 | + /> |
| 391 | + </Flex> |
| 392 | + |
| 393 | + <Flex align="center" justify="between"> |
| 394 | + <Flex direction="column" gap="1"> |
| 395 | + <Text size="1" weight="medium"> |
| 396 | + Send messages with |
| 397 | + </Text> |
| 398 | + <Text size="1" color="gray"> |
| 399 | + Choose which key combination sends messages. Use |
| 400 | + Shift+Enter for new lines. |
| 401 | + </Text> |
| 402 | + </Flex> |
| 403 | + <Select.Root |
| 404 | + value={sendMessagesWith} |
| 405 | + onValueChange={(value) => |
| 406 | + handleSendMessagesWithChange(value as SendMessagesWith) |
| 407 | + } |
| 408 | + size="1" |
| 409 | + > |
| 410 | + <Select.Trigger /> |
| 411 | + <Select.Content> |
| 412 | + <Select.Item value="enter">Enter</Select.Item> |
| 413 | + <Select.Item value="cmd+enter">⌘ Enter</Select.Item> |
| 414 | + </Select.Content> |
| 415 | + </Select.Root> |
352 | 416 | </Flex> |
353 | | - <Switch |
354 | | - checked={desktopNotifications} |
355 | | - onCheckedChange={setDesktopNotifications} |
356 | | - size="1" |
357 | | - /> |
358 | 417 | </Flex> |
359 | 418 | </Card> |
360 | 419 | </Flex> |
|
0 commit comments