shortcuts that work

This commit is contained in:
Ahmet Kilinc
2025-04-30 14:41:10 +01:00
parent 4a0a72dafc
commit 06fd4a55c3
2 changed files with 32 additions and 37 deletions

View File

@@ -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[] = [

View File

@@ -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) {