mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-15 09:32:22 +03:00
feat(frontend): add nb of knowledges per brain (#2502)
# 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
b7ff2e77af
commit
aa14d6336e
@ -7,6 +7,7 @@ import { Tabs } from "@/lib/components/ui/Tabs/Tabs";
|
||||
import { Tab } from "@/lib/types/Tab";
|
||||
|
||||
import { KnowledgeTab } from "./components/KnowledgeTab/KnowledgeTab";
|
||||
import { useAddedKnowledge } from "./components/KnowledgeTab/hooks/useAddedKnowledge";
|
||||
import { PeopleTab } from "./components/PeopleTab/PeopleTab";
|
||||
import { SettingsTab } from "./components/SettingsTab/SettingsTab";
|
||||
import { useBrainFetcher } from "./hooks/useBrainFetcher";
|
||||
@ -15,6 +16,7 @@ import { useBrainManagementTabs } from "./hooks/useBrainManagementTabs";
|
||||
export const BrainManagementTabs = (): JSX.Element => {
|
||||
const [selectedTab, setSelectedTab] = useState("Settings");
|
||||
const { brainId, hasEditRights } = useBrainManagementTabs();
|
||||
const { allKnowledge } = useAddedKnowledge({ brainId: brainId ?? undefined });
|
||||
|
||||
const { brain, isLoading } = useBrainFetcher({
|
||||
brainId,
|
||||
@ -43,7 +45,9 @@ export const BrainManagementTabs = (): JSX.Element => {
|
||||
disabled: !hasEditRights,
|
||||
},
|
||||
{
|
||||
label: "Knowledge",
|
||||
label: `Knowledge${allKnowledge.length > 1 ? "s" : ""} (${
|
||||
allKnowledge.length
|
||||
})`,
|
||||
isSelected: selectedTab === "Knowledge",
|
||||
onClick: () => setSelectedTab("Knowledge"),
|
||||
iconName: "file",
|
||||
@ -73,7 +77,11 @@ export const BrainManagementTabs = (): JSX.Element => {
|
||||
{selectedTab === "Settings" && <SettingsTab brainId={brainId} />}
|
||||
{selectedTab === "People" && <PeopleTab brainId={brainId} />}
|
||||
{selectedTab === "Knowledge" && (
|
||||
<KnowledgeTab brainId={brainId} hasEditRights={hasEditRights} />
|
||||
<KnowledgeTab
|
||||
brainId={brainId}
|
||||
hasEditRights={hasEditRights}
|
||||
allKnowledge={allKnowledge}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
@ -6,6 +6,7 @@ import { LoaderIcon } from "@/lib/components/ui/LoaderIcon/LoaderIcon";
|
||||
import { MessageInfoBox } from "@/lib/components/ui/MessageInfoBox/MessageInfoBox";
|
||||
import QuivrButton from "@/lib/components/ui/QuivrButton/QuivrButton";
|
||||
import { useKnowledgeToFeedContext } from "@/lib/context/KnowledgeToFeedProvider/hooks/useKnowledgeToFeedContext";
|
||||
import { Knowledge } from "@/lib/types/Knowledge";
|
||||
|
||||
import styles from "./KnowledgeTab.module.scss";
|
||||
import { KnowledgeTable } from "./KnowledgeTable/KnowledgeTable";
|
||||
@ -14,9 +15,13 @@ import { useAddedKnowledge } from "./hooks/useAddedKnowledge";
|
||||
type KnowledgeTabProps = {
|
||||
brainId: UUID;
|
||||
hasEditRights: boolean;
|
||||
allKnowledge: Knowledge[];
|
||||
};
|
||||
export const KnowledgeTab = ({ brainId }: KnowledgeTabProps): JSX.Element => {
|
||||
const { isPending, allKnowledge } = useAddedKnowledge({
|
||||
export const KnowledgeTab = ({
|
||||
brainId,
|
||||
allKnowledge,
|
||||
}: KnowledgeTabProps): JSX.Element => {
|
||||
const { isPending } = useAddedKnowledge({
|
||||
brainId,
|
||||
});
|
||||
const { setShouldDisplayFeedCard } = useKnowledgeToFeedContext();
|
||||
|
Loading…
Reference in New Issue
Block a user