diff --git a/src/renderer/components/sidebar/TaskContextMenu.tsx b/src/renderer/components/sidebar/TaskContextMenu.tsx
index d2f7b955..f01c8686 100644
--- a/src/renderer/components/sidebar/TaskContextMenu.tsx
+++ b/src/renderer/components/sidebar/TaskContextMenu.tsx
@@ -24,6 +24,83 @@ export interface TaskContextMenuProps {
children: React.ReactNode;
}
+type TaskContextMenuContentProps = Pick<
+ TaskContextMenuProps,
+ | 'isPinned'
+ | 'isArchived'
+ | 'onTogglePin'
+ | 'onToggleArchive'
+ | 'onMarkUnread'
+ | 'onRename'
+ | 'onDelete'
+>;
+
+const TaskContextMenuLazyContent = ({
+ isPinned,
+ isArchived,
+ onTogglePin,
+ onToggleArchive,
+ onMarkUnread,
+ onRename,
+ onDelete,
+}: TaskContextMenuContentProps): React.JSX.Element => {
+ const { t } = useAppTranslation('common');
+
+ return (
+ e.preventDefault()}>
+
+ {isPinned ? (
+ <>
+
+ {t('taskContextMenu.unpin')}
+ >
+ ) : (
+ <>
+
+ {t('taskContextMenu.pin')}
+ >
+ )}
+
+
+
+
+ {t('taskContextMenu.rename')}
+
+
+
+
+ {t('taskContextMenu.markUnread')}
+
+
+
+
+
+ {isArchived ? (
+ <>
+
+ {t('taskContextMenu.unarchive')}
+ >
+ ) : (
+ <>
+
+ {t('taskContextMenu.archive')}
+ >
+ )}
+
+
+ {onDelete && (
+ <>
+
+
+
+ {t('taskContextMenu.deleteTask')}
+
+ >
+ )}
+
+ );
+};
+
export const TaskContextMenu = ({
task: _task,
isPinned,
@@ -35,7 +112,6 @@ export const TaskContextMenu = ({
onDelete,
children,
}: TaskContextMenuProps): React.JSX.Element => {
- const { t } = useAppTranslation('common');
const [open, setOpen] = useState(false);
return (
@@ -44,57 +120,15 @@ export const TaskContextMenu = ({
{children}
{open ? (
- e.preventDefault()}>
-
- {isPinned ? (
- <>
-
- {t('taskContextMenu.unpin')}
- >
- ) : (
- <>
-
- {t('taskContextMenu.pin')}
- >
- )}
-
-
-
-
- {t('taskContextMenu.rename')}
-
-
-
-
- {t('taskContextMenu.markUnread')}
-
-
-
-
-
- {isArchived ? (
- <>
-
- {t('taskContextMenu.unarchive')}
- >
- ) : (
- <>
-
- {t('taskContextMenu.archive')}
- >
- )}
-
-
- {onDelete && (
- <>
-
-
-
- {t('taskContextMenu.deleteTask')}
-
- >
- )}
-
+
) : null}
);