The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { T, useMessages } from "gt-react"; |
| 2 | import { |
| 3 | getClientSettings, |
| 4 | updateClientSettings, |
| 5 | useClientSettings, |
| 6 | } from "../../hooks/useSettings"; |
| 7 | import { MenuCheckboxItem, MenuGroup, MenuGroupLabel, MenuItem, MenuSeparator } from "../ui/menu"; |
| 8 | import { |
| 9 | isDefaultThreadDetailsVisibility, |
| 10 | resolveThreadDetailsVisibility, |
| 11 | RESET_THREAD_DETAILS_ITEMS, |
| 12 | setThreadDetailsItem, |
| 13 | THREAD_DETAILS_ITEMS, |
| 14 | } from "./threadDetailsItems"; |
| 15 | |
| 16 | /** Menu body that shows and hides thread details items. The card's context menu and Settings share it. */ |
| 17 | export function ThreadDetailsItemsMenuItems() { |
| 18 | const visibility = useClientSettings(resolveThreadDetailsVisibility); |
| 19 | const m = useMessages(); |
| 20 | return ( |
| 21 | <> |
| 22 | <MenuGroup> |
| 23 | <MenuGroupLabel> |
| 24 | <T>Show in thread details</T> |
| 25 | </MenuGroupLabel> |
| 26 | {THREAD_DETAILS_ITEMS.map((item) => ( |
| 27 | <MenuCheckboxItem |
| 28 | key={item.id} |
| 29 | checked={visibility[item.id]} |
| 30 | onCheckedChange={(checked) => |
| 31 | updateClientSettings({ |
| 32 | threadDetailsItems: setThreadDetailsItem(getClientSettings(), item, checked), |
| 33 | }) |
| 34 | } |
| 35 | > |
| 36 | {m(item.label)} |
| 37 | </MenuCheckboxItem> |
| 38 | ))} |
| 39 | </MenuGroup> |
| 40 | <MenuSeparator /> |
| 41 | <MenuItem |
| 42 | disabled={isDefaultThreadDetailsVisibility(visibility)} |
| 43 | onClick={() => updateClientSettings(RESET_THREAD_DETAILS_ITEMS)} |
| 44 | > |
| 45 | <T>Reset to default</T> |
| 46 | </MenuItem> |
| 47 | </> |
| 48 | ); |
| 49 | } |