diff --git a/src/App.tsx b/src/App.tsx index 8850535..3f101ef 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -378,6 +378,23 @@ const App: React.FC = () => { })); }, [stopAlarm]); + const revertTimer = useCallback(() => { + if (!lastSetTime) return; + + stopAlarm(); + setShowTimeUp(false); + + const restoredTotalSeconds = lastSetTime.minutes * 60 + lastSetTime.seconds; + setTimerState((prev) => ({ + ...prev, + minutes: lastSetTime.minutes, + seconds: lastSetTime.seconds, + timeRemaining: restoredTotalSeconds, + isRunning: false, + isPaused: false + })); + }, [lastSetTime, stopAlarm]); + // F12キーでデベロッパーツールを開く useEffect(() => { const handleKeyDown = async (event: KeyboardEvent) => { @@ -1003,6 +1020,7 @@ const App: React.FC = () => { onStart={startTimer} onPause={pauseTimer} onReset={resetTimer} + onRevertTime={revertTimer} onSettings={openSettings} onHelp={() => setShowHelp(true)} onMinutesChange={(minutes) => diff --git a/src/components/TimerControls.tsx b/src/components/TimerControls.tsx index 4e37cb5..5a7d3f0 100644 --- a/src/components/TimerControls.tsx +++ b/src/components/TimerControls.tsx @@ -9,6 +9,7 @@ const TimerControls: React.FC = ({ onStart, onPause, onReset, + onRevertTime, onSettings, onHelp, onMinutesChange, @@ -278,6 +279,10 @@ const TimerControls: React.FC = ({ + + {/* ボリュームコントローラー */} diff --git a/src/types.ts b/src/types.ts index fd7e49a..644ad96 100644 --- a/src/types.ts +++ b/src/types.ts @@ -33,6 +33,7 @@ export interface TimerControlsProps { onStart: () => void; onPause: () => void; onReset: () => void; + onRevertTime: () => void; onSettings: () => void; onHelp: () => void; onMinutesChange: (minutes: number) => void;