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, useGT, Var } from "gt-react"; |
| 2 | import { ChevronDownIcon } from "lucide-react"; |
| 3 | |
| 4 | import { updateClientSettings, useClientSettings } from "../../hooks/useSettings"; |
| 5 | import { ThreadDetailsItemsMenuItems } from "../chat/ThreadDetailsItemsMenu"; |
| 6 | import { |
| 7 | isDefaultThreadDetailsVisibility, |
| 8 | resolveThreadDetailsVisibility, |
| 9 | RESET_THREAD_DETAILS_ITEMS, |
| 10 | THREAD_DETAILS_ITEMS, |
| 11 | } from "../chat/threadDetailsItems"; |
| 12 | import { Button } from "../ui/button"; |
| 13 | import { Menu, MenuPopup, MenuTrigger } from "../ui/menu"; |
| 14 | import { SettingResetButton, SettingsRow } from "./settingsLayout"; |
| 15 | import { useSearchableSetting } from "./settingsSearch"; |
| 16 | |
| 17 | export function ThreadDetailsItemsRow() { |
| 18 | const gt = useGT(); |
| 19 | const searchableSetting = useSearchableSetting(); |
| 20 | const visibility = useClientSettings(resolveThreadDetailsVisibility); |
| 21 | const enabled = THREAD_DETAILS_ITEMS.filter((item) => visibility[item.id]).length; |
| 22 | return ( |
| 23 | <SettingsRow |
| 24 | {...searchableSetting("thread-details-items")} |
| 25 | description={gt( |
| 26 | "Choose what the thread details card shows. You can also right-click the card.", |
| 27 | )} |
| 28 | resetAction={ |
| 29 | isDefaultThreadDetailsVisibility(visibility) ? null : ( |
| 30 | <SettingResetButton |
| 31 | ariaLabel={gt("Reset thread details to default")} |
| 32 | onClick={() => updateClientSettings(RESET_THREAD_DETAILS_ITEMS)} |
| 33 | /> |
| 34 | ) |
| 35 | } |
| 36 | control={ |
| 37 | <Menu> |
| 38 | <MenuTrigger |
| 39 | render={ |
| 40 | <Button |
| 41 | variant="outline" |
| 42 | size="sm" |
| 43 | className="w-full justify-between sm:w-40" |
| 44 | aria-label={gt("Thread details: {enabled} of {total} on", { |
| 45 | enabled, |
| 46 | total: THREAD_DETAILS_ITEMS.length, |
| 47 | })} |
| 48 | /> |
| 49 | } |
| 50 | > |
| 51 | <T> |
| 52 | <Var>{enabled}</Var> of <Var>{THREAD_DETAILS_ITEMS.length}</Var> on |
| 53 | </T> |
| 54 | <ChevronDownIcon aria-hidden /> |
| 55 | </MenuTrigger> |
| 56 | <MenuPopup align="end"> |
| 57 | <ThreadDetailsItemsMenuItems /> |
| 58 | </MenuPopup> |
| 59 | </Menu> |
| 60 | } |
| 61 | /> |
| 62 | ); |
| 63 | } |