2023-09-28 12:29:55 +03:00
|
|
|
import { useEffect, useState } from "react";
|
|
|
|
|
2023-09-28 16:39:30 +03:00
|
|
|
import { useKnowledgeToFeedContext } from "@/lib/context/KnowledgeToFeedProvider/hooks/useKnowledgeToFeedContext";
|
2023-09-07 18:23:31 +03:00
|
|
|
|
2023-08-11 11:06:20 +03:00
|
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
|
|
export const useSelectedChatPage = () => {
|
2023-09-27 16:39:04 +03:00
|
|
|
const [shouldDisplayUploadCard, setShouldDisplayUploadCard] = useState(false);
|
2023-09-28 16:39:30 +03:00
|
|
|
const { knowledgeToFeed } = useKnowledgeToFeedContext();
|
2023-09-28 12:29:55 +03:00
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (knowledgeToFeed.length > 0 && !shouldDisplayUploadCard) {
|
|
|
|
setShouldDisplayUploadCard(true);
|
|
|
|
}
|
|
|
|
}, [knowledgeToFeed, setShouldDisplayUploadCard]);
|
2023-08-11 11:06:20 +03:00
|
|
|
|
2023-09-27 16:39:04 +03:00
|
|
|
return {
|
|
|
|
shouldDisplayUploadCard,
|
|
|
|
setShouldDisplayUploadCard,
|
|
|
|
};
|
2023-08-11 11:06:20 +03:00
|
|
|
};
|