import type { SightingType } from "../../types/types"; import NumberPlate from "../PlateStack/NumberPlate"; import SightingModal from "../SightingModal/SightingModal"; import InfoBar from "../SightingsWidget/InfoBar"; import { useState } from "react"; import HotListImg from "/Hotlist_Hit.svg"; import { useAlertHitContext } from "../../context/AlertHitContext"; 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"; type AlertItemProps = { item: SightingType; }; const AlertItem = ({ item }: AlertItemProps) => { const [isModalOpen, setIsModalOpen] = useState(false); const { dispatch } = useAlertHitContext(); // const {d} = useCameraBlackboard(); const motionAway = (item?.motion ?? "").toUpperCase() === "AWAY"; // [34].metadata.hotlistMatches["MAV_Hotlist.csv"] //check if true is in any hotlist property const isHotListHit = item?.metadata?.hotlistMatches?.Hotlist0 === true; 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 handleClick = () => { setIsModalOpen(true); }; const closeModal = () => { setIsModalOpen(false); }; const handleDelete = () => { dispatch({ type: "REMOVE", payload: item }); }; return (
{isHotListHit && ( hotlistHit )} {isNPEDHitA && ( hotlistHit )} {isNPEDHitB && ( hotlistHit )} {isNPEDHitC && ( hotlistHit )}
MAKE: {item.make} MODEL: {item.model} COLOUR: {item.color}
); }; export default AlertItem;