- added state to set sound set settings for sightings and NPED hits

- added function to save mute settings
This commit is contained in:
2025-10-08 11:08:41 +01:00
parent a20a0c7019
commit 40909d48b6
8 changed files with 59 additions and 17 deletions

View File

@@ -1,13 +1,25 @@
import { faVolumeHigh, faVolumeXmark } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useSoundEnabled } from "react-sounds";
import { useCameraBlackboard } from "../../hooks/useCameraBlackboard";
import { useEffect } from "react";
const SoundBtn = () => {
const { mutation, query } = useCameraBlackboard();
const [enabled, setEnabled] = useSoundEnabled();
const handleClick = () => {
setEnabled(!enabled);
const handleClick = async () => {
const newEnabled = !enabled;
setEnabled(newEnabled);
await mutation.mutateAsync({
operation: "INSERT",
path: "soundEnabled",
value: { enabled: newEnabled },
});
};
useEffect(() => {
setEnabled(query?.data?.soundEnabled?.enabled);
}, [query?.data?.soundEnabled?.enabled, setEnabled]);
return (
<button onClick={handleClick}>