courrier multi account restore compose

This commit is contained in:
alma 2025-04-28 20:16:07 +02:00
parent f7d6bfb8d2
commit 6431f8d908
3 changed files with 6 additions and 6 deletions

View File

@ -122,7 +122,7 @@ export default function EmailLayout({ className = '' }: EmailLayoutProps) {
};
// Handle email selection
const handleEmailSelect = (id: string) => {
const handleEmailSelect = (id: string, accountId: string, folder: string) => {
setSelectedEmailId(id);
};
@ -315,7 +315,7 @@ export default function EmailLayout({ className = '' }: EmailLayoutProps) {
className={`p-3 hover:bg-secondary/20 cursor-pointer transition-colors ${
selectedEmailId === email.id ? 'bg-secondary/30' : ''
} ${!email.flags.seen ? 'bg-primary/5' : ''}`}
onClick={() => handleEmailSelect(email.id)}
onClick={() => handleEmailSelect(email.id, email.accountId || '', email.folder || '')}
>
<div className="flex items-start gap-2">
<div className="pt-0.5">

View File

@ -16,7 +16,7 @@ interface EmailListProps {
isLoading: boolean;
totalEmails: number;
hasMoreEmails: boolean;
onSelectEmail: (emailId: string) => void;
onSelectEmail: (emailId: string, accountId: string, folder: string) => void;
onToggleSelect: (emailId: string) => void;
onToggleSelectAll: () => void;
onBulkAction: (action: 'delete' | 'mark-read' | 'mark-unread' | 'archive') => void;
@ -153,7 +153,7 @@ export default function EmailList({
email={email}
isSelected={selectedEmailIds.includes(email.id)}
isActive={selectedEmail?.id === email.id}
onSelect={() => onSelectEmail(email.id)}
onSelect={() => onSelectEmail(email.id, email.accountId || '', email.folder || '')}
onToggleSelect={(e: React.MouseEvent) => {
e.stopPropagation();
onToggleSelect(email.id);

View File

@ -289,11 +289,11 @@ export const useCourrier = () => {
}, [currentFolder]);
// Select an email to view
const handleEmailSelect = useCallback(async (emailId: string, accountId?: string, folderOverride?: string) => {
const handleEmailSelect = useCallback(async (emailId: string, accountId: string, folderOverride: string) => {
setIsLoading(true);
try {
// Find the email in the current list
const email = emails.find(e => e.id === emailId && (!accountId || e.accountId === accountId) && (!folderOverride || e.folder === folderOverride));
const email = emails.find(e => e.id === emailId && e.accountId === accountId && e.folder === folderOverride);
if (!email) {
throw new Error('Email not found');
}