import { Field, useFormikContext } from "formik"; import { useOSDConfig } from "../../hooks/useOSDConfig"; import OSDFieldToggle from "./OSDFieldToggle"; import type { OSDConfigFields } from "../../../../types/types"; import { toast } from "sonner"; type OSDFieldsProps = { isOSDLoading: boolean; }; const OSDFields = ({ isOSDLoading }: OSDFieldsProps) => { const { osdMutation } = useOSDConfig(); const { values } = useFormikContext(); 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); if (result?.id) { toast.success("OSD Config updated successfully"); } }; if (isOSDLoading) { return
Loading OSD Options...
; } return (
{includeKeys.map((key) => ( ))}
); }; export default OSDFields;