mirror of
https://github.com/remvze/moodist.git
synced 2025-12-17 08:54:13 +00:00
feat: add countdown timer structure
This commit is contained in:
parent
c35409ce0a
commit
c5657d0642
9 changed files with 37 additions and 8 deletions
|
|
@ -7,4 +7,4 @@ export { Pomodoro as PomodoroItem } from './pomodoro';
|
||||||
export { Presets as PresetsItem } from './presets';
|
export { Presets as PresetsItem } from './presets';
|
||||||
export { Shortcuts as ShortcutsItem } from './shortcuts';
|
export { Shortcuts as ShortcutsItem } from './shortcuts';
|
||||||
export { SleepTimer as SleepTimerItem } from './sleep-timer';
|
export { SleepTimer as SleepTimerItem } from './sleep-timer';
|
||||||
export { CountdownTimer as CountdownTimerItem } from './countdown-timer';
|
export { Timer as TimerItem } from './timer';
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ export function SleepTimer({ open }: SleepTimerProps) {
|
||||||
active={active}
|
active={active}
|
||||||
icon={<IoMoonSharp />}
|
icon={<IoMoonSharp />}
|
||||||
label="Sleep Timer"
|
label="Sleep Timer"
|
||||||
shortcut="Shift + T"
|
shortcut="Shift + Alt + T"
|
||||||
onClick={open}
|
onClick={open}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,17 @@ import { MdOutlineTimer } from 'react-icons/md/index';
|
||||||
|
|
||||||
import { Item } from '../item';
|
import { Item } from '../item';
|
||||||
|
|
||||||
export function CountdownTimer() {
|
interface SleepTimerProps {
|
||||||
|
open: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Timer({ open }: SleepTimerProps) {
|
||||||
return (
|
return (
|
||||||
<Item
|
<Item
|
||||||
href="https://timesy.app"
|
|
||||||
icon={<MdOutlineTimer />}
|
icon={<MdOutlineTimer />}
|
||||||
label="Countdown Timer"
|
label="Countdown Timer"
|
||||||
|
shortcut="Shift + T"
|
||||||
|
onClick={open}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -11,17 +11,17 @@ import {
|
||||||
NotepadItem,
|
NotepadItem,
|
||||||
SourceItem,
|
SourceItem,
|
||||||
PomodoroItem,
|
PomodoroItem,
|
||||||
|
TimerItem,
|
||||||
PresetsItem,
|
PresetsItem,
|
||||||
ShortcutsItem,
|
ShortcutsItem,
|
||||||
SleepTimerItem,
|
SleepTimerItem,
|
||||||
CountdownTimerItem,
|
|
||||||
} from './items';
|
} from './items';
|
||||||
import { Divider } from './divider';
|
import { Divider } from './divider';
|
||||||
import { ShareLinkModal } from '@/components/modals/share-link';
|
import { ShareLinkModal } from '@/components/modals/share-link';
|
||||||
import { PresetsModal } from '@/components/modals/presets';
|
import { PresetsModal } from '@/components/modals/presets';
|
||||||
import { ShortcutsModal } from '@/components/modals/shortcuts';
|
import { ShortcutsModal } from '@/components/modals/shortcuts';
|
||||||
import { SleepTimerModal } from '@/components/modals/sleep-timer';
|
import { SleepTimerModal } from '@/components/modals/sleep-timer';
|
||||||
import { Notepad, Pomodoro } from '@/components/toolbox';
|
import { Notepad, Pomodoro, Timer } from '@/components/toolbox';
|
||||||
import { fade, mix, slideY } from '@/lib/motion';
|
import { fade, mix, slideY } from '@/lib/motion';
|
||||||
import { useSoundStore } from '@/stores/sound';
|
import { useSoundStore } from '@/stores/sound';
|
||||||
|
|
||||||
|
|
@ -42,6 +42,7 @@ export function Menu() {
|
||||||
shareLink: false,
|
shareLink: false,
|
||||||
shortcuts: false,
|
shortcuts: false,
|
||||||
sleepTimer: false,
|
sleepTimer: false,
|
||||||
|
timer: false,
|
||||||
}),
|
}),
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|
@ -67,10 +68,11 @@ export function Menu() {
|
||||||
useHotkeys('shift+m', () => setIsOpen(prev => !prev));
|
useHotkeys('shift+m', () => setIsOpen(prev => !prev));
|
||||||
useHotkeys('shift+n', () => open('notepad'));
|
useHotkeys('shift+n', () => open('notepad'));
|
||||||
useHotkeys('shift+p', () => open('pomodoro'));
|
useHotkeys('shift+p', () => open('pomodoro'));
|
||||||
|
useHotkeys('shift+t', () => open('timer'));
|
||||||
useHotkeys('shift+alt+p', () => open('presets'));
|
useHotkeys('shift+alt+p', () => open('presets'));
|
||||||
useHotkeys('shift+h', () => open('shortcuts'));
|
useHotkeys('shift+h', () => open('shortcuts'));
|
||||||
useHotkeys('shift+s', () => open('shareLink'), { enabled: !noSelected });
|
useHotkeys('shift+s', () => open('shareLink'), { enabled: !noSelected });
|
||||||
useHotkeys('shift+t', () => open('sleepTimer'));
|
useHotkeys('shift+alt+t', () => open('sleepTimer'));
|
||||||
|
|
||||||
useCloseListener(closeAll);
|
useCloseListener(closeAll);
|
||||||
|
|
||||||
|
|
@ -111,7 +113,7 @@ export function Menu() {
|
||||||
<Divider />
|
<Divider />
|
||||||
<NotepadItem open={() => open('notepad')} />
|
<NotepadItem open={() => open('notepad')} />
|
||||||
<PomodoroItem open={() => open('pomodoro')} />
|
<PomodoroItem open={() => open('pomodoro')} />
|
||||||
<CountdownTimerItem />
|
<TimerItem open={() => open('timer')} />
|
||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
<ShortcutsItem open={() => open('shortcuts')} />
|
<ShortcutsItem open={() => open('shortcuts')} />
|
||||||
|
|
@ -142,6 +144,7 @@ export function Menu() {
|
||||||
show={modals.pomodoro}
|
show={modals.pomodoro}
|
||||||
onClose={() => close('pomodoro')}
|
onClose={() => close('pomodoro')}
|
||||||
/>
|
/>
|
||||||
|
<Timer show={modals.timer} onClose={() => close('timer')} />
|
||||||
<SleepTimerModal
|
<SleepTimerModal
|
||||||
show={modals.sleepTimer}
|
show={modals.sleepTimer}
|
||||||
onClose={() => close('sleepTimer')}
|
onClose={() => close('sleepTimer')}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,10 @@ export function ShortcutsModal({ onClose, show }: ShortcutsModalProps) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
keys: ['Shift', 'T'],
|
keys: ['Shift', 'T'],
|
||||||
|
label: 'Countdown Timer',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
keys: ['Shift', 'Alt', 'T'],
|
||||||
label: 'Sleep Timer',
|
label: 'Sleep Timer',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
export { Notepad } from './notepad';
|
export { Notepad } from './notepad';
|
||||||
export { Pomodoro } from './pomodoro';
|
export { Pomodoro } from './pomodoro';
|
||||||
|
export { Timer } from './timer';
|
||||||
|
|
|
||||||
1
src/components/toolbox/timer/index.ts
Normal file
1
src/components/toolbox/timer/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export { Timer } from './timer';
|
||||||
1
src/components/toolbox/timer/timer.module.css
Normal file
1
src/components/toolbox/timer/timer.module.css
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
/* WIP */
|
||||||
14
src/components/toolbox/timer/timer.tsx
Normal file
14
src/components/toolbox/timer/timer.tsx
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Modal } from '@/components/modal';
|
||||||
|
|
||||||
|
interface TimerProps {
|
||||||
|
onClose: () => void;
|
||||||
|
show: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Timer({ onClose, show }: TimerProps) {
|
||||||
|
return (
|
||||||
|
<Modal show={show} onClose={onClose}>
|
||||||
|
<h1>Hello World</h1>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue