diff --git a/package.json b/package.json index 4fb3a8a..04ad3bf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "in-car-system-fe", "private": true, - "version": "1.0.28", + "version": "1.0.29", "type": "module", "scripts": { "dev": "vite", diff --git a/src/components/SettingForms/Sound/SoundSettingsFields.tsx b/src/components/SettingForms/Sound/SoundSettingsFields.tsx index bbd3e93..afbb4bf 100644 --- a/src/components/SettingForms/Sound/SoundSettingsFields.tsx +++ b/src/components/SettingForms/Sound/SoundSettingsFields.tsx @@ -1,4 +1,4 @@ -import { Field, Form, Formik } from "formik"; +import { Field, FieldArray, Form, Formik } from "formik"; import FormGroup from "../components/FormGroup"; import type { FormValues, Hotlist } from "../../../types/types"; import { useSoundContext } from "../../../context/SoundContext"; @@ -10,6 +10,15 @@ const SoundSettingsFields = () => { const { state, dispatch } = useSoundContext(); const { mutation } = useCameraBlackboard(); + const hotlistsoundMapKeys = Array.from(state.hotlistSoundMap.entries()); + + const hotlistsoundMapValues = hotlistsoundMapKeys.map(([key, value]) => { + return { key, value }; + }); + + console.log(hotlistsoundMapValues); + console.log(hotlistsoundMapKeys); + const hotlists: Hotlist[] = state.hotlists; const soundOptions = state?.soundOptions?.map((soundOption) => ({ @@ -25,12 +34,15 @@ const SoundSettingsFields = () => { }; const handleSubmit = async (values: FormValues) => { + console.log(values); const updatedValues = { ...values, sightingVolume: state.sightingVolume, NPEDsoundVolume: state.NPEDsoundVolume, hotlistSoundVolume: state.hotlistSoundVolume, soundOptions: [...(state.soundOptions ?? [])], + hotlists: [...(values.hotlists ?? [])], + hotlistSoundMap: { ...state.hotlistSoundMap }, }; dispatch({ type: "UPDATE", payload: updatedValues }); @@ -50,9 +62,11 @@ const SoundSettingsFields = () => { toast.success("Sound Settings successfully updated"); } }; + + console.log(state); return ( - {() => ( + {({ values }) => (
@@ -109,7 +123,7 @@ const SoundSettingsFields = () => {
- {/* + ( @@ -140,7 +154,7 @@ const SoundSettingsFields = () => { )} /> - */} +