mirror of
https://github.com/remvze/moodist.git
synced 2025-12-17 00:44:14 +00:00
fix: close all modals
This commit is contained in:
parent
6ce766af47
commit
f025213ef2
2 changed files with 5 additions and 0 deletions
|
|
@ -26,6 +26,7 @@ import { useSoundStore } from '@/store';
|
|||
|
||||
import styles from './menu.module.css';
|
||||
import { useCloseListener } from '@/hooks/use-close-listener';
|
||||
import { closeModals } from '@/lib/modal';
|
||||
|
||||
export function Menu() {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
|
@ -56,6 +57,7 @@ export function Menu() {
|
|||
(name: string) => {
|
||||
closeAll();
|
||||
setIsOpen(false);
|
||||
closeModals();
|
||||
setModals(prev => ({ ...prev, [name]: true }));
|
||||
},
|
||||
[closeAll],
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import { Setting } from './setting';
|
|||
import { useLocalStorage } from '@/hooks/use-local-storage';
|
||||
import { useSoundEffect } from '@/hooks/use-sound-effect';
|
||||
import { usePomodoroStore } from '@/store';
|
||||
import { useCloseListener } from '@/hooks/use-close-listener';
|
||||
|
||||
import styles from './pomodoro.module.css';
|
||||
|
||||
|
|
@ -62,6 +63,8 @@ export function Pomodoro({ onClose, open, show }: PomodoroProps) {
|
|||
[],
|
||||
);
|
||||
|
||||
useCloseListener(() => setShowSetting(false));
|
||||
|
||||
useEffect(() => {
|
||||
if (running) {
|
||||
if (interval.current) clearInterval(interval.current);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue