mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-18 11:51:41 +03:00
8fc8c5e3ed
# 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):
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
"use client";
|
|
import { UUID } from "crypto";
|
|
import { AnimatePresence, motion } from "framer-motion";
|
|
|
|
import { LoaderIcon } from "@/lib/components/ui/LoaderIcon/LoaderIcon";
|
|
import { MessageInfoBox } from "@/lib/components/ui/MessageInfoBox/MessageInfoBox";
|
|
|
|
import styles from "./KnowledgeTab.module.scss";
|
|
import { KnowledgeTable } from "./KnowledgeTable/KnowledgeTable";
|
|
import { useAddedKnowledge } from "./hooks/useAddedKnowledge";
|
|
|
|
type KnowledgeTabProps = {
|
|
brainId: UUID;
|
|
hasEditRights: boolean;
|
|
};
|
|
export const KnowledgeTab = ({ brainId }: KnowledgeTabProps): JSX.Element => {
|
|
const { isPending, allKnowledge } = useAddedKnowledge({
|
|
brainId,
|
|
});
|
|
|
|
if (isPending) {
|
|
return <LoaderIcon size="big" color="accent" />;
|
|
}
|
|
|
|
if (allKnowledge.length === 0) {
|
|
return (
|
|
<div className={styles.knowledge_tab_wrapper}>
|
|
<MessageInfoBox
|
|
type="warning"
|
|
content="This brain is empty! You can add knowledge by clicking on the Add knowledge button."
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className={styles.knowledge_tab_wrapper}>
|
|
<motion.div layout className="w-full flex flex-col gap-5">
|
|
<AnimatePresence mode="popLayout">
|
|
<KnowledgeTable knowledgeList={allKnowledge} />
|
|
</AnimatePresence>
|
|
</motion.div>
|
|
</div>
|
|
);
|
|
};
|