Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 5x 42x 42x 42x 20x 22x 5x 43x 43x 42x | import React from "react";
import { ArrowDownToLine, Cog, ShieldCheck, Users } from "lucide-react";
import { TabGroups, TabLinkGroup } from "@/components/page/TabGroups/TabGroups";
import { useWorkspace } from "@/context/WorkspaceContext";
import { APP_ROUTES } from "@/routes/const";
export type WorkspaceSettingsTab = "general" | "policies" | "members" | "inheritance";
const ROUTES = APP_ROUTES.USER.WORKSPACE_SETTINGS;
/** An organisation's or project's settings tabs — the same bar Personal's
* account settings use (`TabGroups`). A project also says what it inherits
* from its parent; an organisation sets the policies its projects work
* under. */
export function workspaceSettingsGroups(
kind: "organisation" | "project",
): TabLinkGroup<WorkspaceSettingsTab>[] {
const general = { key: "general" as const, label: "General", icon: Cog, to: ROUTES.general };
const members = { key: "members" as const, label: "Members", icon: Users, to: ROUTES.members };
if (kind === "organisation") {
return [
{
label: "Organisation",
tabs: [
general,
{ key: "policies", label: "Policies", icon: ShieldCheck, to: ROUTES.policies },
],
},
{ label: "People", tabs: [members] },
];
}
return [
{ label: "Project", tabs: [general] },
{ label: "People", tabs: [members] },
{
label: "Sharing",
tabs: [
{
key: "inheritance",
label: "Inheritance",
icon: ArrowDownToLine,
to: ROUTES.inheritance,
},
],
},
];
}
export const WorkspaceSettingsTabs: React.FC<{ active: WorkspaceSettingsTab }> = ({
active,
}) => {
const { kind } = useWorkspace();
if (kind === "personal") return null;
return <TabGroups groups={workspaceSettingsGroups(kind)} active={active} />;
};
export default WorkspaceSettingsTabs;
|