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 { EnvironmentId } from "@t3tools/contracts"; |
| 2 | import { T, useGT } from "gt-react"; |
| 3 | import { LayersIcon } from "lucide-react"; |
| 4 | |
| 5 | import { Button } from "../ui/button"; |
| 6 | import { ProjectSettingsPanel } from "./ProjectSettingsPanel"; |
| 7 | import { useSettingsScope } from "./SettingsScopeContext"; |
| 8 | import { SettingsScopeNotice } from "./SettingsScopeNotice"; |
| 9 | import { SettingsPageContainer } from "./settingsLayout"; |
| 10 | import { ALL_ENVIRONMENTS_VALUE, selectEnvironmentAxis } from "./settingsScopeAxis"; |
| 11 | |
| 12 | export function ProjectsSettings() { |
| 13 | const gt = useGT(); |
| 14 | const { search: value, scope, selectScope } = useSettingsScope(); |
| 15 | const unavailable = |
| 16 | scope.kind === "unavailable" ? ( |
| 17 | <SettingsPageContainer> |
| 18 | <div className="flex flex-col items-start gap-3"> |
| 19 | <p className="text-sm text-muted-foreground">{scope.message}</p> |
| 20 | {value.machine || value.checkout ? ( |
| 21 | <Button |
| 22 | variant="outline" |
| 23 | size="xs" |
| 24 | onClick={() => selectScope(selectEnvironmentAxis(value, ALL_ENVIRONMENTS_VALUE))} |
| 25 | > |
| 26 | <LayersIcon /> |
| 27 | <T>Show all environments</T> |
| 28 | </Button> |
| 29 | ) : null} |
| 30 | </div> |
| 31 | </SettingsPageContainer> |
| 32 | ) : null; |
| 33 | // Keep the panel mounted so it can follow members when regrouping changes the project key. |
| 34 | const projectScope = |
| 35 | scope.kind === "project" || |
| 36 | scope.kind === "checkout" || |
| 37 | (scope.kind === "unavailable" && |
| 38 | (scope.reason === "project-missing" || scope.reason === "checkout-missing")); |
| 39 | return ( |
| 40 | <div className="flex min-h-0 flex-1 flex-col"> |
| 41 | {value.project && projectScope ? ( |
| 42 | <ProjectSettingsPanel |
| 43 | projectKey={value.project} |
| 44 | environmentId={value.machine ? EnvironmentId.make(value.machine) : null} |
| 45 | checkoutKey={value.checkout ?? null} |
| 46 | unavailable={unavailable} |
| 47 | /> |
| 48 | ) : unavailable ? ( |
| 49 | unavailable |
| 50 | ) : ( |
| 51 | <SettingsScopeNotice target="project"> |
| 52 | {gt("Choose a project to manage its name, icon, checkouts and actions.")} |
| 53 | </SettingsScopeNotice> |
| 54 | )} |
| 55 | </div> |
| 56 | ); |
| 57 | } |