mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-20 01:21:50 +03:00
3da64c0b0e
Issue: https://github.com/StanGirard/quivr/issues/1571 Demo: https://github.com/StanGirard/quivr/assets/63923024/e7a6118e-29f8-44aa-af4b-0ea1b8013a33
25 lines
796 B
TypeScript
25 lines
796 B
TypeScript
import { useEffect, useState } from "react";
|
|
|
|
import { useChatContext } from "@/lib/context";
|
|
import { useKnowledgeToFeedContext } from "@/lib/context/KnowledgeToFeedProvider/hooks/useKnowledgeToFeedContext";
|
|
|
|
import { checkIfHasPendingRequest } from "../utils/checkIfHasPendingRequest";
|
|
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
export const useActionBar = () => {
|
|
const [hasPendingRequests, setHasPendingRequests] = useState(false);
|
|
const { notifications } = useChatContext();
|
|
|
|
const { shouldDisplayFeedCard } = useKnowledgeToFeedContext();
|
|
|
|
useEffect(() => {
|
|
setHasPendingRequests(checkIfHasPendingRequest(notifications));
|
|
}, [notifications]);
|
|
|
|
return {
|
|
hasPendingRequests,
|
|
setHasPendingRequests,
|
|
shouldDisplayFeedCard,
|
|
};
|
|
};
|