quivr/frontend/app/brains-management/[brainId]/components/BrainManagementTabs/BrainManagementTabs.tsx

56 lines
1.8 KiB
TypeScript
Raw Normal View History

2023-07-25 10:54:34 +03:00
import { Content, List, Root } from "@radix-ui/react-tabs";
import { useTranslation } from "react-i18next";
2023-07-25 10:54:34 +03:00
import { BrainTabTrigger, PeopleTab } from "./components";
import { SettingsTab } from "./components/SettingsTab/SettingsTab";
2023-07-25 10:54:34 +03:00
import { useBrainManagementTabs } from "./hooks/useBrainManagementTabs";
export const BrainManagementTabs = (): JSX.Element => {
const { t } = useTranslation(["translation", "config"]);
const { selectedTab, setSelectedTab, brainId } = useBrainManagementTabs();
if (brainId === undefined) {
return <div />;
}
2023-07-25 10:54:34 +03:00
return (
<Root
className="shadow-md min-h-[50%] dark:shadow-primary/25 hover:shadow-xl transition-shadow rounded-xl overflow-hidden bg-white dark:bg-black border border-black/10 dark:border-white/25 p-4 pt-10"
2023-07-25 10:54:34 +03:00
defaultValue="settings"
>
<List className="flex justify-between" aria-label={t("subtitle", { ns: "config" })}>
2023-07-25 10:54:34 +03:00
<BrainTabTrigger
selected={selectedTab === "settings"}
label={t("settings", { ns: "config" })}
2023-07-25 10:54:34 +03:00
value="settings"
onChange={setSelectedTab}
/>
<BrainTabTrigger
selected={selectedTab === "people"}
label={t("people", { ns: "config" })}
2023-07-25 10:54:34 +03:00
value="people"
onChange={setSelectedTab}
/>
<BrainTabTrigger
selected={selectedTab === "knowledge"}
label={t("knowledge", { ns: "config" })}
2023-07-25 10:54:34 +03:00
value="knowledge"
onChange={setSelectedTab}
/>
</List>
<div className="p-20 pt-5">
<Content value="settings">
<SettingsTab brainId={brainId} />
</Content>
<Content value="people">
<PeopleTab brainId={brainId} />
</Content>
<Content value="knowledge">
<p>{t("comingSoon")}</p>
</Content>
</div>
2023-07-25 10:54:34 +03:00
</Root>
);
};