mail page ui correction maj 2
This commit is contained in:
parent
b4c386f30d
commit
019abfab96
@ -401,7 +401,7 @@ export default function MailPage() {
|
|||||||
const [currentView, setCurrentView] = useState('inbox');
|
const [currentView, setCurrentView] = useState('inbox');
|
||||||
const [showCompose, setShowCompose] = useState(false);
|
const [showCompose, setShowCompose] = useState(false);
|
||||||
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
||||||
const [selectedEmails, setSelectedEmails] = useState<string[]>([]);
|
const [selectedEmails, setSelectedEmails] = useState<number[]>([]);
|
||||||
const [showBulkActions, setShowBulkActions] = useState(false);
|
const [showBulkActions, setShowBulkActions] = useState(false);
|
||||||
const [showBcc, setShowBcc] = useState(false);
|
const [showBcc, setShowBcc] = useState(false);
|
||||||
const [emails, setEmails] = useState<Email[]>([]);
|
const [emails, setEmails] = useState<Email[]>([]);
|
||||||
@ -538,21 +538,25 @@ export default function MailPage() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Add email action handlers
|
// Add email action handlers
|
||||||
const handleEmailSelect = (emailId: string) => {
|
const handleEmailSelect = (emailId: number) => {
|
||||||
const email = emails.find(e => e.id === emailId);
|
setSelectedEmails(prev => {
|
||||||
if (email) {
|
if (prev.includes(emailId)) {
|
||||||
setSelectedEmail(email);
|
return prev.filter(id => id !== emailId);
|
||||||
// Mark as read if not already
|
|
||||||
if (!email.read) {
|
|
||||||
const updatedEmails = emails.map(e =>
|
|
||||||
e.id === emailId ? { ...e, read: true } : e
|
|
||||||
);
|
|
||||||
setEmails(updatedEmails);
|
|
||||||
}
|
}
|
||||||
|
return [...prev, emailId];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleEmailCheckbox = (e: React.ChangeEvent<HTMLInputElement>, emailId: number) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
if (e.target.checked) {
|
||||||
|
setSelectedEmails([...selectedEmails, emailId]);
|
||||||
|
} else {
|
||||||
|
setSelectedEmails(selectedEmails.filter(id => id !== emailId));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const toggleStarred = async (emailId: string, e: React.MouseEvent) => {
|
const toggleStarred = async (emailId: number, e: React.MouseEvent) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -631,6 +635,17 @@ export default function MailPage() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const toggleSelectAll = () => {
|
||||||
|
if (selectedEmails.length === filteredEmails.length) {
|
||||||
|
setSelectedEmails([]);
|
||||||
|
setShowBulkActions(false);
|
||||||
|
} else {
|
||||||
|
const allEmailIds = filteredEmails.map(email => email.id);
|
||||||
|
setSelectedEmails(allEmailIds);
|
||||||
|
setShowBulkActions(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
return (
|
return (
|
||||||
<div className="flex h-[calc(100vh-theme(spacing.12))] items-center justify-center bg-gray-100 mt-12">
|
<div className="flex h-[calc(100vh-theme(spacing.12))] items-center justify-center bg-gray-100 mt-12">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user