Commit Graph
65 Commits
Author SHA1 Message Date
Matthieu MALVACHE 40c7fa3649 feat: add UI/UX polish, templates settings, confirm dialog, welcome banner, and navigation rail
- Add ConfirmDialog component with promise-based useConfirmDialog hook
- Add WelcomeBanner onboarding component with localStorage persistence
- Add NavigationRail (desktop icon rail + mobile bottom tab bar)
- Polish login form (shake on error, TOTP slide, password visibility, session expired banner)
- Add inline form validation with shake animation in email composer and contacts
- Add empty state patterns for contacts (no data vs no search results)
- Improve toast system with undo action support and typed durations
- Add template settings tab to settings page
- Refactor sidebar (cleaner code, remove unused imports)
- Add WCAG AA reduced-motion, safe area insets, sr-only live region
- Add shake/slide animations in globals.css
- Update i18n for all 8 locales
2026-02-17 02:30:09 +01:00
Matthieu MALVACHE 7da9fa61e2 feat(templates): add email templates with placeholder variables and composer integration
Local-storage templates with dynamic {{variable}} placeholders that auto-fill
from composer context (recipient, sender, date/time). Includes template manager,
category filtering, quick picker in composer toolbar, and settings tab.
48 tests covering placeholder extraction, filling, and variable suggestions.
2026-02-17 01:34:13 +01:00
Matthieu MALVACHE 5d2f5dcf7e feat(calendar): add participant scheduling with iTIP invitations and inline calendar invitation banner
Add organizer/attendee UI with RSVP buttons (accept/maybe/decline),
contact autocomplete in participant input, scheduling message support
via sendSchedulingMessages flag, and DnD notification for participant
events. Add inline calendar invitation banner in email viewer that
auto-detects .ics attachments, parses event details, and allows RSVP
or import to calendar. Includes cancellation display and 51 tests.
2026-02-17 01:09:03 +01:00
Matthieu MALVACHE 613eb6ce84 fix(email): improve dark mode readability and fix long subject overflow
Dark mode color transform had 3 bugs preventing it from working:
- Hook only ran when external content was blocked, not for all emails
- Checked `theme` ('system') instead of `resolvedTheme` ('dark')
- Only transformed CSS style attrs, missing <font color> and bgcolor

Replaced invert+boost algorithm with blend-toward-white for text
(preserves hue, brighter results) and added background darkening
for light email backgrounds. Also handles color/bgcolor HTML attrs.

Fixed long email subjects pushing action buttons off-screen by adding
min-w-0 to the email viewer flex container in the page layout.
2026-02-17 00:38:46 +01:00
Matthieu MALVACHE be78603c48 fix(filters): show hierarchical folder structure in rule mailbox selector
Reuse buildMailboxTree/flattenMailboxTree to display nested folders
with indentation instead of a flat list. Exclude shared folders since
Sieve rules only operate on the user's own mailboxes.
2026-02-17 00:06:52 +01:00
Matthieu MALVACHE a603ee496b feat(calendar): add event notifications with client-side alert evaluation
Evaluate JMAP CalendarEventAlert triggers client-side and display toast
notifications when alert times are reached. Extracts notification sound
into shared utility and mounts ToastContainer globally (fixes silent
toast failures across all components).

- Pure alert utilities: offset parsing, fire time computation (start/end),
  effective alerts resolution with useDefaultAlerts, pending alert filtering
- Zustand persist store for acknowledged alert deduplication (24h retention)
- Global hook with 60s interval check, proactive 24h event fetch via ref
  (isolated from calendar store), stale closure protection
- Settings: calendarNotificationsEnabled, calendarNotificationSound toggles
- Toast icon customization, CalendarAlertProvider in layout
- i18n: all 8 locales (EN/FR/JA/ES/IT/DE/NL/PT)
- 44 tests (36 alert utils + 8 notification store), 558 total passing
2026-02-16 23:46:12 +01:00
Matthieu MALVACHE 9be02e8dd7 feat(filters): add email filters with Sieve rules, review fixes and hardening
Implement JMAP Sieve Scripts (RFC 9661) with visual rule builder and raw
Sieve editor. Includes post-review fixes: parser validation guards,
generator empty-rule skipping, JMAP client error hardening, focus trap
accessibility, mailbox name fix, toast validation feedback, auto-save with
rollback, and "Reset to visual builder" for opaque scripts. 514 tests pass.
2026-02-16 23:07:06 +01:00
Matthieu MALVACHE b84e543e2e feat(calendar): add drag-and-drop rescheduling and iCalendar import
Calendar phase 2 features with review-driven fixes:
- Drag events in week/day views to reschedule (15-min snap intervals)
- Drag events in month view to change date (preserves time)
- Visual snap indicators with time labels during drag
- iCalendar (.ics) import via JMAP CalendarEvent/parse
- Import modal with file upload, event preview, calendar selector
- File validation (5MB max), bulk import with progress
- i18n: calendar.import.* and event_move_error keys (8 locales)
2026-02-16 21:07:44 +01:00
Matthieu MALVACHE a27196bdeb feat(calendar): add JMAP Calendar integration with full review fixes
Calendar phase 1 with comprehensive review-driven hardening:
- JMAP CalendarEvent CRUD (RFC 8984 types, capability detection)
- Month/week/day/agenda views with multi-day event spanning
- Column-based overlap layout for concurrent events
- Event modal with create/edit/delete, recurrence, reminders
- Mini-calendar sidebar with calendar visibility toggles
- Settings: firstDayOfWeek and timeFormat wired to all views
- Locale-aware date formatting via next-intl useFormatter (8 locales)
- Push notification handling for Calendar/CalendarEvent state changes
- ARIA grid roles, event card labels, focus trap, 44px touch targets
- Input validation, color sanitization, timezone auto-detection
- Error handling with toast feedback, capability page guard
- ICU pluralization for alert translations, debug logger integration
2026-02-16 20:32:06 +01:00
Matthieu MALVACHE 83e01ae551 feat: add contacts phase 2, advanced search, vacation responder, Docker & TOTP 2FA
Contacts:
- Contact groups/lists with JMAP members map and composer expansion
- vCard import/export with RFC 6350 parser and duplicate detection
- Bulk operations (multi-select, delete, group add, export)

Search:
- Advanced search panel with JMAP filter fields
- Search chips for active filters visualization
- Debounced inputs with AbortController deduplication

Vacation:
- JMAP VacationResponse singleton management
- Settings tab with date range and message configuration
- Sidebar indicator when vacation responder is active

Auth:
- TOTP 2FA support with Stalwart-compatible password$totp format

Infrastructure:
- Docker multi-stage build with standalone Next.js output
- Structured server-side logger with text/JSON format
- CSP Report-Only and security headers via proxy middleware
- Layout refactoring (HTML structure in root layout)
- Playwright E2E framework setup

Testing: 450+ tests (identity, contacts, vCard, threads, headers, components)
i18n: All new strings added to all 8 locales
2026-02-16 18:46:33 +01:00
Matthieu MALVACHE dddbcf75db fix(email): resolve layout overflow and blocked image empty spaces
Remove width: max-content and display: inline-block from email content
CSS that caused horizontal scroll and left-side text clipping. Collapse
empty table cells/containers when external images are blocked to prevent
large blank areas in newsletter emails.
2026-02-16 17:18:38 +01:00
Matthieu MALVACHE 17abe7ff56 feat(contacts): add address book with JMAP sync and local fallback
Implement Phase 1 of contacts support — the biggest missing feature
on the roadmap. Uses RFC 9553 (JSContact) data model and RFC 9610
(JMAP for Contacts) when the server advertises the capability,
falling back to localStorage for servers without contact support.

- JMAP types for ContactCard, AddressBook, NameComponent, etc.
- JMAP client methods: CRUD, search, address book listing
- Refactored request() to accept dynamic `using` capabilities
- Zustand contact store with dual-mode persistence
- Full contacts page with two-column layout (list + detail/edit)
- Contact form with multi-email/phone, context labels, validation
- Composer autocomplete on To/Cc/Bcc with keyboard nav and ARIA
- Sidebar navigation link to contacts
- Auth integration: fetch on login, clear on logout
- i18n: contacts.* namespace across all 8 languages
2026-02-16 17:07:45 +01:00
Matthieu MALVACHE 3fc8ccf116 feat(i18n): expand language support from 3 to 8 languages
Add support for Spanish, Italian, German, Dutch, and Portuguese with complete translations for all features including identity management, newsletter unsubscribe, and accessibility improvements.

Changes:
- Add 5 new locale directories with full translations
- Update IntlProvider to load all 8 language message files
- Redesign language switcher from button group to dropdown for better scalability
- Update routing and request configuration to handle new locales
- Improve Select component with dir="auto" for RTL support
- Reorganize notification keys in translation files for consistency
- Update all documentation to reflect expanded language support
2026-01-08 22:12:13 +01:00
Matthieu MALVACHE cfcf0083f6 feat(i18n): add Japanese language support with complete translations
Add Japanese (ja) as the third supported language alongside English and French. Includes 650+ translation keys covering all UI sections: login, sidebar, email operations, settings (all 8 tabs), context menus, keyboard shortcuts, threads, identity management, and error messages.

Uses formal Japanese (敬語 keigo) appropriate for business email communication. All client and server-side i18n infrastructure updated to load Japanese translations.
2026-01-08 21:40:13 +01:00
Matthieu MALVACHE e600cd387d fix(security): prevent global CSS injection from email style tags
Emails containing <style> tags were injecting global CSS rules that
affected the entire application UI. For example, button:hover rules
from emails would override all button hover states app-wide.

Changes:
- Block <style> tags in email sanitization config (security fix)
- Keep inline style attributes for element-specific formatting
- Add explicit bg-transparent to banner buttons (defense in depth)
- Add CSS isolation to banner container
- Fix theme dependency in email content memoization

This prevents malicious or poorly-formatted emails from breaking the
UI or being used for phishing via CSS injection attacks.
2026-01-08 19:18:59 +01:00
Matthieu MALVACHEandClaude Sonnet 4.5 1bca54e5d6 feat(accessibility): improve WCAG AA color contrast compliance
- Replace hardcoded hex colors (#666, #999) with CSS variables in email preview
- Strengthen blockquote text color from #6b7280 to #4b5563 (5.3:1 → 7.8:1 contrast)
- Strengthen quoted email text color to match blockquote improvement
- Add comprehensive accessibility guidelines to CLAUDE.md
- Document color contrast standards, testing requirements, and best practices
- All changes maintain dark mode compatibility

Achieves WCAG 2.0 Level AA compliance for all text elements.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-08 18:42:53 +01:00
Matthieu MALVACHEandClaude Sonnet 4.5 395f92c47f feat(email): add newsletter unsubscribe and enhance dark mode
Implement RFC 2369 List-Unsubscribe support with security validation (protocol whitelist, XSS prevention), two-step confirmation UI, and localStorage persistence. Add intelligent color transformation for dark mode to fix unreadable inline email styles using WCAG 2.0 luminance calculation. Complete batch spam undo operations for context menu multi-select. Update documentation with new features and comprehensive test coverage (97 tests).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-08 18:39:27 +01:00
Matthieu MALVACHEandClaude Sonnet 4.5 da9fa4e28a feat(email): add spam reporting with bidirectional handling
Implement comprehensive spam management allowing users to report spam emails and restore false positives. Emails are moved to/from the Junk folder with toast notifications and undo support.

Key features:
- Mark as spam: moves email to Junk folder with 5-second undo
- Mark as not spam: restores email from Junk to inbox
- Batch spam operations via context menu
- Smart toggle based on current folder (Junk vs other folders)
- Keyboard shortcut (Shift+!) for quick spam reporting
- Full i18n support (EN/FR)
- Shared mailbox compatibility

UX improvements:
- Toast notifications with undo action using sonner library
- Auto-deselect email after spam action
- Visual distinction with red destructive styling
- Desktop button + context menu + keyboard shortcuts

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-08 17:55:24 +01:00
Matthieu MALVACHE f62f5adf29 refactor(identity): enhance i18n and improve sub-address detection
Complete internationalization coverage for all identity-related UI elements,
including mobile navigation, batch actions, and recipient formatting. Improve
sub-address badge to detect and display tags for emails received at
user+tag@domain.com addresses, not just sent emails. Add contextual recipient
display showing "me" for current user and "Name and X others" for multiple
recipients. Update documentation to reflect completed identity management
implementation.
2026-01-08 17:20:13 +01:00
Matthieu MALVACHEandClaude Sonnet 4.5 b6330642c2 feat(identity): improve accessibility for identity management modal
- Add reusable focus trap hook (use-focus-trap.ts)
  - Traps Tab/Shift+Tab within modal
  - Restores focus on close
  - Handles disabled elements gracefully

- Enhance identity modal with WCAG 2.1 compliance
  - Add role="dialog" and aria-modal="true"
  - Add aria-labelledby linking to modal title
  - Implement focus trap on open

- Add ARIA live regions to identity form
  - Error messages announced to screen readers
  - aria-describedby links inputs to errors
  - aria-invalid state on validation failure

Accessibility: Improves keyboard navigation and screen reader UX
Standards: WCAG 2.1 AA compliant for modal interactions

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-08 16:20:15 +01:00
Matthieu MALVACHE 040b34977b refactor(identity): improve performance and code quality
- Add useMemo for expensive tag suggestions computation
- Add useCallback for identity CRUD handlers
- Extract magic numbers to constants (MAX_RECENT_TAGS, MAX_TAG_LENGTH)
- Improve JMAP error messages with context

Performance: Reduces unnecessary re-renders in identity modal
Maintainability: Makes limits configurable and self-documenting
UX: Users get clearer error messages when operations fail

No functional changes. All tests passing.
2026-01-08 16:12:53 +01:00
Matthieu MALVACHE d301dd15ff security: fix XSS vulnerabilities in identity management
- Add unified email sanitization utility (lib/email-sanitization.ts)
  - Safe HTML parsing using DOMParser instead of innerHTML
  - Consistent DOMPurify configuration across components
  - Separate signature sanitization with stricter rules

- Add secure email validation (lib/validation.ts)
  - RFC 5322 compliant validation
  - Block header injection attempts (\r\n<>)
  - Validate comma-separated email lists

- Fix HTML signature XSS (identity-form.tsx)
  - Sanitize signatures before storage and rendering
  - Add live preview with safe rendering
  - Input length limits for defense in depth

- Fix innerHTML XSS (email-viewer.tsx, thread-conversation-view.tsx)
  - Replace unsafe innerHTML with DOMParser for format detection
  - Use shared EMAIL_SANITIZE_CONFIG
  - Add <meta>, <link>, <base> to forbidden tags

Security issues resolved:
- H1: Stored XSS in HTML signatures (CVSS 7.1)
- H2: XSS during HTML parsing (CVSS 6.8)
- M1: Email validation bypass (CVSS 4.3)
- M3: Inconsistent sanitization (CVSS 5.0)

Zero new dependencies. All tests passing.
2026-01-08 16:12:53 +01:00
Matthieu MALVACHE 275aa8290f feat(identities): Add identity management and sub-addressing support
Enable users to manage multiple sending identities and organize incoming mail with sub-addressing (user+tag@domain.com format). Provides better email organization, privacy through disposable addresses, and flexibility for users with multiple roles or accounts.
2026-01-08 16:12:53 +01:00
Matthieu MALVACHE 91b8a42fdd feat(i18n): Complete internationalization coverage
Replaces all remaining hardcoded strings with translation keys to ensure full localization support across the application. This allows users to experience the entire interface in their preferred language without any English fallbacks.
2026-01-08 04:24:58 +01:00
Matthieu MALVACHEandClaude Sonnet 4.5 5613f66bd7 fix(i18n): Add timezone auto-detection to prevent hydration mismatches
Fixes ENVIRONMENT_FALLBACK warning by detecting user's browser timezone
and passing it to NextIntlClientProvider. This ensures users worldwide
see email timestamps in their local timezone (USA, Europe, Asia, etc.)
without manual configuration.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-08 04:11:26 +01:00
Matthieu MALVACHEandClaude Sonnet 4.5 2f50feb6bb fix(lint): Replace any type with proper Record type in IntlProvider
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-08 04:00:43 +01:00
Matthieu MALVACHEandClaude Sonnet 4.5 a4e2fcf81b feat(i18n): Enable instant client-side language switching
Refactored i18n implementation to support seamless language switching
without page reload by pre-loading all translations and using
locale-aware navigation helpers.

Changes:
- Created centralized routing config (i18n/routing.ts) with localePrefix: 'never'
- Added type-safe navigation helpers (i18n/navigation.ts)
- Implemented custom IntlProvider with pre-loaded EN/FR translations
- Updated all pages to use new useRouter from i18n/navigation
- Added language switcher to appearance settings
- Removed URL-based locale routing (no more /en/ or /fr/ prefixes)
- Language preference persisted via Zustand localStorage

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-08 03:59:29 +01:00
Matthieu MALVACHE 4032692700 feat(ui): Improve tablet and mobile email viewing experience
- Add tablet list auto-hide: email list collapses when selecting an email
  on tablet (768-1024px), with back button to return to two-pane view
- Make sender info scrollable on mobile/tablet while keeping subject bar
  with action buttons sticky at top for quick access
- Extend overlay sidebar behavior to tablet viewport (768-1024px)
- Add body scroll lock when sidebar is open on mobile/tablet
- Fix backdrop only rendering on mobile/tablet (not desktop)
- Add proper i18n keys for back_to_list, important, close
- Simplify desktop-only CSS classes by removing redundant breakpoint prefixes
2026-01-08 03:10:23 +01:00
Matthieu MALVACHE 6cea985396 feat(privacy): Add trusted senders for automatic image loading
Allow users to trust specific senders so their images load automatically
without clicking "Show images" each time. Addresses privacy while
improving UX for known senders.

- Add trustedSenders state to settings store with add/remove/check methods
- Show "Always trust this sender" button in email viewer (ask/block modes)
- Add TrustedSendersModal for managing trusted senders in settings
- Include search, manual add, and avatar display in modal
- Full i18n support (en/fr)

Closes #3
2026-01-08 01:43:24 +01:00
Matthieu MALVACHE e50404cf42 feat(identities): Use JMAP identities for email sender address
- Add getIdentities() method to JMAP client
- Fetch and store identities in auth store on login
- Add From selector in composer (dropdown for multiple identities)
- Pass identity email/ID through send flow instead of using username
- Add translations for From field (en/fr)

This allows proper sender address handling for LDAP and other auth
backends where username differs from email address.

Closes #5
2026-01-08 01:19:09 +01:00
Matthieu MALVACHE 60aff695fe fix(email-composer): Improve readability and add discard button
- Fix textarea colors for proper theme support (light/dark mode)
- Fix modal height to prevent composer from collapsing
- Add explicit "Discard" button in footer for better UX
- Fix hardcoded colors in attachments section for theme support
- Use translations for all user-facing text

Closes #6
2026-01-08 01:01:37 +01:00
Matthieu MALVACHE 1924c36a2c fix(email-viewer): Enable horizontal scroll for wide HTML emails
- Change overflow-hidden to overflow-x-auto on email body container
- Add CSS for email-content-wrapper with inline-block display
- Use width: max-content on email-content to respect intrinsic width
- Prevent tables with width="100%" from shrinking below content

Also updates dependencies:
- next: 16.0.10 -> 16.1.1
- react/react-dom: 19.2.1 -> 19.2.3
- next-intl: 4.5.8 -> 4.6.1
- tailwindcss: 4.1.17 -> 4.1.18
- eslint: 9.39.1 -> 9.39.2
- jmap-jam: 0.11.0 -> 0.13.1
- lucide-react: 0.556.0 -> 0.562.0

Adds test script for injecting HTML emails via JMAP (dev only)
2025-12-24 04:02:32 +01:00
Matthieu MALVACHE 7d77415801 feat: Add search pagination and UX improvements
- Add pagination support to searchEmails (was limited to 50 results)
- Search now scoped to current mailbox/folder
- Support shared mailbox folders in search
- Display total results count (e.g., "50 of 1400 conversations")
- Add clear (X) button to search input
- Re-run search when changing folders during active search
- Remove unused sidebar screenshot
2025-12-17 18:32:47 +01:00
Matthieu MALVACHE 8eefba5047 feat: Add email threading support with Gmail-style conversation view
- Implement thread grouping by threadId in email list
- Add ThreadListItem with collapsed/expanded states for desktop
- Create ThreadConversationView for full-screen mobile experience
- Add thread utility functions for grouping and sorting
- Extend JMAP client with getThread() and getThreadEmails() methods
- Add keyboard shortcut 'x' to expand/collapse threads
- Add thread expansion state management in email store
- Fix React hooks order in login page
- Add .env.example for environment configuration
- Add husky for git hooks
2025-12-10 17:38:03 +01:00
Matthieu MALVACHE f344725e2c feat: Add keyboard shortcuts, drag-drop, context menus, and mobile responsive design
New features:
- Keyboard shortcuts (j/k navigation, r/R/f for reply/forward, s star, e archive, # delete)
- Drag-and-drop emails to mailbox folders with multi-select support
- Right-click context menus on email list items with all actions
- Mobile-responsive adaptive layout with hamburger menu navigation

New files:
- hooks/use-keyboard-shortcuts.ts - Global keyboard shortcut handling
- hooks/use-email-drag.ts, hooks/use-mailbox-drop.ts - Native HTML5 DnD API
- hooks/use-context-menu.ts, components/ui/context-menu.tsx - Context menu system
- hooks/use-media-query.ts, stores/ui-store.ts - Responsive breakpoint handling
- components/layout/mobile-header.tsx - Mobile navigation header
- contexts/drag-drop-context.tsx - Drag-drop state management
- components/keyboard-shortcuts-modal.tsx - Help modal (? key)
- components/email/email-context-menu.tsx - Email-specific context menu

Updated TODO.md with completed tasks and code audit summary
2025-12-10 16:58:01 +01:00
Matthieu MALVACHE 81ec4cb471 feat: Add error boundaries and real-time push notifications
- Implement error boundaries with graceful fallbacks for all major components
  (sidebar, email list, email viewer, composer)
- Add push notifications via EventSource for real-time email updates
- Show connection status indicator in sidebar footer
- Play notification sound and show toast for new emails
- Add global error handler and error reporting utilities
- Configure ESLint with modern flat config
- Various fixes: unused variable warnings, proper cleanup on disconnect
- Update translations for error messages (EN/FR)
2025-12-10 00:43:46 +01:00
Matthieu MALVACHE 63cb80cb1d feat: Wire up disconnected settings to actual functionality
- showPreview: Conditionally render email preview in list based on setting
- externalContentPolicy: Control external content (ask/block/allow modes)
- deleteAction: Move to trash or permanently delete based on preference
- debugMode: Add conditional logging via new lib/debug.ts utility

Also includes:
- Add moveToTrash method to JMAP client for trash-based deletion
- Update TODO.md with verified implementation status
- Migrate middleware.ts to proxy.ts (Next.js deprecation)
2025-12-09 23:51:20 +01:00
Matthieu MALVACHEandClaude 2f454cd673 fix: Improve UI/UX with dark mode selection visibility and auto-select inbox on login
- Fix dark mode folder selection not visible by improving accent color contrast (#1e3a8a)
- Fix inbox not selected by default on login (auto-select primary account inbox)
- Fix email store not cleared on logout (proper state reset between sessions)
- Add settings page with appearance, email behavior, and advanced options
- Integrate mark-as-read delay setting with proper useEffect implementation
- Reset dataLoaded flag on logout to ensure fresh data load on next login

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 16:39:10 +02:00
Matthieu MALVACHEandClaude 1e563a8973 fix: Fix sidebar footer overflow causing page height extension
- Add overflow-hidden to sidebar container to prevent absolute positioned menu from extending page height
- Improve theme consistency in email viewer security indicators
- Add AI spam analysis display (X-Spam-LLM header support)
- Enhance dark mode support with better color variables
- Update CLAUDE.md with commit/push guidelines

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 14:48:45 +02:00
Matthieu MALVACHE b2598caf90 fix: Implement infinite scroll without total count from server
Fix pagination to work with Stalwart JMAP server which doesn't return
the total count. Instead of relying on total:
- If we get exactly limit emails (50), assume there might be more
- If we get fewer than limit, we've reached the end

Also fixed observer target rendering - it now always renders instead of
being conditional, ensuring the intersection observer can work properly.
2025-10-02 14:44:37 +02:00
Matthieu MALVACHE aa7b8c1604 feat: Implement infinite scroll with pagination for email list
Add pagination support to load emails progressively as user scrolls:
- Update JMAP client getEmails() to accept position parameter
- Return pagination metadata (hasMore, total) from getEmails()
- Add loadMoreEmails() method to email store for loading next page
- Implement intersection observer in EmailList for automatic loading
- Display loading indicator while fetching more emails
- Show "no more emails" message at end of list

Users can now seamlessly scroll through all emails, loading 50 at a time.
2025-10-02 14:34:31 +02:00
Matthieu MALVACHE 5f45cbe993 feat: Add comprehensive shared folders support with multi-account access
Implemented full support for JMAP shared folders (delegated mailboxes):

Core Features:
- Multi-account mailbox fetching from all available JMAP accounts
- Virtual "Shared Folders" parent with account grouping in sidebar
- ID namespacing to prevent collisions across accounts (e.g., "b0:a" for shared Inbox)
- Account-aware email operations (fetch, view, mark as read)

Technical Implementation:
- Store all accounts from JMAP session (primary + shared)
- Transform mailbox IDs: primary uses original, shared use "accountId:mailboxId" format
- Store originalId for JMAP queries while using namespaced IDs in UI
- Transform email mailboxIds to match namespaced mailbox IDs for proper counter updates
- Pass accountId parameter through entire operation chain (fetch, view, mark read)

UI/UX Enhancements:
- Blue Users/User icons for shared folders in sidebar
- Hierarchical display with account grouping
- Proper unread counters that update when marking emails read
- Auto-mark emails as read when opened in shared folders

Bug Fixes:
- Fixed email content fetching showing wrong message in shared folders
- Fixed unread counters not updating for shared mailboxes
- Fixed mark-as-read not working on server for shared accounts
- Cleaned up debug logging
2025-10-02 13:57:19 +02:00
Matthieu MALVACHE 0abb9d5f80 fix: Allow sending emails with attachments but no body text
The send validation was requiring body text, which prevented sending
emails that only have attachments. Changed validation to allow sending
when there's either body text OR uploaded attachments.
2025-10-02 13:19:13 +02:00
Matthieu MALVACHE aebdbc1687 fix: Capture latest draft ID after save to prevent race condition
When sending an email with attachments, saveDraft() would destroy+create
the draft (generating a new ID), but handleSend() was using the old ID
from React state which hadn't updated yet. This caused "notFound" errors.

Fixed by making saveDraft() return the draft ID and using it directly
in handleSend() instead of relying on async state updates.
2025-10-02 13:15:40 +02:00
Matthieu MALVACHEandClaude 258f10d4ba feat: Implement functional quick reply and fix draft auto-save integration
Email Sending:
- Fix identity lookup for email submission (now properly fetches identities from server)
- Add Sent mailbox requirement for sending emails
- Add proper error handling and validation for email submission

Quick Reply Form:
- Replace dummy input with fully functional quick reply system
- Add state management for reply text with auto-expand on focus
- Implement direct send functionality without modal
- Add loading states and error handling
- Show character counter and action buttons (Cancel, More options, Send)
- Use real user avatar and email from auth store
- Auto-refresh email list after sending

Draft Auto-Save Integration:
- Fix critical issue where auto-saved drafts were ignored when sending
- Pass draftId through entire send chain (composer → store → client)
- Wait for pending auto-save before sending to prevent race conditions
- Add draft cleanup with discard confirmation when closing composer
- Delete orphaned drafts when user confirms discard
- Add i18n support for discard confirmation (EN/FR)

Benefits:
- No more orphaned drafts in Drafts folder
- Better performance (updates existing draft vs creating new email)
- Cleaner UX with proper draft lifecycle management
- Quick replies are truly quick (no modal needed)
- All user-facing messages properly translated

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 13:01:14 +02:00
Matthieu MALVACHEandClaude 8bba87648c feat: Add smooth cross-fade transition when opening emails
Improved email loading UX with a polished cross-fade approach:

**Visual Continuity:**
- Removed jarring selectEmail(null) call that caused blank screen
- Current email stays visible while new one loads
- Smooth transition instead of abrupt pop-in

**Loading Feedback:**
- Semi-transparent overlay with subtle backdrop blur (2px)
- Centered loading card with spinner and message
- Small loading indicator in email header
- Both overlays fade in smoothly (200ms)

**React Optimization:**
- Added key prop based on email.id to email viewer
- Triggers proper React animations on email change
- Combined with 300ms fade-in creates smooth cross-fade effect

**Result:**
When clicking an email, the current email remains visible with a subtle
dimming effect while the new email loads, then smoothly transitions to
the new content. No more visual glitches or jarring blank screens.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 12:45:46 +02:00
Matthieu MALVACHEandClaude 09fb46c109 fix: Improve batch operations colors for better light mode support
Replaced hardcoded blue colors with theme CSS variables for consistent
appearance across light and dark modes:

**Color Changes:**
- Batch toolbar background: `bg-blue-50` → `bg-accent/30` (uses theme)
- Selection count text: `text-blue-700` → `text-foreground` (theme-aware)
- Checkbox checked color: `text-blue-600` → `text-primary` (theme variable)
- Selected email ring: `ring-blue-500/20` → `ring-primary/20` (theme-aware)
- Selected email background: `bg-blue-50/50` → `bg-accent/40` (consistent)
- Button hover states: `hover:bg-blue-100` → `hover:bg-accent` (theme-based)

**Benefits:**
- Consistent with application theme system
- Proper light/dark mode contrast
- Uses CSS variables from Tailwind config
- More subtle selection highlighting in light mode
- Better accessibility with theme-aware colors

All selection states now adapt seamlessly to the active theme.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 12:41:25 +02:00
Matthieu MALVACHEandClaude 3dea5e232b fix: Remove visual glitch when opening emails
Removed the jarring "Loading full email content..." banner that appeared
while email content was loading, which caused a visual flash/glitch.

Added smooth fade-in animation (300ms) to email viewer for better UX.

The loading state is now properly handled by the skeleton loader that
was added in the previous commit, so this intermediate loading banner
is no longer needed and was causing the visual glitch reported by the user.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 12:40:52 +02:00
Matthieu MALVACHEandClaude f66f7eaaa5 feat: Add smooth animations and visual feedback to batch operations
Enhanced the batch operations UI with polished animations and transitions:

**Toolbar Animations:**
- Smooth slide-down transition for batch actions toolbar (300ms ease-in-out)
- Animated slide-in effects for selection count and action buttons
- Collapsible toolbar with max-height and opacity transitions

**Checkbox Animations:**
- Zoom-in animation when checkboxes are checked (200ms)
- Scale effects on hover (110%) and active (95%) states
- Smooth opacity transitions for unchecked states
- Color transitions for checked state (blue theme)

**Selection Feedback:**
- Blue ring highlight on selected email items
- Subtle background tint for selected emails
- Animated "select all" button with scale and zoom effects
- Visual separator between action buttons

**Loading States:**
- Spinning loader icons during batch operations
- Disabled state with reduced opacity during processing
- 500ms delay after operations for smooth visual feedback
- Prevents multiple simultaneous batch operations

**Visual Polish:**
- Hover effects with background color transitions
- Active state feedback on all interactive elements
- Proper pluralization (email/emails) in selection count
- Consistent transition timing across all animations

All animations use Tailwind's built-in utilities and follow smooth easing curves for a premium feel.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 12:39:29 +02:00
Matthieu MALVACHE 5f7dafeeba fix: Prevent autocomplete menu from reopening after selection on login page
- Add justSelectedSuggestion ref to track when a suggestion is selected
- Skip showing suggestions in useEffect when selection just occurred
- Fixes issue where menu would reopen immediately after Enter key selection
2025-10-02 12:34:36 +02:00