Refactor sound context and update sound settings functionality; remove console logs and improve sound file handling

This commit is contained in:
2025-10-01 15:21:07 +01:00
parent 1b7b2eec37
commit 68e944a6a2
11 changed files with 100 additions and 53 deletions

View File

@@ -1,6 +1,6 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import type { SightingType } from "../../types/types";
import { BLANK_IMG, getSoundFileName } from "../../utils/utils";
import { BLANK_IMG, getSoundFileURL } from "../../utils/utils";
import NumberPlate from "../PlateStack/NumberPlate";
import Card from "../UI/Card";
import CardHeader from "../UI/CardHeader";
@@ -43,8 +43,8 @@ export default function SightingHistoryWidget({
const { state } = useSoundContext();
const soundSrc = useMemo(() => {
return getSoundFileName(state.sightingSound) ?? popup;
}, [state.sightingSound]);
return getSoundFileURL(state.NPEDsound) ?? popup;
}, [state.NPEDsound]);
const { play } = useSound(soundSrc);
const {