/* eslint-disable max-lines */ import { Content, List, Root } from "@radix-ui/react-tabs"; import { useTranslation } from "react-i18next"; import Button from "@/lib/components/ui/Button"; import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext"; import { BrainTabTrigger, KnowledgeTab, PeopleTab } from "./components"; import ConfirmationDeleteModal from "./components/Modals/ConfirmationDeleteModal"; import { SettingsTab } from "./components/SettingsTab/SettingsTab"; import { useBrainManagementTabs } from "./hooks/useBrainManagementTabs"; import { isUserBrainOwner } from "./utils/isUserBrainOwner"; export const BrainManagementTabs = (): JSX.Element => { const { t } = useTranslation(["translation", "config", "delete_brain"]); const { selectedTab, setSelectedTab, brainId, handleDeleteBrain, isDeleteModalOpen, setIsDeleteModalOpen, brain, } = useBrainManagementTabs(); const { allBrains } = useBrainContext(); if (brainId === undefined) { return
; } const isCurrentUserBrainOwner = isUserBrainOwner({ brainId, userAccessibleBrains: allBrains, }); const isPublicBrain = brain?.status === "public"; const hasEditRights = !isPublicBrain || isCurrentUserBrainOwner; return ( {hasEditRights && ( <> )}
); };