- uploaded files seems to work on desktop version
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import type { HitKind, QueuedHit, ReducedSightingType, SightingType } from "../../types/types";
|
||||
import { BLANK_IMG, getSoundFileURL } from "../../utils/utils";
|
||||
import { BLANK_IMG } from "../../utils/utils";
|
||||
import NumberPlate from "../PlateStack/NumberPlate";
|
||||
import Card from "../UI/Card";
|
||||
import CardHeader from "../UI/CardHeader";
|
||||
@@ -19,6 +19,7 @@ import { useIntegrationsContext } from "../../context/IntegrationsContext";
|
||||
import { useSoundContext } from "../../context/SoundContext";
|
||||
import Loading from "../UI/Loading";
|
||||
import { checkIsHotListHit, getNPEDCategory } from "../../utils/utils";
|
||||
import { useCachedSoundSrc } from "../../hooks/usecachedSoundSrc";
|
||||
|
||||
function useNow(tickMs = 1000) {
|
||||
const [, setNow] = useState(() => Date.now());
|
||||
@@ -43,21 +44,8 @@ export default function SightingHistoryWidget({ className, title }: SightingHist
|
||||
useNow(1000);
|
||||
const { state } = useSoundContext();
|
||||
|
||||
const soundSrcNped = useMemo(() => {
|
||||
if (state?.NPEDsound?.includes(".mp3") || state.NPEDsound?.includes(".wav")) {
|
||||
const file = state.soundOptions?.find((item) => item.name === state.NPEDsound);
|
||||
return file?.soundUrl ?? popup;
|
||||
}
|
||||
return getSoundFileURL(state.NPEDsound) ?? popup;
|
||||
}, [state.NPEDsound, state.soundOptions]);
|
||||
|
||||
const soundSrcHotlist = useMemo(() => {
|
||||
if (state?.hotlistSound?.includes(".mp3") || state.hotlistSound?.includes(".wav")) {
|
||||
const file = state.soundOptions?.find((item) => item.name === state.hotlistSound);
|
||||
return file?.soundUrl ?? notification;
|
||||
}
|
||||
return getSoundFileURL(state?.hotlistSound) ?? notification;
|
||||
}, [state.hotlistSound, state.soundOptions]);
|
||||
const { src: soundSrcHotlist } = useCachedSoundSrc(state?.hotlistSound, notification);
|
||||
const { src: soundSrcNped } = useCachedSoundSrc(state?.NPEDsound, popup);
|
||||
|
||||
const { play: npedSound } = useSound(soundSrcNped, { volume: state.NPEDsoundVolume });
|
||||
const { play: hotlistsound } = useSound(soundSrcHotlist, { volume: state.hotlistSoundVolume });
|
||||
@@ -181,8 +169,8 @@ export default function SightingHistoryWidget({ className, title }: SightingHist
|
||||
if (!isSightingModalOpen && modalQueue.length > 0) {
|
||||
const next = modalQueue[0];
|
||||
|
||||
// if (next.kind === "NPED") npedSound();
|
||||
// else hotlistsound();
|
||||
if (next.kind === "NPED") npedSound();
|
||||
else hotlistsound();
|
||||
|
||||
setSelectedSighting(next.sighting);
|
||||
setSightingModalOpen(true);
|
||||
|
||||
Reference in New Issue
Block a user