- refactored fetching NPED Category

This commit is contained in:
2025-10-14 08:50:06 +01:00
parent 666b90d078
commit 7121809a9e
4 changed files with 12 additions and 18 deletions

View File

@@ -9,7 +9,7 @@ import { useCameraBlackboard } from "../../hooks/useCameraBlackboard";
import NPED_CAT_A from "/NPED_Cat_A.svg";
import NPED_CAT_B from "/NPED_Cat_B.svg";
import NPED_CAT_C from "/NPED_Cat_C.svg";
import { checkIsHotListHit } from "../../utils/utils";
import { checkIsHotListHit, getNPEDCategory } from "../../utils/utils";
type AlertItemProps = {
item: SightingType;
@@ -24,9 +24,10 @@ const AlertItem = ({ item }: AlertItemProps) => {
const motionAway = (item?.motion ?? "").toUpperCase() === "AWAY";
const isHotListHit = checkIsHotListHit(item);
const isNPEDHitA = item?.metadata?.npedJSON?.["NPED CATEGORY"] === "A";
const isNPEDHitB = item?.metadata?.npedJSON?.["NPED CATEGORY"] === "B";
const isNPEDHitC = item?.metadata?.npedJSON?.["NPED CATEGORY"] === "C";
const cat = getNPEDCategory(item);
const isNPEDHitA = cat === "A";
const isNPEDHitB = cat === "B";
const isNPEDHitC = cat === "C";
const handleClick = () => {
setIsModalOpen(true);