Files
OpenVPN-Monitoring-Simple/DOCS/Changes/2026-10-04_Toast_Notifications_PLAN.md
T
ayurishchevandClaude Sonnet 5.5 dcc3d7f2d5 UI: shared toast notifications in the bottom-right corner
- useToast composable and ToastContainer (mounted once in App.vue):
  stacked toasts with icon, close button and progress bar, hover pause,
  slide-in animation, aria roles, full width on phones.
- Light and dark theme colour tokens; old .toast-message styles removed.
- PKIConfig, VPNConfig, ServerManagement and Certificates use the shared
  toast through thin showMessage/showToast wrappers.
- Docs: plan and summary in DOCS/Changes, README, Index.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-04 21:05:41 +03:00

2.5 KiB

Toast notifications: implementation plan (2026-10-04)

Goal: pop-up notifications appear in the bottom-right corner of the screen, are not lost, and look good in the light and dark themes. UI only.

Current state

  • Four views implement their own notification: PKIConfig.vue, VPNConfig.vue, ServerManagement.vue render .toast-message inside the page card (top of the page, scrolls away, one message at a time); Certificates.vue has its own fixed bottom-right copy with inline styles.
  • Styles (assets/main.css, .toast-message, .toast-success|warning|error) use fixed light colours, no dark theme.
  • Account.vue uses SweetAlert2 dialogs and Login.vue inline alerts: these are dialogs, not toasts, and stay as they are.

Steps

  1. src/composables/useToast.js: shared reactive list of toasts; show(text, type = 'success', timeout) with types success | warning | error | info; dismiss(id). Default timeout 5 s (errors 8 s); max 4 on screen (oldest dropped).
  2. src/components/ToastContainer.vue, mounted once in App.vue: fixed bottom-right (z-index above modals), stacked column, TransitionGroup slide-in from the right and fade-out; each toast has an icon, text, close button, thin progress bar; the timer pauses on hover; role="status" (role="alert" for errors) with aria-live; on phones full width at the bottom.
  3. Design (main.css): card surface from existing variables (--bg-card, --border-color, --text-main), a coloured accent stripe and icon per type, soft shadow; separate colour tokens for the light and the dark theme ([data-theme="dark"]) so contrast stays readable in both. Old .toast-message styles are removed.
  4. Views: PKIConfig.vue, VPNConfig.vue, ServerManagement.vue, Certificates.vue call useToast().show(...) (their showMessage / showToast helpers stay as thin wrappers, call sites are not changed); inline toast markup and local timers are removed.
  5. Tests: none (no UI test infrastructure; no logic on the server side).
  6. Verification: rebuild app-ui on the stand (port 8089) and check manually: all four pages, success / warning / error, several toasts at once, hover pause, close button, light and dark theme, narrow window, toast above an open modal (Certificates note save).
  7. Documentation: summary DOCS/Changes/2026-10-04_Toast_Notifications.md, row in README.md, link in DOCS/General/Index.md.

Out of scope

SweetAlert2 dialogs in Account.vue, inline login alerts, sound, persistent notification history.