- starting to add regionPainter to CameraSettings
- updated PlatePatchSetup component layout
This commit is contained in:
@@ -3,6 +3,13 @@ import type { CameraSettings, CameraSettingsAction } from "../../utils/types";
|
|||||||
export const initialState: CameraSettings = {
|
export const initialState: CameraSettings = {
|
||||||
mode: 0,
|
mode: 0,
|
||||||
imageSize: { width: 1280, height: 960 },
|
imageSize: { width: 1280, height: 960 },
|
||||||
|
regionPainter: {
|
||||||
|
paintedCells: [],
|
||||||
|
regions: [
|
||||||
|
{ name: "Region 1", brushColour: "#FF0000", cells: [] },
|
||||||
|
{ name: "Region 2", brushColour: "#00FF00", cells: [] },
|
||||||
|
],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const cameraSettingsReducer = (state: CameraSettings, action: CameraSettingsAction) => {
|
export const cameraSettingsReducer = (state: CameraSettings, action: CameraSettingsAction) => {
|
||||||
|
|||||||
@@ -1,32 +1,39 @@
|
|||||||
|
import CardHeader from "../../../../components/CardHeader";
|
||||||
import Card from "../../../../components/ui/Card";
|
import Card from "../../../../components/ui/Card";
|
||||||
import TimeStampBadge from "../../../../components/ui/TimeStampBadge";
|
|
||||||
import NumberPlate from "../../../dashboard/components/platePatch/NumberPlate";
|
|
||||||
import { useSightingList } from "../../../dashboard/hooks/useSightingList";
|
import { useSightingList } from "../../../dashboard/hooks/useSightingList";
|
||||||
|
|
||||||
const PlatePatchSetup = () => {
|
const PlatePatchSetup = () => {
|
||||||
const { sightingList, isLoading } = useSightingList();
|
const { sightingList, isLoading } = useSightingList();
|
||||||
const firstFourSightings = sightingList?.slice(0, 4);
|
|
||||||
|
|
||||||
if (isLoading) return <>Loading...</>;
|
if (isLoading) return <>Loading...</>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="p-4">
|
<Card className="p-4">
|
||||||
<ul>
|
<CardHeader title="Plates" />
|
||||||
{firstFourSightings?.map((sighting) => (
|
<div className="h-120 overflow-auto">
|
||||||
<li key={sighting.ref}>
|
<table className="w-full text-left text-sm table-auto border-collapse border border-gray-500/50 rounded-md">
|
||||||
<div className="flex flex-col gap-2 mb-2 border border-gray-600 p-2 rounded-lg hover:cursor-pointer hover:bg-[#233241]">
|
<thead className="bg-gray-700/50 text-gray-200 top-0">
|
||||||
<div className="">
|
<tr>
|
||||||
<TimeStampBadge timeStamp={sighting.timeStampMillis} />
|
<th className="px-4 py-3 font-semibold">VRM</th>
|
||||||
</div>
|
|
||||||
<p className="font-semibold text-gray-200">{sighting.vrm}</p>
|
<th className="px-4 py-3 font-semibold text-center">Seen Count</th>
|
||||||
<div className="flex items-center gap-4">
|
<th className="px-4 py-3 font-semibold">Seen</th>
|
||||||
<img src={sighting.plateUrlColour} alt="" width={100} height={100} />
|
<th className="px-4 py-3 font-semibold">Plate</th>
|
||||||
<NumberPlate vrm={sighting.vrm} size="sm" motion={sighting.motion.toLowerCase() === "away"} />
|
</tr>
|
||||||
</div>
|
</thead>
|
||||||
</div>
|
<tbody>
|
||||||
</li>
|
{sightingList?.map((sighting) => (
|
||||||
))}
|
<tr key={sighting.vrm} className="border-b border-gray-700/50 hover:bg-gray-700/20">
|
||||||
</ul>
|
<td className="px-4 py-3 font-mono text-lg">{sighting.vrm}</td>
|
||||||
|
<td className="px-4 py-3 text-center">{sighting.seenCount}</td>
|
||||||
|
<td className="px-4 py-3">{sighting.timeStamp}</td>
|
||||||
|
<td className="px-4 py-3">
|
||||||
|
<img src={sighting.plateUrlColour} alt="" width={100} height={100} />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ export type NpedJSON = {
|
|||||||
export type CameraSettings = {
|
export type CameraSettings = {
|
||||||
mode: number;
|
mode: number;
|
||||||
imageSize: { width: number; height: number };
|
imageSize: { width: number; height: number };
|
||||||
|
regionPainter: {
|
||||||
|
paintedCells: { x: number; y: number }[];
|
||||||
|
regions: { name: string; brushColour: string; cells: { x: number; y: number }[] }[];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
export type CameraSettingsAction =
|
export type CameraSettingsAction =
|
||||||
| {
|
| {
|
||||||
|
|||||||
Reference in New Issue
Block a user