From 80bcae6fd5cb1ef248e102a76187bd874b18bc9e Mon Sep 17 00:00:00 2001 From: Toba Ojo Date: Fri, 16 Jan 2026 15:42:52 +0000 Subject: [PATCH] - got to a good place on individual hotlist sounds --- package.json | 2 +- .../Sound/SoundSettingsFields.tsx | 22 +++++++-- .../SightingsWidget/SightingWidget.tsx | 46 +++++++++++++++++-- src/components/UI/HotlistSoundPlayer.tsx | 32 +++++++++++++ .../providers/SoundContextProvider.tsx | 22 +++++++++ src/context/reducers/SoundContextReducer.ts | 23 ++++++++-- src/hooks/useHotlistSounds.ts | 7 +++ src/hooks/useSightingFeed.ts | 1 - src/types/types.ts | 21 ++++++++- src/utils/config.ts | 2 +- src/utils/utils.ts | 19 +++++++- vite.config.ts | 2 +- 12 files changed, 182 insertions(+), 17 deletions(-) create mode 100644 src/components/UI/HotlistSoundPlayer.tsx create mode 100644 src/hooks/useHotlistSounds.ts 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 = () => { )} /> - */} +