- added sounds for all hotlist sounds

This commit is contained in:
2025-10-20 11:32:45 +01:00
parent a152c15ec7
commit 0867b3b743
5 changed files with 63 additions and 18 deletions

View File

@@ -1,4 +1,4 @@
import { Field, FieldArray, Form, Formik } from "formik";
import { Field, Form, Formik } from "formik";
import FormGroup from "../components/FormGroup";
import type { FormValues, Hotlist } from "../../../types/types";
import { useSoundContext } from "../../../context/SoundContext";
@@ -13,13 +13,14 @@ const SoundSettingsFields = () => {
const hotlists: Hotlist[] = state.hotlists;
const soundOptions = state?.soundOptions?.map((soundOption) => ({
value: soundOption?.soundFile,
value: soundOption?.soundFileName,
label: soundOption?.name,
}));
const initialValues: FormValues = {
sightingSound: state.sightingSound ?? "switch",
NPEDsound: state.NPEDsound ?? "popup",
hotlistSound: state.hotlistSound ?? "notification",
hotlists,
};
@@ -28,6 +29,7 @@ const SoundSettingsFields = () => {
...values,
sightingVolume: state.sightingVolume,
NPEDsoundVolume: state.NPEDsoundVolume,
hotlistSoundVolume: state.hotlistSoundVolume,
};
dispatch({ type: "UPDATE", payload: updatedValues });
@@ -44,7 +46,7 @@ const SoundSettingsFields = () => {
};
return (
<Formik initialValues={initialValues} onSubmit={handleSubmit}>
{({ values }) => (
{() => (
<Form className="flex flex-col space-y-3">
<FormGroup>
<div className="flex flex-col md:flex-row space-y-2 w-full justify-between gap-3">
@@ -85,6 +87,23 @@ const SoundSettingsFields = () => {
<div>
<h3 className="text-lg font-semibold mb-2">Hotlist Sounds</h3>
<FormGroup>
<div className="flex flex-col md:flex-row space-y-2 w-full justify-between gap-3">
<label htmlFor="hotlistSound">All hotlist Sounds</label>
<Field
as="select"
name="hotlistSound"
className="p-2 border border-gray-400 rounded-lg text-white bg-[#253445] w-full md:w-60"
>
{soundOptions?.map(({ value, label }) => (
<option key={value} value={value}>
{label}
</option>
))}
</Field>
<SliderComponent soundCategory="HOTLISTVOLUME" />
</div>
</FormGroup>
{/* <FormGroup>
<FieldArray
name="hotlists"
render={() => (
@@ -115,7 +134,7 @@ const SoundSettingsFields = () => {
</div>
)}
/>
</FormGroup>
</FormGroup> */}
</div>
<button
type="submit"