last adjustments

This commit is contained in:
LionTion committed 2026-10-24 05:41:08 +02:00
1 parent 4bcce765b7
commit c08e3bed57
4 files changed
+28 -46

No files matched your search

+23 -12
View File
@@ -40,6 +40,7 @@ export default function Riddle_6({
const [isHeartFast, setIsHeartFast] = useState(true);
const closePopupRef = useRef<(() => void) | null>(null);
const heartFastTimerRef = useRef<NodeJS.Timeout | null>(null);
const popupTimerRef = useRef<NodeJS.Timeout | null>(null);
const voiceOverModeRef = useRef(voiceOverMode);
useEffect(() => {
@@ -47,22 +48,32 @@ export default function Riddle_6({
}, [voiceOverMode]);
const handleClosePopup = () => {
if (closePopupRef.current) {
closePopupRef.current();
} else {
setPopupData(null);
}
};
if (popupTimerRef.current) {
clearTimeout(popupTimerRef.current);
popupTimerRef.current = null;
}
if (closePopupRef.current) {
closePopupRef.current();
} else {
setPopupData(null);
}
};
useEffect(() => {
if (!popupData || voiceOverMode === "on") return;
if (!popupData) return;
const timer = setTimeout(() => {
handleClosePopup();
}, 9000);
popupTimerRef.current = setTimeout(() => {
handleClosePopup();
}, 15000);
return () => clearTimeout(timer);
}, [popupData, voiceOverMode]);
return () => {
if (popupTimerRef.current) {
clearTimeout(popupTimerRef.current);
popupTimerRef.current = null;
}
};
}, [popupData]);
useEffect(() => {
if (page !== 2 || mode === 'won') return;