mirror of
https://github.com/remvze/moodist.git
synced 2025-12-20 02:14:14 +00:00
feat: change shortcuts
This commit is contained in:
parent
716fbca0f6
commit
cb37b08d37
5 changed files with 22 additions and 28 deletions
|
|
@ -11,7 +11,7 @@ export function Presets({ open }: PresetsProps) {
|
|||
<Item
|
||||
icon={<RiPlayListFill />}
|
||||
label="Your Presets"
|
||||
shortcut="Shift + P"
|
||||
shortcut="Shift + Alt + P"
|
||||
onClick={open}
|
||||
/>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export function SleepTimer({ open }: SleepTimerProps) {
|
|||
active={active}
|
||||
icon={<IoMoonSharp />}
|
||||
label="Sleep Timer"
|
||||
shortcut="Shift + T"
|
||||
shortcut="Shift + Alt + T"
|
||||
onClick={open}
|
||||
/>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -69,11 +69,14 @@ export function Menu() {
|
|||
);
|
||||
|
||||
useHotkeys('shift+m', () => setIsOpen(prev => !prev));
|
||||
useHotkeys('shift+p', () => open('presets'));
|
||||
useHotkeys('shift+alt+p', () => open('presets'));
|
||||
useHotkeys('shift+h', () => open('shortcuts'));
|
||||
useHotkeys('shift+b', () => open('breathing'));
|
||||
useHotkeys('shift+n', () => open('notepad'));
|
||||
useHotkeys('shift+p', () => open('pomodoro'));
|
||||
useHotkeys('shift+t', () => open('todo'));
|
||||
useHotkeys('shift+s', () => open('shareLink'), { enabled: !noSelected });
|
||||
useHotkeys('shift+t', () => open('sleepTimer'));
|
||||
useHotkeys('shift+alt+t', () => open('sleepTimer'));
|
||||
|
||||
useCloseListener(closeAll);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export function ShortcutsModal({ onClose, show }: ShortcutsModalProps) {
|
|||
label: 'Shortcuts List',
|
||||
},
|
||||
{
|
||||
keys: ['Shift', 'P'],
|
||||
keys: ['Shift', 'Alt', 'P'],
|
||||
label: 'Presets',
|
||||
},
|
||||
{
|
||||
|
|
@ -22,9 +22,21 @@ export function ShortcutsModal({ onClose, show }: ShortcutsModalProps) {
|
|||
label: 'Share Sounds',
|
||||
},
|
||||
{
|
||||
keys: ['Shift', 'T'],
|
||||
keys: ['Shift', 'Alt', 'T'],
|
||||
label: 'Sleep Timer',
|
||||
},
|
||||
{
|
||||
keys: ['Shift', 'N'],
|
||||
label: 'Notepad',
|
||||
},
|
||||
{
|
||||
keys: ['Shift', 'P'],
|
||||
label: 'Pomodoro',
|
||||
},
|
||||
{
|
||||
keys: ['Shift', 'T'],
|
||||
label: 'Todo Checklist',
|
||||
},
|
||||
{
|
||||
keys: ['Shift', 'B'],
|
||||
label: 'Breathing Exercise',
|
||||
|
|
|
|||
|
|
@ -40,32 +40,11 @@ export const usePresetStore = create<PresetStore>()(
|
|||
{
|
||||
merge: (persisted, current) =>
|
||||
merge(current, persisted as Partial<PresetStore>),
|
||||
|
||||
migrate,
|
||||
name: 'moodist-presets',
|
||||
partialize: state => ({ presets: state.presets }),
|
||||
skipHydration: true,
|
||||
storage: createJSONStorage(() => localStorage),
|
||||
version: 1,
|
||||
version: 0,
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
function migrate(persistedState: unknown, version: number) {
|
||||
let persisted = persistedState as Partial<PresetStore>;
|
||||
|
||||
/**
|
||||
* In version 0, presets didn't have an ID
|
||||
*/
|
||||
if (version < 1) {
|
||||
persisted = {
|
||||
...persisted,
|
||||
presets: (persisted.presets || []).map(preset => {
|
||||
if (preset.id) return preset;
|
||||
return { ...preset, id: uuid() };
|
||||
}),
|
||||
} as PresetStore;
|
||||
}
|
||||
|
||||
return persisted as PresetStore;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue