fix(mail): sync Object error, MIME subject decoding, sticky compact pagination

- Fix sync error: backend returns {synced, error?} not {success, synced_count}; frontend now checks error field
- Decode MIME encoded-words (=?UTF-8?Q?...?=) in backend during IMAP sync for subject/from/to/cc headers
- Add frontend decodeMimeHeader() utility for already-stored encoded subjects (MailList + MailDetail)
- Make pagination sticky at bottom of mail list (flex-col h-full, ul scrolls, pagination flex-shrink-0)
- Make pagination compact: smaller padding (px-1.5 py-0.5), text-xs, smaller icons, tighter spacing
This commit is contained in:
Agent Zero
2026-07-16 09:40:59 +02:00
parent 560e4ac69d
commit 2a80aeb0af
6 changed files with 92 additions and 39 deletions
+3 -2
View File
@@ -7,6 +7,7 @@
import React, { useMemo, useRef, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import type { Mail, MailAttachment } from '@/api/mail';
import { decodeMimeHeader } from '@/api/mail';
import { Button } from '@/components/ui/Button';
import { EmptyState } from '@/components/ui/EmptyState';
@@ -97,7 +98,7 @@ export function MailDetail({
{/* Headers */}
<div className="px-3 py-2 md:px-4 md:py-3 border-b border-secondary-200" data-testid="mail-detail-headers">
<div className="flex flex-col sm:flex-row sm:items-start sm:justify-between gap-2 sm:gap-4">
<h2 className="text-base md:text-lg font-semibold text-secondary-900 flex-1">{mail.subject || t('mail.noSubject')}</h2>
<h2 className="text-base md:text-lg font-semibold text-secondary-900 flex-1">{decodeMimeHeader(mail.subject) || t('mail.noSubject')}</h2>
{mail.labels && mail.labels.length > 0 && (
<div className="flex gap-1 flex-shrink-0">
{mail.labels.map((label) => (
@@ -111,7 +112,7 @@ export function MailDetail({
<div className="mt-2 space-y-1 text-xs md:text-sm text-secondary-600">
<div className="flex flex-col sm:flex-row sm:gap-2">
<span className="font-medium text-secondary-500 flex-shrink-0">{t('mail.from')}:</span>
<span className="break-words">{mail.from_name ? `${mail.from_name} <${mail.from_address}>` : mail.from_address}</span>
<span className="break-words">{decodeMimeHeader(mail.from_name) ? `${decodeMimeHeader(mail.from_name)} <${mail.from_address}>` : mail.from_address}</span>
</div>
<div className="flex flex-col sm:flex-row sm:gap-2">
<span className="font-medium text-secondary-500 flex-shrink-0">{t('mail.to')}:</span>