fix(space): Quick Controls 사운드 복원과 HUD 피드백 정합성 수정

This commit is contained in:
2026-03-05 16:24:53 +09:00
parent b1bafd5e9a
commit f3f0518588
5 changed files with 109 additions and 43 deletions

View File

@@ -1,32 +1,17 @@
'use client';
import { useEffect, useRef, useState } from 'react';
import { useToast } from '@/shared/ui';
import {
RECOVERY_30S_BUTTON_LABEL,
RECOVERY_30S_TOAST_MESSAGE,
} from './copy';
const MODE_DURATION_MS = 2000;
const HINT_DURATION_MS = 1800;
export const useRestart30s = () => {
const { pushToast } = useToast();
const [isBreatheMode, setBreatheMode] = useState(false);
const [hintMessage, setHintMessage] = useState<string | null>(null);
const resetTimerRef = useRef<number | null>(null);
const hintTimerRef = useRef<number | null>(null);
const clearTimers = () => {
if (resetTimerRef.current !== null) {
window.clearTimeout(resetTimerRef.current);
resetTimerRef.current = null;
}
if (hintTimerRef.current !== null) {
window.clearTimeout(hintTimerRef.current);
hintTimerRef.current = null;
}
};
useEffect(() => {
@@ -38,16 +23,6 @@ export const useRestart30s = () => {
const triggerRestart = () => {
clearTimers();
setBreatheMode(true);
setHintMessage(RECOVERY_30S_TOAST_MESSAGE);
pushToast({
title: RECOVERY_30S_BUTTON_LABEL,
description: RECOVERY_30S_TOAST_MESSAGE,
});
hintTimerRef.current = window.setTimeout(() => {
setHintMessage(null);
}, HINT_DURATION_MS);
resetTimerRef.current = window.setTimeout(() => {
setBreatheMode(false);
@@ -56,7 +31,6 @@ export const useRestart30s = () => {
return {
isBreatheMode,
hintMessage,
triggerRestart,
};
};