From 06fd4a55c3bc0b6f7bc23142ea4b2ab7532f0bf7 Mon Sep 17 00:00:00 2001 From: Ahmet Kilinc Date: Wed, 30 Apr 2025 14:41:10 +0100 Subject: [PATCH] shortcuts that work --- apps/mail/config/shortcuts.ts | 30 ++++++++-------- apps/mail/lib/hotkeys/mail-list-hotkeys.tsx | 39 +++++++++------------ 2 files changed, 32 insertions(+), 37 deletions(-) diff --git a/apps/mail/config/shortcuts.ts b/apps/mail/config/shortcuts.ts index 720cb0827..79ad4c54b 100644 --- a/apps/mail/config/shortcuts.ts +++ b/apps/mail/config/shortcuts.ts @@ -56,13 +56,13 @@ const globalShortcuts: Shortcut[] = [ // description: 'Show keyboard shortcuts', // scope: 'global', // }, - { - keys: ['z'], - action: 'undoLastAction', - type: 'single', - description: 'Undo last action', - scope: 'global', - }, + // { + // keys: ['z'], + // action: 'undoLastAction', + // type: 'single', + // description: 'Undo last action', + // scope: 'global', + // }, { keys: ['c'], action: 'newEmail', @@ -158,14 +158,14 @@ const mailListShortcuts: Shortcut[] = [ // description: 'Delete email', // scope: 'mail-list', // }, - { - keys: ['mod', 'a'], - action: 'selectAll', - type: 'combination', - description: 'Select all emails', - scope: 'mail-list', - // preventDefault: true, - }, + // { + // keys: ['mod', 'a'], + // action: 'selectAll', + // type: 'combination', + // description: 'Select all emails', + // scope: 'mail-list', + // preventDefault: true, + // }, ]; const composeShortcuts: Shortcut[] = [ diff --git a/apps/mail/lib/hotkeys/mail-list-hotkeys.tsx b/apps/mail/lib/hotkeys/mail-list-hotkeys.tsx index b441da83d..6c156967c 100644 --- a/apps/mail/lib/hotkeys/mail-list-hotkeys.tsx +++ b/apps/mail/lib/hotkeys/mail-list-hotkeys.tsx @@ -37,28 +37,23 @@ export function MailListHotkeys() { }; }, []); - const selectAll = useCallback( - (e: KeyboardEvent) => { - e.preventDefault(); - e.stopPropagation(); - console.log('selectAll'); - if (mail.bulkSelected.length > 0) { - setMail((prev) => ({ - ...prev, - bulkSelected: [], - })); - } else if (items.length > 0) { - const allIds = items.map((item) => item.id); - setMail((prev) => ({ - ...prev, - bulkSelected: allIds, - })); - } else { - toast.info(t('common.mail.noEmailsToSelect')); - } - }, - [items, mail.bulkSelected, setMail, t], - ); + const selectAll = useCallback(() => { + console.log('selectAll'); + if (mail.bulkSelected.length > 0) { + setMail((prev) => ({ + ...prev, + bulkSelected: [], + })); + } else if (items.length > 0) { + const allIds = items.map((item) => item.id); + setMail((prev) => ({ + ...prev, + bulkSelected: allIds, + })); + } else { + toast.info(t('common.mail.noEmailsToSelect')); + } + }, [items, mail.bulkSelected, setMail, t]); const markAsRead = useCallback(() => { if (hoveredEmailId.current) {