|
1 | 1 | import { forwardRef, useEffect, useState } from 'react' |
2 | 2 | import { Input } from '@ui/components/editor/common/Input' |
| 3 | +import { Dropdown } from '@ui/components/editor/common/Dropdown' |
3 | 4 | import { Item } from '@ui/components/editor/settings/Item' |
4 | 5 | import { Section } from '@ui/components/editor/settings/Section' |
5 | 6 | import { TextButton } from '@ui/components/editor/settings/TextButton' |
6 | 7 |
|
| 8 | +type ClearChecksBehavior = 'ignore-open-editors' | 'uncheck-all' |
| 9 | + |
| 10 | +const CLEAR_CHECKS_OPTIONS: Dropdown.Option<ClearChecksBehavior>[] = [ |
| 11 | + { value: 'ignore-open-editors', label: 'Ignore Open Editors' }, |
| 12 | + { value: 'uncheck-all', label: 'Uncheck All' } |
| 13 | +] |
| 14 | + |
7 | 15 | type Props = { |
8 | 16 | context_size_warning_threshold: number |
9 | | - clear_checks_in_workspace_behavior: 'ignore-open-editors' | 'uncheck-all' |
| 17 | + clear_checks_in_workspace_behavior: ClearChecksBehavior |
10 | 18 | on_context_size_warning_threshold_change: (threshold: number) => void |
11 | 19 | on_clear_checks_in_workspace_behavior_change: ( |
12 | | - value: 'ignore-open-editors' | 'uncheck-all' |
| 20 | + value: ClearChecksBehavior |
13 | 21 | ) => void |
14 | 22 | on_open_editor_settings: () => void |
15 | 23 | on_stuck_change: (is_stuck: boolean) => void |
@@ -77,17 +85,12 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>( |
77 | 85 | title="Clear Checks in Workspace Behavior" |
78 | 86 | description="Behavior of the 'Clear Checks' command in the Workspace view." |
79 | 87 | slot={ |
80 | | - <select |
| 88 | + <Dropdown |
| 89 | + options={CLEAR_CHECKS_OPTIONS} |
81 | 90 | value={props.clear_checks_in_workspace_behavior} |
82 | | - onChange={(e) => |
83 | | - props.on_clear_checks_in_workspace_behavior_change( |
84 | | - e.target.value as 'ignore-open-editors' | 'uncheck-all' |
85 | | - ) |
86 | | - } |
87 | | - > |
88 | | - <option value="ignore-open-editors">Ignore Open Editors</option> |
89 | | - <option value="uncheck-all">Uncheck All</option> |
90 | | - </select> |
| 91 | + onChange={props.on_clear_checks_in_workspace_behavior_change} |
| 92 | + max_width={320} |
| 93 | + /> |
91 | 94 | } |
92 | 95 | /> |
93 | 96 | </Section> |
|
0 commit comments