fix(toast): fixed sound replay on click

This commit is contained in:
KayJann
2026-06-02 02:18:19 +02:00
parent 88956902a8
commit 98e28154a2
+9 -5
View File
@@ -1,4 +1,4 @@
import { useEffect, useState, useMemo } from "react"; import { useEffect, useState, useMemo, useCallback } from "react";
import { motion, AnimatePresence, MotionConfig } from "framer-motion"; import { motion, AnimatePresence, MotionConfig } from "framer-motion";
import "../css/App.css"; import "../css/App.css";
import HomeView from "../components/views/HomeView"; import HomeView from "../components/views/HomeView";
@@ -68,6 +68,10 @@ export default function App() {
const [showSetup, setShowSetup] = useState(false); const [showSetup, setShowSetup] = useState(false);
const [isSetupChecked, setIsSetupChecked] = useState(false); const [isSetupChecked, setIsSetupChecked] = useState(false);
const displayIsDay = config.isDayTime; const displayIsDay = config.isDayTime;
const clearError = useCallback(() => game.setError(null), [game]);
const clearGameUpdate = useCallback(() => game.setGameUpdateMessage(null), [game]);
const clearSteamSuccess = useCallback(() => game.setSteamSuccessMessage(null), [game]);
useEffect(() => { useEffect(() => {
@@ -179,7 +183,7 @@ export default function App() {
<AchievementToast <AchievementToast
message={game.error} message={game.error}
onClose={() => game.setError(null)} onClose={clearError}
/> />
<AchievementToast <AchievementToast
@@ -197,9 +201,9 @@ export default function App() {
<AchievementToast <AchievementToast
message={game.gameUpdateMessage} message={game.gameUpdateMessage}
onClose={() => game.setGameUpdateMessage(null)} onClose={clearGameUpdate}
onClick={() => { onClick={() => {
game.setGameUpdateMessage(null); clearGameUpdate();
setActiveView("versions"); setActiveView("versions");
}} }}
title="Game Update Available!" title="Game Update Available!"
@@ -208,7 +212,7 @@ export default function App() {
<AchievementToast <AchievementToast
message={game.steamSuccessMessage} message={game.steamSuccessMessage}
onClose={() => game.setSteamSuccessMessage(null)} onClose={clearSteamSuccess}
title="Steam Integration" title="Steam Integration"
variant="steam" variant="steam"
/> />