Skip to content

Commit

Permalink
Merged PR 4366: Fixed setVolume call
Browse files Browse the repository at this point in the history
Fixed setVolume call
  • Loading branch information
silimarius committed Jun 14, 2023
1 parent a1ca295 commit 06239b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions frontend/src/components/top-navigation/top-navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ export type ActiveDropdown = "rules" | "menu" | "sound" | undefined;
export const TopNavigation: FC<Props> = ({ location }) => {
const [activeDropdown, setActiveDropdown] = useState<ActiveDropdown>();
const [isComponentVisible, setIsComponentVisible] = useState(false);
const masterVolume = useStore((state) => state.masterVolume);
const setVolume = useChangeVolume();
const ref = useRef(null);

const { setVolume, masterVolume } = useChangeVolume();

const isMobile = useIsMobile();
const ref = useRef(null);

const handleDropdownClick = (dropdown: ActiveDropdown) => {
if (activeDropdown === dropdown) {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/hooks/use-sound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const audioContext = new AudioContext();
const masterGainNode = audioContext.createGain();

export const useChangeVolume = () => {
const { masterVolume, setMasterVolume } = useStore();
const masterVolume = useStore((state) => state.masterVolume);
const setMasterVolume = useStore((state) => state.setMasterVolume);

useEffect(() => {
masterGainNode.gain.setValueAtTime(masterVolume, 0);
Expand Down

0 comments on commit 06239b3

Please sign in to comment.