mirror of
https://github.com/R0m1k3/noteflow.git
synced 2026-10-21 14:18:15 +02:00
fix: persister l'état du Pomodoro Timer avec localStorage
- Sauvegarder l'état du timer (mode, temps restant, état running, sessions) dans localStorage - Restaurer l'état au montage du composant - Le timer ne se réinitialise plus quand le modal se ferme et se rouvre - Simplifier le PomodoroModal pour utiliser children directement
This commit is contained in:
3 files changed
+44
-11
No files matched your search
@@ -1,18 +1,18 @@
|
||||
import { ReactNode } from "react";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog";
|
||||
import { PomodoroTimer } from "./PomodoroTimer";
|
||||
|
||||
interface PomodoroModalProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
onTimerStateChange?: (isRunning: boolean, timeLeft: number, mode: string) => void;
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
export function PomodoroModal({ open, onOpenChange, onTimerStateChange }: PomodoroModalProps) {
|
||||
export function PomodoroModal({ open, onOpenChange, children }: PomodoroModalProps) {
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="max-w-md">
|
||||
@@ -20,7 +20,7 @@ export function PomodoroModal({ open, onOpenChange, onTimerStateChange }: Pomodo
|
||||
<DialogTitle className="text-2xl">Pomodoro Timer</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div className="mt-4">
|
||||
<PomodoroTimer onStateChange={onTimerStateChange} />
|
||||
{children}
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
Reference in new issue
Block a user