From 7cfebab6c1311809c6002c5a4e143f82018a6551 Mon Sep 17 00:00:00 2001 From: Toba Ojo Date: Wed, 15 Oct 2025 15:15:04 +0100 Subject: [PATCH] - improved UI for sessions page --- .../FrontCameraOverviewCard.tsx | 6 +- .../OverviewVideoContainer.tsx | 6 +- src/components/HistoryList/AlertItem.tsx | 11 ++- src/components/HistoryList/HistoryList.tsx | 51 +++++-------- .../RearCameraOverviewCard.tsx | 13 +--- src/components/SessionForm/HitSearchCard.tsx | 32 ++++----- src/components/SessionForm/SessionCard.tsx | 72 +++++++++---------- src/components/UI/Card.tsx | 2 +- src/pages/Session.tsx | 6 +- 9 files changed, 87 insertions(+), 112 deletions(-) diff --git a/src/components/FrontCameraOverview/FrontCameraOverviewCard.tsx b/src/components/FrontCameraOverview/FrontCameraOverviewCard.tsx index 75503b1..0aa1787 100644 --- a/src/components/FrontCameraOverview/FrontCameraOverviewCard.tsx +++ b/src/components/FrontCameraOverview/FrontCameraOverviewCard.tsx @@ -14,11 +14,7 @@ const FrontCameraOverviewCard = () => { }); return ( - +
diff --git a/src/components/FrontCameraSettings/OverviewVideoContainer.tsx b/src/components/FrontCameraSettings/OverviewVideoContainer.tsx index 1a0b7a8..379f95b 100644 --- a/src/components/FrontCameraSettings/OverviewVideoContainer.tsx +++ b/src/components/FrontCameraSettings/OverviewVideoContainer.tsx @@ -30,11 +30,7 @@ const OverviewVideoContainer = ({ trackMouse: true, }); return ( - +
{ dispatch({ type: "REMOVE", payload: item }); }; return ( -
+
+
{isHotListHit && hotlistHit} {isNPEDHitA && NPEDHITicon} @@ -64,7 +69,9 @@ const AlertItem = ({ item }: AlertItemProps) => { - +
+ +
{ const { state, dispatch, isLoading, error } = useAlertHitContext(); const { mutation } = useCameraBlackboard(); - const handleDeleteClick = async (deletedItem: SightingType) => { - const res = await mutation.mutateAsync({ - operation: "VIEW", - path: "alertHistory", - }); - const oldArray = res?.result; - const updatedArray = oldArray?.filter( - (item: SightingType) => item?.ref !== deletedItem?.ref - ); - - mutation.mutate({ - operation: "INSERT", - path: "alertHistory", - value: updatedArray, - }); - dispatch({ type: "REMOVE", payload: deletedItem }); - }; - const handleClearListClick = (listName: CameraBlackBoardOptions) => { dispatch({ type: "DELETE", payload: [] }); mutation.mutate({ @@ -38,7 +18,7 @@ const HistoryList = () => { }; return ( - + -
- )) +
+ {state?.alertList?.map((alertItem) => ( + + ))} +
) : ( -

No Alert results

+
+
+ No Alert Results +
+

+ Alerts will appear here in real-time once there are Hotlist or{" "} + NPED hits. Use{" "} + Start Session to begin capturing results, or add a{" "} + Sighting from the sighting list. +

+
)}
diff --git a/src/components/RearCameraOverview/RearCameraOverviewCard.tsx b/src/components/RearCameraOverview/RearCameraOverviewCard.tsx index 55afe4e..883d096 100644 --- a/src/components/RearCameraOverview/RearCameraOverviewCard.tsx +++ b/src/components/RearCameraOverview/RearCameraOverviewCard.tsx @@ -18,18 +18,9 @@ const RearCameraOverviewCard = ({ className }: CardProps) => { }); const { mostRecent } = useSightingFeedContext(); return ( - +
- +
diff --git a/src/components/SessionForm/HitSearchCard.tsx b/src/components/SessionForm/HitSearchCard.tsx index 745a182..4282ac9 100644 --- a/src/components/SessionForm/HitSearchCard.tsx +++ b/src/components/SessionForm/HitSearchCard.tsx @@ -9,38 +9,36 @@ const SessionCard = () => { const { dispatch } = useAlertHitContext(); return ( - +
+ - -
+
setSearchTerm(e.target.value)} /> + +
- {searchTerm && (
    -
  • Number of Vehicles: {dedupedSightings.length}
  • -
  • Vehicles without Tax: {vehicles.notTaxed.length}
  • -
  • Vehicles without MOT: {vehicles.notMOT.length}
  • -
  • Vehicles with NPED Cat A: {vehicles.npedCatA.length}
  • -
  • Vehicles with NPED Cat B: {vehicles.npedCatB.length}
  • -
  • Vehicles with NPED Cat C: {vehicles.npedCatC.length}
  • +
  • +

    Number of Vehicles:

    + {dedupedSightings.length} +
  • +
  • +

    Vehicles without Tax:

    + {vehicles.notTaxed.length} +
  • +
  • +

    Vehicles without MOT:

    {" "} + {vehicles.notMOT.length} +
  • +
  • +

    Vehicles with NPED Cat A:

    + {vehicles.npedCatA.length} +
  • +
  • +

    Vehicles with NPED Cat B:

    {" "} + {vehicles.npedCatB.length} +
  • +
  • + Vehicles with NPED Cat C:{" "} + {vehicles.npedCatC.length} +
diff --git a/src/components/UI/Card.tsx b/src/components/UI/Card.tsx index 8a4663b..9cadd5d 100644 --- a/src/components/UI/Card.tsx +++ b/src/components/UI/Card.tsx @@ -10,7 +10,7 @@ const Card = ({ children, className }: CardProps) => { return (
diff --git a/src/pages/Session.tsx b/src/pages/Session.tsx index 058bf84..e6b2e83 100644 --- a/src/pages/Session.tsx +++ b/src/pages/Session.tsx @@ -11,8 +11,10 @@ const Session = () => { return (
- - +
+ + +