quivr/frontend/lib/context/KnowledgeToFeedProvider/knowledgeToFeed-provider.tsx
Mamadou DICKO 36fd146fed
feat: improve app ux (#1281)
* style: make FeedItemIcon the same size

* feat: update feed component brain selector label position

* style: change purple to 600

* feat: improve already dropped file message ux

* feat: autoclose feedinput on chatId change

* style: change chat colors

* feat: prevent linebreak in knowledge to upload row

* feat(textFIeld): avoid textfield content going under icon

* feat(knowledgeToUpload): add tooltip on urls and files name

* feat(feedBrain): auto scroll on messages when feed modal get opened

* style: update colors

* refactor: rename uploadCard to FeedCard
2023-09-29 10:24:31 +02:00

39 lines
1.0 KiB
TypeScript

"use client";
import { createContext, useState } from "react";
import { FeedItemType } from "@/app/chat/[chatId]/components/ActionsBar/types";
type KnowledgeToFeedContextType = {
knowledgeToFeed: FeedItemType[];
setKnowledgeToFeed: React.Dispatch<React.SetStateAction<FeedItemType[]>>;
shouldDisplayFeedCard: boolean;
setShouldDisplayFeedCard: React.Dispatch<React.SetStateAction<boolean>>;
};
export const KnowledgeToFeedContext = createContext<
KnowledgeToFeedContextType | undefined
>(undefined);
export const KnowledgeToFeedProvider = ({
children,
}: {
children: React.ReactNode;
}): JSX.Element => {
const [knowledgeToFeed, setKnowledgeToFeed] = useState<FeedItemType[]>([]);
const [shouldDisplayFeedCard, setShouldDisplayFeedCard] = useState(false);
return (
<KnowledgeToFeedContext.Provider
value={{
knowledgeToFeed,
setKnowledgeToFeed,
shouldDisplayFeedCard,
setShouldDisplayFeedCard,
}}
>
{children}
</KnowledgeToFeedContext.Provider>
);
};