diff --git a/package.json b/package.json index a56f708..520161d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "bayiq-ui", "private": true, - "version": "1.0.1", + "version": "1.0.3", "type": "module", "scripts": { "dev": "vite", diff --git a/src/features/cameras/components/CameraSettings/RegionSelector.tsx b/src/features/cameras/components/CameraSettings/RegionSelector.tsx index 2577341..99058fc 100644 --- a/src/features/cameras/components/CameraSettings/RegionSelector.tsx +++ b/src/features/cameras/components/CameraSettings/RegionSelector.tsx @@ -48,7 +48,6 @@ const RegionSelector = ({ const getMagnificationLevel = () => { const test = socket?.data; if (!socket?.data) return null; - console.log(test); if (!test || !test.magnificationLevel) return "1x"; return test?.magnificationLevel; }; diff --git a/src/features/cameras/hooks/useCameraZoom.ts b/src/features/cameras/hooks/useCameraZoom.ts index 1fe6c1e..56a166c 100644 --- a/src/features/cameras/hooks/useCameraZoom.ts +++ b/src/features/cameras/hooks/useCameraZoom.ts @@ -23,7 +23,6 @@ const postZoomLevel = async (zoomConfig: CameraZoomConfig) => { id: `Camera${zoomConfig.cameraFeedID}-onvif-controller`, fields, }; - console.log(zoomPayload); const response = await fetch(`${CAMBASE}/api/update-config`, { method: "POST", body: JSON.stringify(zoomPayload), diff --git a/src/features/output/components/OSDFieldToggle.tsx b/src/features/output/components/OSD/OSDFieldToggle.tsx similarity index 100% rename from src/features/output/components/OSDFieldToggle.tsx rename to src/features/output/components/OSD/OSDFieldToggle.tsx diff --git a/src/features/output/components/OSDFields.tsx b/src/features/output/components/OSD/OSDFields.tsx similarity index 84% rename from src/features/output/components/OSDFields.tsx rename to src/features/output/components/OSD/OSDFields.tsx index c4a3928..7534608 100644 --- a/src/features/output/components/OSDFields.tsx +++ b/src/features/output/components/OSD/OSDFields.tsx @@ -1,7 +1,7 @@ import { Field, useFormikContext } from "formik"; -import { useOSDConfig } from "../hooks/useOSDConfig"; +import { useOSDConfig } from "../../hooks/useOSDConfig"; import OSDFieldToggle from "./OSDFieldToggle"; -import type { OSDConfigFields } from "../../../types/types"; +import type { OSDConfigFields } from "../../../../types/types"; import { toast } from "sonner"; type OSDFieldsProps = { @@ -12,7 +12,16 @@ const OSDFields = ({ isOSDLoading }: OSDFieldsProps) => { const { osdMutation } = useOSDConfig(); const { values } = useFormikContext(); - const includeKeys = Object.keys(values as OSDConfigFields).filter((value) => value.includes("include")); + const validOSDKeys: Array = [ + "includeVRM", + "includeMotion", + "includeTimeStamp", + "includeCameraName", + "overlayPosition", + "OSDTimestampFormat", + ]; + + const includeKeys = validOSDKeys.filter((key) => key.includes("include") && typeof values[key] === "boolean"); const handleSubmit = async (values: OSDConfigFields) => { const result = await osdMutation.mutateAsync(values); diff --git a/src/features/output/components/OSDOptionsCard.tsx b/src/features/output/components/OSD/OSDOptionsCard.tsx similarity index 74% rename from src/features/output/components/OSDOptionsCard.tsx rename to src/features/output/components/OSD/OSDOptionsCard.tsx index dc0f924..6888a3b 100644 --- a/src/features/output/components/OSDOptionsCard.tsx +++ b/src/features/output/components/OSD/OSDOptionsCard.tsx @@ -1,5 +1,6 @@ -import Card from "../../../ui/Card"; -import CardHeader from "../../../ui/CardHeader"; +import Card from "../../../../ui/Card"; +import CardHeader from "../../../../ui/CardHeader"; +import PayloadOptions from "../PayloadOptions/PayloadOptions"; import OSDFields from "./OSDFields"; import { Tab, TabList, TabPanel, Tabs } from "react-tabs"; import "react-tabs/style/react-tabs.css"; @@ -15,13 +16,13 @@ const OSDOptionsCard = ({ isOSDLoading }: OSDOptionsCardProps) => { OSD Settings - payload Settings + Payload Settings -
payload settings
+
diff --git a/src/features/output/components/OutputForms.tsx b/src/features/output/components/OutputForms.tsx index 58faa66..2dd9119 100644 --- a/src/features/output/components/OutputForms.tsx +++ b/src/features/output/components/OutputForms.tsx @@ -6,7 +6,7 @@ import { usePostBearerConfig } from "../hooks/useBearer"; import { useDispatcherConfig } from "../hooks/useDispatcherConfig"; import { useOptionalConstants } from "../hooks/useOptionalConstants"; import { useCustomFields } from "../hooks/useCustomFields"; -import OSDOptionsCard from "./OSDOptionsCard"; +import OSDOptionsCard from "./OSD/OSDOptionsCard"; import { useOSDConfig } from "../hooks/useOSDConfig"; const OutputForms = () => { @@ -89,6 +89,39 @@ const OutputForms = () => { includeCameraName: includeCameraName ?? false, overlayPosition: overlayPosition ?? "Top", OSDTimestampFormat: OSDTimestampFormat ?? "UTC", + + // payload ooptions + includeMac: false, + includeSaFID: false, + includeCharHeight: false, + includeConfidence: false, + includeCorrectSpacing: false, + includeDecodeID: false, + includeDirection: false, + includeFrameHeight: false, + includeFrameID: false, + includeFrameTimeRef: false, + includeFrameWidth: false, + includeHorizSlew: false, + inclduePlate: false, + includeNightModeAction: false, + includeOverview: false, + includePlateSecondary: false, + includePlateTrack: false, + includePlateTrackSecondary: false, + includePreferredCountry: false, + includeRawReads: false, + includeRawREADSSecondary: false, + includeRef: false, + includeSeenCount: false, + includeRepeatedPlate: false, + includeSerialCount: false, + includeTraceCount: false, + includeTrack: false, + includeTrackSecondary: false, + includeVertSlew: false, + includeVRMSecondary: false, + includeHotListMatches: false, }; const handleSubmit = async (values: FormTypes) => { diff --git a/src/features/output/components/PayloadOptions/PayloadOptions.tsx b/src/features/output/components/PayloadOptions/PayloadOptions.tsx new file mode 100644 index 0000000..dc1c834 --- /dev/null +++ b/src/features/output/components/PayloadOptions/PayloadOptions.tsx @@ -0,0 +1,56 @@ +import { useFormikContext } from "formik"; +import type { PayloadConfigFields } from "../../../../types/types"; +import PayloadOptionsToggle from "./PayloadOptionsToggle"; + +const PayloadOptions = () => { + const { values } = useFormikContext(); + + const validPayloadKeys: Array = [ + "includeMac", + "includeSaFID", + "includeCharHeight", + "includeConfidence", + "includeCorrectSpacing", + "includeDecodeID", + "includeDirection", + "includeFrameHeight", + "includeFrameID", + "includeFrameTimeRef", + "includeFrameWidth", + "includeHorizSlew", + "inclduePlate", + "includeNightModeAction", + "includeOverview", + "includePlateSecondary", + "includePlateTrack", + ]; + + const includeKeys = validPayloadKeys.filter((key) => key.includes("include") && typeof values[key] === "boolean"); + + const handleSubmit = async (values: PayloadConfigFields) => { + console.log("Payload Config Submitted:", values); + }; + + return ( +
+
+
+
+ {includeKeys.map((key, index) => ( + + ))} +
+ +
+
+
+ ); +}; + +export default PayloadOptions; diff --git a/src/features/output/components/PayloadOptions/PayloadOptionsToggle.tsx b/src/features/output/components/PayloadOptions/PayloadOptionsToggle.tsx new file mode 100644 index 0000000..8101f8c --- /dev/null +++ b/src/features/output/components/PayloadOptions/PayloadOptionsToggle.tsx @@ -0,0 +1,22 @@ +import { Field } from "formik"; + +type PayloadOptionsToggleProps = { + label: string; + value: string; +}; + +const PayloadOptionsToggle = ({ label, value }: PayloadOptionsToggleProps) => { + return ( +