5 Commits

10 changed files with 52 additions and 11 deletions

View File

@@ -30,6 +30,12 @@ const NPEDCategoryPopup = () => {
value: values,
path: "CategoryPopup",
});
await mutation.mutateAsync({
operation: "SAVE",
path: "",
value: null
})
if (result?.reason === "OK") toast.success("Pop up settings saved");
dispatch({ type: "NPEDCATENABLED", payload: values });
};

View File

@@ -62,7 +62,11 @@ const SessionCard = () => {
path: "sessionStats",
value: dedupedSightings,
});
await mutation.mutateAsync({
operation: "SAVE",
path: "",
value: null,
});
if (result.reason === "OK") toast.success("Session saved");
};

View File

@@ -39,6 +39,11 @@ const SoundSettingsFields = () => {
path: "soundSettings",
value: updatedValues,
});
await mutation.mutateAsync({
operation: "SAVE",
path: "",
value: null,
});
if (result.reason !== "OK") {
toast.error("Cannot update sound settings");
} else {

View File

@@ -46,7 +46,11 @@ const SoundUpload = () => {
if (result.reason !== "OK") {
toast.error("Cannot update sound settings");
}
await mutation.mutateAsync({
operation: "SAVE",
path: "",
value: null,
});
dispatch({ type: "ADD", payload: values });
};

View File

@@ -25,7 +25,7 @@ const SightingModal = ({ isSightingModalOpen, handleClose, sighting, onDelete }:
const { query, mutation } = useCameraBlackboard();
const hotlistNames = getHotlistName(sighting?.metadata?.hotlistMatches);
const handleAcknowledgeButton = () => {
const handleAcknowledgeButton = async () => {
try {
if (!sighting) {
toast.error("Cannot add sighting to alert list");
@@ -33,17 +33,27 @@ const SightingModal = ({ isSightingModalOpen, handleClose, sighting, onDelete }:
return;
}
if (!query.data.alertHistory) {
mutation.mutate({
await mutation.mutateAsync({
operation: "INSERT",
path: "alertHistory",
value: [sighting],
});
await mutation.mutateAsync({
operation: "SAVE",
path: "",
value: null,
});
} else {
mutation.mutate({
await mutation.mutateAsync({
operation: "APPEND",
path: "alertHistory",
value: sighting,
});
await mutation.mutateAsync({
operation: "SAVE",
path: "",
value: null,
});
toast.success("Sighting Successfully added to alert list");
}

View File

@@ -47,7 +47,7 @@ export default function Header() {
</Link>
</div>
<div className="flex flex-col lg:flex-row items-center space-x-24 justify-items-center">
<div className="flex flex-row lg:flex-row space-x-2 mx-auto p-2 md:p-0 items-center">
<div className="flex flex-row lg:flex-row space-x-2 mx-10 p-2 md:p-0 items-center">
{sessionStarted && sessionPaused ? (
<p className="text-gray-400 font-bold">Session Paused</p>
) : (

View File

@@ -16,6 +16,11 @@ const SoundBtn = () => {
path: "soundEnabled",
value: { enabled: newEnabled },
});
await mutation.mutateAsync({
operation: "SAVE",
path: "",
value: null,
});
};
useEffect(() => {
setEnabled(query?.data?.soundEnabled?.enabled);
@@ -23,10 +28,7 @@ const SoundBtn = () => {
return (
<button onClick={handleClick}>
<FontAwesomeIcon
icon={enabled ? faVolumeHigh : faVolumeXmark}
size="2x"
/>
<FontAwesomeIcon icon={enabled ? faVolumeHigh : faVolumeXmark} size="2x" />
</button>
);
};

View File

@@ -16,6 +16,11 @@ export const IntegrationsProvider = ({ children }: IntegrationsProviderType) =>
const fetchData = async () => {
try {
await mutation.mutateAsync({
operation: "Load",
path: "",
value: null,
});
const result = await mutation.mutateAsync({
operation: "VIEW",
path: "sessionStats",

View File

@@ -20,6 +20,11 @@ const SoundContextProvider = ({ children }: SoundContextProviderProps) => {
operation: "VIEW",
path: "soundSettings",
});
await mutation.mutateAsync({
operation: "LOAD",
path: "",
value: null,
});
if (!result.result || typeof result.result !== "object") {
dispatch({ type: "UPDATE", payload: state });

View File

@@ -282,7 +282,7 @@ export type CameraConfig = {
export type CameraBlackBoardOptions = {
operation?: string;
path?: string;
value?: object | string | number | (string | number)[];
value?: object | string | number | (string | number)[] | null;
};
export type CameraBlackboardResponse = {