From b58181e551de581325ca54be9bcc2e336d566982 Mon Sep 17 00:00:00 2001 From: Toba Ojo Date: Wed, 22 Oct 2025 08:54:42 +0100 Subject: [PATCH] - started improvements on session page to include pause and save buttons --- src/components/SessionForm/SessionCard.tsx | 47 ++++++++++++++++++++-- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/src/components/SessionForm/SessionCard.tsx b/src/components/SessionForm/SessionCard.tsx index a5dc93e..ffdc3aa 100644 --- a/src/components/SessionForm/SessionCard.tsx +++ b/src/components/SessionForm/SessionCard.tsx @@ -3,6 +3,8 @@ import CardHeader from "../UI/CardHeader"; import { useNPEDContext } from "../../context/NPEDUserContext"; import type { ReducedSightingType } from "../../types/types"; import { toast } from "sonner"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { faFloppyDisk, faPause, faPlay, faStop } from "@fortawesome/free-solid-svg-icons"; const SessionCard = () => { const { sessionStarted, setSessionStarted, sessionList } = useNPEDContext(); @@ -12,19 +14,24 @@ const SessionCard = () => { toast(`${sessionStarted ? "Vehicle tracking session Ended" : "Vehicle tracking session Started"}`); }; + const handleSaveCick = () => { + console.log("clicked"); + }; + const sightings = [...new Map(sessionList.map((vehicle) => [vehicle.vrm, vehicle]))]; const dedupedSightings = sightings.map((sighting) => sighting[1]); const vehicles = dedupedSightings.reduce>( (acc, item) => { + const hotlisthit = Object.values(item.metadata?.hotlistMatches ?? {}).includes(true); if (item.metadata?.npedJSON["NPED CATEGORY"] === "A") acc.npedCatA.push(item); if (item.metadata?.npedJSON["NPED CATEGORY"] === "B") acc.npedCatB.push(item); if (item.metadata?.npedJSON["NPED CATEGORY"] === "C") acc.npedCatC.push(item); if (item.metadata?.npedJSON["NPED CATEGORY"] === "D") acc.npedCatD.push(item); if (item.metadata?.npedJSON["TAX STATUS"] === false) acc.notTaxed.push(item); if (item.metadata?.npedJSON["MOT STATUS"] === false) acc.notMOT.push(item); - + if (hotlisthit) acc.hotlistHit.push(item); return acc; }, { @@ -34,6 +41,7 @@ const SessionCard = () => { npedCatD: [], notTaxed: [], notMOT: [], + hotlistHit: [], } ); @@ -47,12 +55,39 @@ const SessionCard = () => { } transition w-full`} onClick={handleStartClick} > - {sessionStarted ? "End Session" : "Start Session"} +
+ +

{sessionStarted ? "End Session" : "Start Session"}

+
+
+ {sessionStarted && ( + + )} + {sessionStarted && ( + + )} +