Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ProjectsSettings.tsx

33 lines1.3 KB

1import { EnvironmentId } from "@t3tools/contracts";
2​
3import { ProjectSettingsPanel } from "./ProjectSettingsPanel";
4import { useSettingsScope } from "./SettingsScopeContext";
5import { SettingsScopeNotice } from "./SettingsScopeNotice";
6​
7/** Project identity and checkout management for the selected project. */
8export function ProjectsSettings() {
9 const { search: value, scope } = useSettingsScope();
10 // The panel follows remembered members when grouping replaces a project key.
11 const projectScope =
12 scope.kind === "project" ||
13 scope.kind === "checkout" ||
14 (scope.kind === "unavailable" &&
15 (scope.reason === "project-missing" || scope.reason === "checkout-missing"));
16 return (
17 <div className="flex min-h-0 flex-1 flex-col">
18 {value.project && projectScope ? (
19 <ProjectSettingsPanel
20 projectKey={value.project}
21 environmentId={value.machine ? EnvironmentId.make(value.machine) : null}
22 checkoutKey={value.checkout ?? null}
23 />
24 ) : scope.kind === "unavailable" ? (
25 <p className="p-8 text-sm text-muted-foreground">{scope.message}</p>
26 ) : (
27 <SettingsScopeNotice target="project">
28 Choose a project to manage its name, icon, checkouts and actions.
29 </SettingsScopeNotice>
30 )}
31 </div>
32 );