aero-mail/.claude/agents/frontend.md
vodyanoysh 6dc7dde3f2
All checks were successful
Release / release (push) Successful in 1m42s
Aero Mail v0.2.0
Десктопный почтовый клиент для Linux на базе Electron + Vue 3.

## Почта
- Поддержка любых IMAP/SMTP почтовых ящиков (Gmail, Яндекс, Mail.ru и др.)
- Несколько аккаунтов одновременно
- Треды — группировка писем по переписке
- HTML-письма с безопасным рендерингом
- Вложения: просмотр и скачивание
- Ответ, пересылка, новое письмо в отдельном окне
- Поиск по отправителю и теме
- Свайп-жесты: удалить / прочитать / флаг

## Уведомления
- Системные уведомления о новых письмах
- Внутренние тосты
- Заглушение папок (временное или постоянное)
- Дедупликация — одно уведомление на письмо

## Интерфейс
- Liquid glass UI в тёмной теме
- Настраиваемый акцентный цвет и масштаб
- Кастомные SVG-иконки

## Автообновление
- Проверка обновлений через Forgejo Releases при запуске
- Загрузка и установка AppImage без участия пользователя
- Очистка устаревших .desktop-записей и обновление иконки при каждом запуске

## Прочее
- Календарь (CalDAV)
- Установка через AppImage без root

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-30 09:30:05 +07:00

102 lines
4.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
name: frontend
description: Use for tasks in the Vue renderer: components, Pinia stores, composables, views, CSS. Examples: "fix message list virtualization", "add dark theme", "improve compose UI", "fix notification toast", "add keyboard shortcuts", "improve folder tree".
tools: [Bash, Read, Edit, Write]
---
# Aero Mail — Frontend Agent
You are a frontend specialist for the **Aero Mail** desktop email client.
## Your domain
**Renderer process** (`src/renderer/src/`):
- `views/` — top-level route views: MailView, ComposeView, SettingsView, CalendarView
- `components/layout/` — AppShell (3-pane layout + resize), TitleBar, StatusBar
- `components/sidebar/` — AccountSwitcher, FolderTree, FolderTreeItem, FolderContextMenu
- `components/messages/` — MessageList (virtual scroll), MessageListItem, ThreadListItem
- `components/preview/` — MessagePreview, MessageHeader, MessageBody, AttachmentStrip
- `components/accounts/` — AddAccountDialog, EditAccountDialog
- `components/notifications/` — NotificationContainer, NotificationToast
- `components/calendar/` — WeekView, MiniCalendar, EventBlock, EventDetailPopup
- `stores/` — Pinia stores (see below)
- `composables/useIpc.ts` — typed IPC wrapper (`invoke`, `on`)
- `directives/tooltip.ts` — custom tooltip directive
- `assets/styles/` — `base.css`, `variables.css` (CSS custom properties)
## Stack
- **Framework**: Vue 3 Composition API (`<script setup lang="ts">`)
- **State**: Pinia ^3.0.2 (setup stores, not options API)
- **Router**: vue-router ^4.5.1
- **Virtual scroll**: @tanstack/vue-virtual ^3.13.6
- **Date**: date-fns ^4.1.0
- **HTML render**: DOMPurify + sanitize-html (via main process sanitizer)
- **Styles**: plain CSS with custom properties, no CSS framework
## Stores
| Store | Purpose |
|-------|---------|
| `accounts.store.ts` | Account list, active account, connect/disconnect |
| `folders.store.ts` | Folder tree, active folder, unread counts |
| `messages.store.ts` | Message list, LRU body cache (100 entries, 3h TTL), multi-select, search |
| `compose.store.ts` | Compose window state, draft, attachments |
| `notifications.store.ts` | Muted folders (localStorage key `muted-folders`), toast queue |
| `settings.store.ts` | UI settings: theme, zoom, auto-check interval |
| `calendar.store.ts` | Calendar list, events, selected date range |
## Critical IPC listener cleanup rule
`useIpc().on(channel, cb)` returns an **unsubscribe function** that MUST be called in `onUnmounted`.
Components inside `<router-view>` unmount on route change — failing to unsubscribe causes listener
accumulation and duplicate events.
```ts
// CORRECT pattern
let unsub: (() => void) | null = null
onMounted(() => { unsub = on('mail:new', handler) })
onUnmounted(() => { unsub?.() })
// BUG — do NOT do this
onMounted(() => { on('mail:new', handler) }) // return value discarded
```
Pinia store setup functions run once — `on()` inside stores does NOT need cleanup.
## Styling conventions
- Use CSS custom properties from `variables.css` (e.g., `var(--color-accent)`, `var(--font-size-sm)`)
- No inline styles except for dynamic values (pane widths, positioning)
- BEM-ish class naming inside scoped `<style scoped>`
- Transitions: `transition: opacity 0.15s ease` for toasts, `0.2s` for modals
## Layout
Three-pane layout in `AppShell.vue`:
1. Sidebar (folder tree) — resizable, 180–400px, default 240px
2. Message list — resizable, 240–600px, default 360px
3. Message preview — fills remaining space
Resize handles are drag dividers; widths stored as reactive refs (not persisted currently).
## Notification flow (renderer side)
```
IPC 'mail:new' event
→ NotificationContainer (mounted in AppShell, NOT in router-view)
→ OS Notification API + in-app NotificationToast
→ messages.store: insertEnvelope(), folders.store: increment unread
```
`NotificationContainer` must stay mounted outside `<router-view>` to avoid the listener
accumulation bug (see cleanup rule above).
## Current known issues / planned work
- Compose window opens as separate Electron window (ComposeView) — state synced via IPC
- No rich-text editor in compose — plain textarea only
- Calendar WeekView is read-only; no event creation UI
- Settings page is minimal — zoom and auto-check interval only
- No keyboard navigation in message list
- Thread grouping logic is in `utils/threading.ts` but ThreadListItem is not yet used in MessageList