updated preview camera view and removed NPED alert disptach

This commit is contained in:
2025-09-19 10:55:36 +01:00
parent 9a56392876
commit 047251756e
4 changed files with 30 additions and 29 deletions

2
.env
View File

@@ -10,3 +10,5 @@ VITE_AGX_BOX_REAR_URL=http://192.168.0.90:8080/SightingListRear/sightingSummary?
VITE_AGX=http://100.72.72.70:8080/SightingListRear/sightingSummary?mostRecentRef= VITE_AGX=http://100.72.72.70:8080/SightingListRear/sightingSummary?mostRecentRef=
VITE_AGX_FRONT=http://100.72.72.70:8080/SightingListFront/sightingSummary?mostRecentRef= VITE_AGX_FRONT=http://100.72.72.70:8080/SightingListFront/sightingSummary?mostRecentRef=
VITE_AGX_FRONT_BASE=http://100.72.72.70:8080/

View File

@@ -43,18 +43,21 @@ const SightingModal = ({
Sighting Details Sighting Details
</h2> </h2>
</div> </div>
<div className="flex flex-col md:flex-row gap-3 items-center mb-2"> <div className="flex flex-col md:flex-row gap-3 items-center mb-2 justify-between">
<div className="flex flex-col md:flex-row gap-3 items-center">
<NumberPlate vrm={sighting?.vrm} motion={motionAway} /> <NumberPlate vrm={sighting?.vrm} motion={motionAway} />
<img <img
src={sighting?.plateUrlColour} src={sighting?.plateUrlColour}
alt="plate patch" alt="plate patch"
className="h-16 object-contain rounded-md" className="h-16 object-contain rounded-md"
/> />
</div>
{isHotListHit && ( {isHotListHit && (
<img <img
src={HotListImg} src={HotListImg}
alt="hotlistHit" alt="hotlistHit"
className="h-18 object-contain rounded-md" className="h-20 object-contain rounded-md"
/> />
)} )}
</div> </div>

View File

@@ -7,7 +7,7 @@ import CardHeader from "../UI/CardHeader";
import clsx from "clsx"; import clsx from "clsx";
import { useSightingFeedContext } from "../../context/SightingFeedContext"; 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";
function useNow(tickMs = 1000) { function useNow(tickMs = 1000) {
@@ -44,7 +44,7 @@ export default function SightingHistoryWidget({
selectedSighting, selectedSighting,
} = useSightingFeedContext(); } = useSightingFeedContext();
const { dispatch } = useAlertHitContext(); // const { dispatch } = useAlertHitContext();
const hasAutoOpenedRef = useRef(false); const hasAutoOpenedRef = useRef(false);
@@ -62,18 +62,18 @@ export default function SightingHistoryWidget({
[sightings] [sightings]
); );
useEffect(() => { // useEffect(() => {
rows?.forEach((obj) => { // rows?.forEach((obj) => {
const isNPEDHit = obj?.metadata?.npedJSON?.status_code === 404; // const isNPEDHit = obj?.metadata?.npedJSON?.status_code === 404;
if (isNPEDHit) { // if (isNPEDHit) {
dispatch({ // dispatch({
type: "ADD", // type: "ADD",
payload: obj, // payload: obj,
}); // });
} // }
}); // });
}, [rows, dispatch]); // }, [rows, dispatch]);
useEffect(() => { useEffect(() => {
if (hasAutoOpenedRef.current) return; if (hasAutoOpenedRef.current) return;

View File

@@ -1,14 +1,10 @@
import { useRef, useCallback, useEffect } from "react"; import { useRef, useCallback, useEffect } from "react";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
const apiUrl = import.meta.env.VITE_BASEURL; const apiUrl = import.meta.env.VITE_AGX_FRONT_BASE;
const folkstoneUrl = import.meta.env.VITE_FOLKESTONE_BASE;
console.log(folkstoneUrl);
async function fetchSnapshot(cameraSide: string) { async function fetchSnapshot(cameraSide: string) {
const response = await fetch( const response = await fetch(`${apiUrl}/${cameraSide}-preview`);
// `${folkstoneUrl}/Colour-preview`
`${apiUrl}/${cameraSide}-preview`
);
if (!response.ok) { if (!response.ok) {
throw new Error("Cannot reach endpoint"); throw new Error("Cannot reach endpoint");
} }