diff --git a/src/components/HistoryList/AlertItem.tsx b/src/components/HistoryList/AlertItem.tsx index ccae950..cc75e13 100644 --- a/src/components/HistoryList/AlertItem.tsx +++ b/src/components/HistoryList/AlertItem.tsx @@ -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); diff --git a/src/components/SightingModal/SightingModal.tsx b/src/components/SightingModal/SightingModal.tsx index a9fa5b7..81d1c3f 100644 --- a/src/components/SightingModal/SightingModal.tsx +++ b/src/components/SightingModal/SightingModal.tsx @@ -10,7 +10,7 @@ import HotListImg from "/Hotlist_Hit.svg"; 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 SightingModalProps = { isSightingModalOpen: boolean; @@ -68,9 +68,10 @@ const SightingModal = ({ const motionAway = (sighting?.motion ?? "").toUpperCase() === "AWAY"; const isHotListHit = checkIsHotListHit(sighting); - const isNPEDHitA = sighting?.metadata?.npedJSON?.["NPED CATEGORY"] === "A"; - const isNPEDHitB = sighting?.metadata?.npedJSON?.["NPED CATEGORY"] === "B"; - const isNPEDHitC = sighting?.metadata?.npedJSON?.["NPED CATEGORY"] === "C"; + const cat = getNPEDCategory(sighting); + const isNPEDHitA = cat === "A"; + const isNPEDHitB = cat === "B"; + const isNPEDHitC = cat === "C"; return ( <> diff --git a/src/components/SightingsWidget/InfoBar.tsx b/src/components/SightingsWidget/InfoBar.tsx index b19f192..d40e998 100644 --- a/src/components/SightingsWidget/InfoBar.tsx +++ b/src/components/SightingsWidget/InfoBar.tsx @@ -5,8 +5,6 @@ type InfoBarprops = { obj: SightingType; }; const InfoBar = ({ obj }: InfoBarprops) => { - const isNPEDHitD = obj?.metadata?.npedJSON?.["NPED CATEGORY"] === "D"; - return (