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 && (