quivr/frontend/lib/hooks/useBrainIdFromUrl.ts
Mamadou DICKO e3925bcbc0
feat(brainSettings): rework knowledge tab (#1534)
Issue: https://github.com/StanGirard/quivr/issues/1435

- feat(knowledgeTab): update structure
- refactor: change AddKnowledge structure
- feat: change AddKnowledge component structure
- feat: rework sources logic
- feat: change knowledge tab upload process
- fix: change knowledge tab fetch, create, update logic
- feat: improve added knowledge ui
- style: improve responsivity

Fix: 
- https://github.com/StanGirard/quivr/issues/1516
- https://github.com/StanGirard/quivr/issues/1336
- https://github.com/StanGirard/quivr/issues/1204




https://github.com/StanGirard/quivr/assets/63923024/f2917bf3-4ff8-42c6-8149-0b36287441b4
2023-10-31 19:02:26 +01:00

20 lines
545 B
TypeScript

import { UUID } from "crypto";
import { useParams } from "next/navigation";
import { useBrainContext } from "../context/BrainProvider/hooks/useBrainContext";
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const useUrlBrain = () => {
const { allBrains } = useBrainContext();
const params = useParams();
const brainId = params?.brainId as UUID | undefined;
const correspondingBrain = allBrains.find((brain) => brain.id === brainId);
return {
brain: correspondingBrain,
brainId,
};
};