From ea93053dd3e6585d79be7e5a87539f6dc7b87406 Mon Sep 17 00:00:00 2001 From: Toba Ojo Date: Wed, 19 Nov 2025 11:52:37 +0000 Subject: [PATCH] - sesstions start by default - added restart session button --- src/components/SessionForm/SessionCard.tsx | 28 ++++++++++++++++++- .../reducers/IntegrationsContextReducer.ts | 7 ++++- src/hooks/useGetOverviewSnapshot.ts | 26 +++++------------ 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/src/components/SessionForm/SessionCard.tsx b/src/components/SessionForm/SessionCard.tsx index d77931b..a79a9c7 100644 --- a/src/components/SessionForm/SessionCard.tsx +++ b/src/components/SessionForm/SessionCard.tsx @@ -4,7 +4,7 @@ import { useIntegrationsContext } from "../../context/IntegrationsContext"; 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"; +import { faFloppyDisk, faPause, faPlay, faStop, faArrowRotateRight } from "@fortawesome/free-solid-svg-icons"; import VehicleSessionItem from "../UI/VehicleSessionItem"; import { useCameraBlackboard } from "../../hooks/useCameraBlackboard"; @@ -70,6 +70,21 @@ const SessionCard = () => { if (result.reason === "OK") toast.success("Session saved"); }; + const handleRestartClick = async () => { + const result = await mutation.mutateAsync({ + operation: "INSERT", + path: "sessionStats", + value: [], + }); + await mutation.mutateAsync({ + operation: "SAVE", + path: "", + value: null, + }); + if (result.reason === "OK") toast.success("Session restarted"); + dispatch({ type: "SESSIONRESTART", payload: [] }); + }; + return ( @@ -85,6 +100,17 @@ const SessionCard = () => {

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

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