mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-21 10:21:54 +03:00
7cc90ef258
* feat: add notification controller * feat: add polling logic on pending notifications * feat: refecth notifications on Feed
25 lines
731 B
TypeScript
25 lines
731 B
TypeScript
import { useEffect, useState } from "react";
|
|
|
|
import { useChatContext } from "@/lib/context";
|
|
|
|
import { checkIfHasPendingRequest } from "../utils/checkIfHasPendingRequest";
|
|
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
export const useActionBar = () => {
|
|
const [shouldDisplayUploadCard, setShouldDisplayUploadCard] = useState(false);
|
|
|
|
const [hasPendingRequests, setHasPendingRequests] = useState(false);
|
|
const { notifications } = useChatContext();
|
|
|
|
useEffect(() => {
|
|
setHasPendingRequests(checkIfHasPendingRequest(notifications));
|
|
}, [notifications]);
|
|
|
|
return {
|
|
shouldDisplayUploadCard,
|
|
setShouldDisplayUploadCard,
|
|
hasPendingRequests,
|
|
setHasPendingRequests,
|
|
};
|
|
};
|