diff --git a/checkers-app/src/components/dashboard/PendingMsgAlert.tsx b/checkers-app/src/components/dashboard/PendingMsgAlert.tsx index 0d6e4c71..b4205e7e 100644 --- a/checkers-app/src/components/dashboard/PendingMsgAlert.tsx +++ b/checkers-app/src/components/dashboard/PendingMsgAlert.tsx @@ -1,8 +1,9 @@ import { Alert } from "@material-tailwind/react"; import { EnvelopeIcon } from "@heroicons/react/20/solid"; import { BellAlertIcon } from "@heroicons/react/20/solid"; +import { useNavigate } from "react-router-dom"; -//true for pending messages, fale for update on pending VOTE +//true for pending messages, false for update on pending VOTE export default function PendingMessageAlert({ hasPending, pendingCount, @@ -10,20 +11,28 @@ export default function PendingMessageAlert({ hasPending: boolean; pendingCount: number; }) { + const navigate = useNavigate(); + + const handleAlertClick = () => { + navigate("/votes"); + }; + return ( - - ) : ( - - ) - } - className="rounded items-center border-l-4 border-highlight-color bg-[highlight-color]/5 font-medium text-highlight-color shadow-md" - > - {hasPending - ? `${pendingCount} pending message(s) yet to vote!` - : `${"TBD"} Crowd Vote updates!`} - +
+ + ) : ( + + ) + } + className="rounded items-center border-l-4 border-highlight-color bg-[highlight-color]/5 font-medium text-highlight-color shadow-md" + > + {hasPending + ? `${pendingCount} pending message(s) yet to vote!` + : `${"TBD"} Crowd Vote updates!`} + +
); } diff --git a/checkers-app/src/components/dashboard/index.tsx b/checkers-app/src/components/dashboard/index.tsx index e4056b3e..742d7f63 100644 --- a/checkers-app/src/components/dashboard/index.tsx +++ b/checkers-app/src/components/dashboard/index.tsx @@ -23,7 +23,7 @@ export default function Dashboard() { return; } const checker: Checker = await getChecker(checkerDetails.checkerId); - if (checker) { + if (checker && checker.last30days) { setTotalVotes(checker.last30days.totalVoted); setAccuracyRate(checker.last30days.accuracyRate); setAvgResponseTime(checker.last30days.averageResponseTime);