panel 2 courrier estore

This commit is contained in:
alma 2025-04-25 10:15:49 +02:00
parent 02ef73b417
commit c9007f29dc

View File

@ -53,6 +53,7 @@ export interface Email {
starred: boolean;
attachments?: { name: string; url: string }[];
folder: string;
cc?: string;
}
interface Attachment {
@ -619,7 +620,7 @@ export default function CourrierPage() {
};
// Update handleEmailSelect to set selectedEmail correctly
const handleEmailSelect = async (emailId: number) => {
const handleEmailSelect = async (emailId: string) => {
const email = emails.find(e => e.id === emailId);
if (!email) {
return;
@ -641,11 +642,14 @@ export default function CourrierPage() {
// Update the email in the list and selected email with full content
setEmails(prevEmails => prevEmails.map(email =>
email.id === emailId
? { ...email, body: fullEmail.body || email.body }
? { ...email, content: fullEmail.content || fullEmail.body || email.content }
: email
));
setSelectedEmail(prev => prev ? { ...prev, body: fullEmail.body || prev.body } : prev);
setSelectedEmail(prev => prev ? {
...prev,
content: fullEmail.content || fullEmail.body || prev.content
} : prev);
setContentLoading(false);
// Try to mark as read in the background
@ -814,7 +818,7 @@ export default function CourrierPage() {
email.subject.toLowerCase().includes(query) ||
email.from.toLowerCase().includes(query) ||
email.to.toLowerCase().includes(query) ||
email.body.toLowerCase().includes(query)
email.content.toLowerCase().includes(query)
);
}, [sortedEmails, searchQuery]);
@ -1260,8 +1264,8 @@ export default function CourrierPage() {
}
};
// Add back the toggleStarred function
const toggleStarred = async (emailId: number, e?: React.MouseEvent) => {
// Update toggleStarred to use string IDs
const toggleStarred = async (emailId: string, e?: React.MouseEvent) => {
if (e) {
e.stopPropagation();
}