added Hotlist flag ad tag
This commit is contained in:
@@ -3,6 +3,7 @@ import NumberPlate from "../PlateStack/NumberPlate";
|
|||||||
import SightingModal from "../SightingModal/SightingModal";
|
import SightingModal from "../SightingModal/SightingModal";
|
||||||
import InfoBar from "../SightingsWidget/InfoBar";
|
import InfoBar from "../SightingsWidget/InfoBar";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import HotListImg from "/Hotlist_Hit.svg";
|
||||||
|
|
||||||
type AlertItemProps = {
|
type AlertItemProps = {
|
||||||
item: SightingType;
|
item: SightingType;
|
||||||
@@ -11,7 +12,8 @@ type AlertItemProps = {
|
|||||||
const AlertItem = ({ item }: AlertItemProps) => {
|
const AlertItem = ({ item }: AlertItemProps) => {
|
||||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||||
const motionAway = (item?.motion ?? "").toUpperCase() === "AWAY";
|
const motionAway = (item?.motion ?? "").toUpperCase() === "AWAY";
|
||||||
const isNPEDHit = item?.metadata?.npedJSON?.status_code === 404;
|
// const isNPEDHit = item?.metadata?.npedJSON?.status_code === 404;
|
||||||
|
const isHotListHit = item?.metadata?.hotlistMatches?.Hotlist0 === true;
|
||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
setIsModalOpen(true);
|
setIsModalOpen(true);
|
||||||
@@ -27,7 +29,13 @@ const AlertItem = ({ item }: AlertItemProps) => {
|
|||||||
className=" flex flex-row p-4 border border-gray-400 rounded-lg items-center w-full mx-auto justify-between"
|
className=" flex flex-row p-4 border border-gray-400 rounded-lg items-center w-full mx-auto justify-between"
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
>
|
>
|
||||||
{isNPEDHit && <small className="text-red-500">NPED Hit</small>}
|
{isHotListHit && (
|
||||||
|
<img
|
||||||
|
src={HotListImg}
|
||||||
|
alt="hotlistHit"
|
||||||
|
className="h-20 object-contain rounded-md"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<small>MAKE: {item.make}</small>
|
<small>MAKE: {item.make}</small>
|
||||||
<small>MODEL: {item.model}</small>
|
<small>MODEL: {item.model}</small>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { useSightingFeedContext } from "../../context/SightingFeedContext";
|
|||||||
import SightingModal from "../SightingModal/SightingModal";
|
import SightingModal from "../SightingModal/SightingModal";
|
||||||
// import { useAlertHitContext } from "../../context/AlertHitContext";
|
// import { useAlertHitContext } from "../../context/AlertHitContext";
|
||||||
import InfoBar from "./InfoBar";
|
import InfoBar from "./InfoBar";
|
||||||
|
import HotListImg from "/Hotlist_Hit.svg";
|
||||||
|
|
||||||
function useNow(tickMs = 1000) {
|
function useNow(tickMs = 1000) {
|
||||||
const [, setNow] = useState(() => Date.now());
|
const [, setNow] = useState(() => Date.now());
|
||||||
@@ -102,37 +103,19 @@ export default function SightingHistoryWidget({
|
|||||||
const motionAway = (obj?.motion ?? "").toUpperCase() === "AWAY";
|
const motionAway = (obj?.motion ?? "").toUpperCase() === "AWAY";
|
||||||
const primaryIsColour = obj?.srcCam === 1;
|
const primaryIsColour = obj?.srcCam === 1;
|
||||||
const secondaryMissing = (obj?.vrmSecondary ?? "") === "";
|
const secondaryMissing = (obj?.vrmSecondary ?? "") === "";
|
||||||
|
const isHotListHit =
|
||||||
|
obj?.metadata?.hotlistMatches?.Hotlist0 === true;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={idx}
|
key={idx}
|
||||||
className={`border border-neutral-700 rounded-md mb-2 p-2 cursor-pointer`}
|
className={`border border-neutral-700 rounded-md mb-2 p-2 cursor-pointer`}
|
||||||
onClick={() => onRowClick(obj)}
|
onClick={() => onRowClick(obj)}
|
||||||
>
|
>
|
||||||
{/* Info bar */}
|
|
||||||
<InfoBar obj={obj} />
|
<InfoBar obj={obj} />
|
||||||
|
|
||||||
{/* Patch row */}
|
{/* Patch row */}
|
||||||
<div
|
<div
|
||||||
className={`flex items-center gap-3 mt-2 justify-between
|
className={`flex items-center gap-3 mt-2 justify-between`}
|
||||||
|
|
||||||
`}
|
|
||||||
>
|
>
|
||||||
{obj?.plateUrlInfrared && (
|
|
||||||
<div
|
|
||||||
className={`border p-1 ${
|
|
||||||
primaryIsColour ? "" : "ring-2 ring-lime-400"
|
|
||||||
} ${!obj ? "opacity-30" : ""}`}
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src={obj?.plateUrlInfrared || BLANK_IMG}
|
|
||||||
height={48}
|
|
||||||
alt="infrared patch"
|
|
||||||
className={!primaryIsColour ? "" : "opacity-60"}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className={`border p-1 ${
|
className={`border p-1 ${
|
||||||
primaryIsColour ? "ring-2 ring-lime-400" : ""
|
primaryIsColour ? "ring-2 ring-lime-400" : ""
|
||||||
@@ -149,6 +132,13 @@ export default function SightingHistoryWidget({
|
|||||||
className={primaryIsColour ? "" : "opacity-60"}
|
className={primaryIsColour ? "" : "opacity-60"}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{isHotListHit && (
|
||||||
|
<img
|
||||||
|
src={HotListImg}
|
||||||
|
alt="hotlistHit"
|
||||||
|
className="h-20 object-contain rounded-md"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<NumberPlate motion={motionAway} vrm={obj?.vrm} />
|
<NumberPlate motion={motionAway} vrm={obj?.vrm} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user