Time
diff --git a/src/components/SightingsWidget/SightingWidget.tsx b/src/components/SightingsWidget/SightingWidget.tsx
index 7b1059b..fe31fe7 100644
--- a/src/components/SightingsWidget/SightingWidget.tsx
+++ b/src/components/SightingsWidget/SightingWidget.tsx
@@ -68,6 +68,11 @@ export default function SightingHistoryWidget({ className, title }: SightingHist
const hasAutoOpenedRef = useRef(false);
const npedRef = useRef(false);
+ const isCatAEnabled = integrationState?.iscatEnabled?.catA;
+ const isCatBEnabled = integrationState?.iscatEnabled?.catB;
+ const isCatCEnabled = integrationState?.iscatEnabled?.catC;
+ const isCatDEnabled = integrationState?.iscatEnabled?.catD;
+
const enqueue = useCallback((sighting: SightingType, kind: HitKind) => {
const id = sighting.vrm ?? sighting.ref;
if (processedRefs.current.has(id)) return;
@@ -118,7 +123,11 @@ export default function SightingHistoryWidget({ className, title }: SightingHist
if (processedRefs.current.has(id)) continue;
const isHotlistHit = checkIsHotListHit(sighting);
const npedcategory = sighting?.metadata?.npedJSON?.["NPED CATEGORY"];
- const isNPED = npedcategory === "A" || npedcategory === "B" || npedcategory === "C";
+ const isNPED =
+ (npedcategory === "A" && isCatAEnabled) ||
+ (npedcategory === "B" && isCatBEnabled) ||
+ (npedcategory === "C" && isCatCEnabled) ||
+ (npedcategory === "D" && isCatDEnabled);
if (isNPED || isHotlistHit) {
enqueue(sighting, isNPED ? "NPED" : "HOTLIST"); // enqueue ONLY
@@ -148,7 +157,8 @@ export default function SightingHistoryWidget({ className, title }: SightingHist
const isNPEDHitA = cat === "A";
const isNPEDHitB = cat === "B";
const isNPEDHitC = cat === "C";
- return isNPEDHitA || isNPEDHitB || isNPEDHitC;
+ const isNPEDHitD = cat === "D";
+ return isNPEDHitA || isNPEDHitB || isNPEDHitC || isNPEDHitD;
});
const firstHot = rows?.find((r) => {
const isHotListHit = checkIsHotListHit(r);
diff --git a/src/context/providers/IntegrationsContextProvider.tsx b/src/context/providers/IntegrationsContextProvider.tsx
index d12540c..4845b2e 100644
--- a/src/context/providers/IntegrationsContextProvider.tsx
+++ b/src/context/providers/IntegrationsContextProvider.tsx
@@ -12,17 +12,39 @@ export const IntegrationsProvider = ({ children }: IntegrationsProviderType) =>
const { mutation } = useCameraBlackboard();
useEffect(() => {
- const fetchData = async () => {
- const result = await mutation.mutateAsync({
- operation: "VIEW",
- path: "sessionStats",
- });
- if (!result.result || typeof result.result === "string") return;
+ let isMounted = true;
- dispatch({ type: "UPDATE", payload: result?.result });
+ const fetchData = async () => {
+ try {
+ const result = await mutation.mutateAsync({
+ operation: "VIEW",
+ path: "sessionStats",
+ });
+
+ if (!isMounted) return;
+
+ const catResult = await mutation.mutateAsync({
+ operation: "VIEW",
+ path: "CategoryPopup",
+ });
+
+ if (!isMounted) return;
+ if (!result?.result || typeof result.result === "string") return;
+
+ dispatch({ type: "UPDATE", payload: result.result });
+ dispatch({ type: "NPEDCATENABLED", payload: catResult.result });
+ } catch (error) {
+ console.error("Error in fetchData:", error);
+ }
};
+
fetchData();
+
+ return () => {
+ isMounted = false;
+ };
}, []);
+
return (
{
};
const updateCameraMode = async (options: { camera: string; mode: string }) => {
- console.log(options);
const dayNightPayload = {
id: options.camera,
fields: [
diff --git a/src/pages/SystemSettings.tsx b/src/pages/SystemSettings.tsx
index 0d38273..d8154d9 100644
--- a/src/pages/SystemSettings.tsx
+++ b/src/pages/SystemSettings.tsx
@@ -10,6 +10,7 @@ import { Toaster } from "sonner";
import { useNPEDAuth } from "../hooks/useNPEDAuth";
import SoundSettingsCard from "../components/SettingForms/Sound/SoundSettingsCard";
import SoundUploadCard from "../components/SettingForms/Sound/SoundUploadCard";
+import NPEDCategoryPopup from "../components/PopupSettings/NPEDCategoryPopup";
const SystemSettings = () => {
useNPEDAuth();
@@ -38,6 +39,7 @@ const SystemSettings = () => {
+
diff --git a/src/types/types.ts b/src/types/types.ts
index 9d5cfdf..0c9349a 100644
--- a/src/types/types.ts
+++ b/src/types/types.ts
@@ -423,6 +423,7 @@ export type NPEDSTATE = {
sessionPaused: boolean;
savedSightings: DedupedSightings;
npedUser: NPEDUser;
+ iscatEnabled: CategoryPopups;
};
export type NPEDACTION = {
@@ -430,3 +431,10 @@ export type NPEDACTION = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
payload: any;
};
+
+export type CategoryPopups = {
+ catA: boolean;
+ catB: boolean;
+ catC: boolean;
+ catD: boolean;
+};