mirror of
https://github.com/remvze/moodist.git
synced 2025-12-18 09:24: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 styles from './menu.module.css';
|
||||||
import { useCloseListener } from '@/hooks/use-close-listener';
|
import { useCloseListener } from '@/hooks/use-close-listener';
|
||||||
|
import { closeModals } from '@/lib/modal';
|
||||||
|
|
||||||
export function Menu() {
|
export function Menu() {
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
|
@ -56,6 +57,7 @@ export function Menu() {
|
||||||
(name: string) => {
|
(name: string) => {
|
||||||
closeAll();
|
closeAll();
|
||||||
setIsOpen(false);
|
setIsOpen(false);
|
||||||
|
closeModals();
|
||||||
setModals(prev => ({ ...prev, [name]: true }));
|
setModals(prev => ({ ...prev, [name]: true }));
|
||||||
},
|
},
|
||||||
[closeAll],
|
[closeAll],
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import { Setting } from './setting';
|
||||||
import { useLocalStorage } from '@/hooks/use-local-storage';
|
import { useLocalStorage } from '@/hooks/use-local-storage';
|
||||||
import { useSoundEffect } from '@/hooks/use-sound-effect';
|
import { useSoundEffect } from '@/hooks/use-sound-effect';
|
||||||
import { usePomodoroStore } from '@/store';
|
import { usePomodoroStore } from '@/store';
|
||||||
|
import { useCloseListener } from '@/hooks/use-close-listener';
|
||||||
|
|
||||||
import styles from './pomodoro.module.css';
|
import styles from './pomodoro.module.css';
|
||||||
|
|
||||||
|
|
@ -62,6 +63,8 @@ export function Pomodoro({ onClose, open, show }: PomodoroProps) {
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useCloseListener(() => setShowSetting(false));
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (running) {
|
if (running) {
|
||||||
if (interval.current) clearInterval(interval.current);
|
if (interval.current) clearInterval(interval.current);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue