mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-15 01:21:48 +03:00
feat(frontend): back button (#2876)
# Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate):
This commit is contained in:
parent
532547b905
commit
8f3988b8d9
@ -0,0 +1,21 @@
|
|||||||
|
@use "styles/Spacings.module.scss";
|
||||||
|
|
||||||
|
.loader {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header_wrapper {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
margin-left: -(Spacings.$spacing05 + Spacings.$spacing03);
|
||||||
|
gap: Spacings.$spacing03;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.tabs {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,14 @@
|
|||||||
/* eslint-disable max-lines */
|
/* eslint-disable max-lines */
|
||||||
|
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
import Spinner from "@/lib/components/ui/Spinner";
|
import Icon from "@/lib/components/ui/Icon/Icon";
|
||||||
|
import { LoaderIcon } from "@/lib/components/ui/LoaderIcon/LoaderIcon";
|
||||||
import { Tabs } from "@/lib/components/ui/Tabs/Tabs";
|
import { Tabs } from "@/lib/components/ui/Tabs/Tabs";
|
||||||
import { Tab } from "@/lib/types/Tab";
|
import { Tab } from "@/lib/types/Tab";
|
||||||
|
|
||||||
|
import styles from "./BrainManagementTabs.module.scss";
|
||||||
import { KnowledgeTab } from "./components/KnowledgeTab/KnowledgeTab";
|
import { KnowledgeTab } from "./components/KnowledgeTab/KnowledgeTab";
|
||||||
import { useAddedKnowledge } from "./components/KnowledgeTab/hooks/useAddedKnowledge";
|
import { useAddedKnowledge } from "./components/KnowledgeTab/hooks/useAddedKnowledge";
|
||||||
import { PeopleTab } from "./components/PeopleTab/PeopleTab";
|
import { PeopleTab } from "./components/PeopleTab/PeopleTab";
|
||||||
@ -17,6 +20,7 @@ export const BrainManagementTabs = (): JSX.Element => {
|
|||||||
const [selectedTab, setSelectedTab] = useState("Knowledge");
|
const [selectedTab, setSelectedTab] = useState("Knowledge");
|
||||||
const { brainId, hasEditRights } = useBrainManagementTabs();
|
const { brainId, hasEditRights } = useBrainManagementTabs();
|
||||||
const { allKnowledge } = useAddedKnowledge({ brainId: brainId ?? undefined });
|
const { allKnowledge } = useAddedKnowledge({ brainId: brainId ?? undefined });
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const { brain, isLoading } = useBrainFetcher({
|
const { brain, isLoading } = useBrainFetcher({
|
||||||
brainId,
|
brainId,
|
||||||
@ -65,15 +69,26 @@ export const BrainManagementTabs = (): JSX.Element => {
|
|||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
<div className="flex w-full h-full justify-center items-center">
|
<div className={styles.loader}>
|
||||||
<Spinner />
|
<LoaderIcon size="big" color="primary" />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div>
|
||||||
<Tabs tabList={brainManagementTabs} />
|
<div className={styles.header_wrapper}>
|
||||||
|
<Icon
|
||||||
|
name="chevronLeft"
|
||||||
|
size="normal"
|
||||||
|
color="black"
|
||||||
|
handleHover={true}
|
||||||
|
onClick={() => router.push("/studio")}
|
||||||
|
/>
|
||||||
|
<div className={styles.tabs}>
|
||||||
|
<Tabs tabList={brainManagementTabs} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{selectedTab === "Settings" && <SettingsTab brainId={brainId} />}
|
{selectedTab === "Settings" && <SettingsTab brainId={brainId} />}
|
||||||
{selectedTab === "People" && <PeopleTab brainId={brainId} />}
|
{selectedTab === "People" && <PeopleTab brainId={brainId} />}
|
||||||
{selectedTab === "Knowledge" && (
|
{selectedTab === "Knowledge" && (
|
||||||
@ -83,6 +98,6 @@ export const BrainManagementTabs = (): JSX.Element => {
|
|||||||
allKnowledge={allKnowledge}
|
allKnowledge={allKnowledge}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user