From 68d4a9a641075a9f5a93c15e3f9529ce7f88f418 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Thu, 12 Mar 2026 00:32:36 +0100 Subject: [PATCH] feat: add email selection functionality with toggle and update translations --- app/[locale]/page.tsx | 33 +++++++++++- components/email/email-list-item.tsx | 35 +++++++------ components/email/thread-email-item.tsx | 35 +++++++------ components/email/thread-list-item.tsx | 70 ++++++++++++++------------ locales/en/common.json | 2 + 5 files changed, 110 insertions(+), 65 deletions(-) diff --git a/app/[locale]/page.tsx b/app/[locale]/page.tsx index 4b79695c..969b490f 100644 --- a/app/[locale]/page.tsx +++ b/app/[locale]/page.tsx @@ -36,7 +36,7 @@ import { isFilterEmpty, activeFilterCount } from "@/lib/jmap/search-utils"; import { WelcomeBanner } from "@/components/ui/welcome-banner"; import { NavigationRail } from "@/components/layout/navigation-rail"; import { Input } from "@/components/ui/input"; -import { Search, Filter, ChevronDown, X, Paperclip, Star, Mail, MailOpen, RotateCcw, PenSquare, PenLine } from "lucide-react"; +import { Search, Filter, ChevronDown, X, Paperclip, Star, Mail, MailOpen, RotateCcw, PenSquare, PenLine, CheckSquare, Square } from "lucide-react"; import { ResizeHandle } from "@/components/layout/resize-handle"; import { Button } from "@/components/ui/button"; @@ -73,8 +73,10 @@ export default function Home() { newEmailNotification, selectEmail, selectMailbox, + selectedEmailIds, selectAllEmails, clearSelection, + toggleEmailSelection, fetchMailboxes, fetchEmails, fetchQuota, @@ -896,6 +898,35 @@ export default function Home() {
+ {/* Select / Select All toggle */} +
{ e.preventDefault(); if (searchQuery.trim()) handleSearch(searchQuery); }} className="relative flex-1">
- {/* Checkbox with smooth animation */} - + {/* Checkbox - only visible when in selection mode */} + {selectedEmailIds.size > 0 && ( + + )} {/* Unread indicator */} {isUnread && ( diff --git a/components/email/thread-email-item.tsx b/components/email/thread-email-item.tsx index 84f7b9fe..3e06daf0 100644 --- a/components/email/thread-email-item.tsx +++ b/components/email/thread-email-item.tsx @@ -75,22 +75,25 @@ export function ThreadEmailItem({ onContextMenu={handleContextMenu} >
- {/* Checkbox */} - + {/* Checkbox - only visible when in selection mode */} + {selectedEmailIds.size > 0 && ( + + )} {/* Unread indicator */} {isUnread && ( diff --git a/components/email/thread-list-item.tsx b/components/email/thread-list-item.tsx index 4e83313a..334f420d 100644 --- a/components/email/thread-list-item.tsx +++ b/components/email/thread-list-item.tsx @@ -102,22 +102,25 @@ const SingleEmailItem = React.forwardRef( style={{ minHeight: 'var(--list-item-height)' }} >
- {/* Checkbox */} - + {/* Checkbox - only visible when in selection mode */} + {selectedEmailIds.size > 0 && ( + + )} {isUnread && (
@@ -322,22 +325,25 @@ export const ThreadListItem = React.forwardRef
- {/* Checkbox for thread selection */} - + {/* Checkbox for thread selection - only visible when in selection mode */} + {selectedEmailIds.size > 0 && ( + + )} {!isMobile && (