2024-02-07 03:05:07 +03:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
import { useState } from "react";
|
|
|
|
|
|
|
|
import { AddBrainModal } from "@/lib/components/AddBrainModal";
|
2024-02-15 03:37:33 +03:00
|
|
|
import { useBrainCreationContext } from "@/lib/components/AddBrainModal/brainCreation-provider";
|
2024-02-07 03:05:07 +03:00
|
|
|
import PageHeader from "@/lib/components/PageHeader/PageHeader";
|
|
|
|
import { UploadDocumentModal } from "@/lib/components/UploadDocumentModal/UploadDocumentModal";
|
|
|
|
import { Tabs } from "@/lib/components/ui/Tabs/Tabs";
|
|
|
|
import { useKnowledgeToFeedContext } from "@/lib/context/KnowledgeToFeedProvider/hooks/useKnowledgeToFeedContext";
|
|
|
|
import { ButtonType } from "@/lib/types/QuivrButton";
|
|
|
|
import { Tab } from "@/lib/types/Tab";
|
|
|
|
|
2024-04-10 12:20:21 +03:00
|
|
|
import { Analytics } from "./BrainsTabs/components/Analytics/Analytics";
|
2024-03-04 22:35:34 +03:00
|
|
|
import { ManageBrains } from "./BrainsTabs/components/ManageBrains/ManageBrains";
|
2024-02-07 03:05:07 +03:00
|
|
|
import styles from "./page.module.scss";
|
|
|
|
|
|
|
|
const Studio = (): JSX.Element => {
|
|
|
|
const [selectedTab, setSelectedTab] = useState("Manage my brains");
|
|
|
|
const { setShouldDisplayFeedCard } = useKnowledgeToFeedContext();
|
|
|
|
const { setIsBrainCreationModalOpened } = useBrainCreationContext();
|
|
|
|
|
|
|
|
const studioTabs: Tab[] = [
|
|
|
|
{
|
|
|
|
label: "Manage my brains",
|
|
|
|
isSelected: selectedTab === "Manage my brains",
|
|
|
|
onClick: () => setSelectedTab("Manage my brains"),
|
2024-02-07 08:59:59 +03:00
|
|
|
iconName: "edit",
|
2024-02-07 03:05:07 +03:00
|
|
|
},
|
|
|
|
{
|
2024-04-10 12:20:21 +03:00
|
|
|
label: "Analytics",
|
2024-02-07 03:05:07 +03:00
|
|
|
isSelected: selectedTab === "Analytics",
|
|
|
|
onClick: () => setSelectedTab("Analytics"),
|
2024-02-07 08:59:59 +03:00
|
|
|
iconName: "graph",
|
2024-02-07 03:05:07 +03:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const buttons: ButtonType[] = [
|
|
|
|
{
|
|
|
|
label: "Create brain",
|
|
|
|
color: "primary",
|
|
|
|
onClick: () => {
|
|
|
|
setIsBrainCreationModalOpened(true);
|
|
|
|
},
|
2024-02-07 10:34:50 +03:00
|
|
|
iconName: "brain",
|
2024-02-07 03:05:07 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "Add knowledge",
|
|
|
|
color: "primary",
|
|
|
|
onClick: () => {
|
|
|
|
setShouldDisplayFeedCard(true);
|
|
|
|
},
|
2024-02-11 03:17:05 +03:00
|
|
|
iconName: "uploadFile",
|
2024-02-07 03:05:07 +03:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={styles.page_wrapper}>
|
|
|
|
<div className={styles.page_header}>
|
2024-03-07 22:18:32 +03:00
|
|
|
<PageHeader
|
|
|
|
iconName="brainCircuit"
|
|
|
|
label="Brain Studio"
|
|
|
|
buttons={buttons}
|
|
|
|
/>
|
2024-02-07 03:05:07 +03:00
|
|
|
</div>
|
|
|
|
<div className={styles.content_wrapper}>
|
|
|
|
<Tabs tabList={studioTabs} />
|
|
|
|
{selectedTab === "Manage my brains" && <ManageBrains />}
|
2024-04-10 12:20:21 +03:00
|
|
|
{selectedTab === "Analytics" && <Analytics />}
|
2024-02-07 03:05:07 +03:00
|
|
|
</div>
|
|
|
|
<UploadDocumentModal />
|
|
|
|
<AddBrainModal />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Studio;
|