Compare commits
5 Commits
0b1f0b72a8
...
bugfix/sav
| Author | SHA1 | Date | |
|---|---|---|---|
| d2f030f221 | |||
| 5ce70ffa06 | |||
| b1cd2cef8a | |||
| 8db9d7ff51 | |||
| 96a880a4df |
@@ -6,6 +6,7 @@ import { Form, Formik } from "formik";
|
||||
import { useIntegrationsContext } from "../../context/IntegrationsContext";
|
||||
import { useCameraBlackboard } from "../../hooks/useCameraBlackboard";
|
||||
import type { CategoryPopups } from "../../types/types";
|
||||
import { toast } from "sonner";
|
||||
|
||||
const NPEDCategoryPopup = () => {
|
||||
const { state, dispatch } = useIntegrationsContext();
|
||||
@@ -24,11 +25,18 @@ const NPEDCategoryPopup = () => {
|
||||
};
|
||||
|
||||
const handleSubmit = async (values: CategoryPopups) => {
|
||||
await mutation.mutateAsync({
|
||||
const result = await mutation.mutateAsync({
|
||||
operation: "INSERT",
|
||||
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 });
|
||||
};
|
||||
|
||||
|
||||
@@ -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");
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import NPEDIcon from "/NPED.svg";
|
||||
const NPEDCard = () => {
|
||||
return (
|
||||
<Card className="p-4">
|
||||
<CardHeader title={"NPED Config"} img={NPEDIcon} />
|
||||
<CardHeader title={"NPED"} img={NPEDIcon} />
|
||||
<NPEDFields />
|
||||
</Card>
|
||||
);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 });
|
||||
};
|
||||
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
) : (
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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 });
|
||||
|
||||
@@ -22,7 +22,7 @@ const SystemSettings = () => {
|
||||
<Tab>System</Tab>
|
||||
<Tab>Output</Tab>
|
||||
<Tab>Integrations</Tab>
|
||||
<Tab>WiFi and Modem</Tab>
|
||||
<Tab>WiFi & Modem</Tab>
|
||||
<Tab>Sound</Tab>
|
||||
</TabList>
|
||||
<TabPanel>
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user