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>
This commit is contained in:
1 parent
d251ec73d0
commit
dcc3d7f2d5
12 files changed
+316
-93
No files matched your search
@@ -0,0 +1,28 @@
|
||||
# Toast notifications (2026-10-04)
|
||||
|
||||
Goal: pop-up notifications in the bottom-right corner of the screen, readable in the light and the dark theme. Plan: [Toast_Notifications_PLAN](2026-10-04_Toast_Notifications_PLAN.md). UI only.
|
||||
|
||||
## Changes
|
||||
|
||||
| Area | Change |
|
||||
|---|---|
|
||||
| `composables/useToast.js` | Shared state: `show(text, type, timeout)`, `dismiss`, `pause`, `resume`; types `success`, `warning`, `error`, `info`; 5 s (errors 8 s); at most 4 on screen |
|
||||
| `components/ToastContainer.vue` | Mounted once in `App.vue` (also on the Login page): icon, text, close button, progress bar; slide-in from the right; hover pauses the timer; `role="alert"` for errors, `role="status"` otherwise |
|
||||
| `assets/main.css` | Fixed bottom-right stack above modals; surface from the theme variables, coloured stripe/icon/progress bar per type; separate colour tokens for the light and the dark theme; full width on phones; reduced motion supported. Old `.toast-message` styles removed |
|
||||
| Views | `PKIConfig.vue`, `VPNConfig.vue`, `ServerManagement.vue`, `Certificates.vue` use the shared toast; their `showMessage` / `showToast` helpers are one-line wrappers, call sites unchanged; inline markup and local timers removed |
|
||||
|
||||
Not changed: SweetAlert2 dialogs in `Account.vue` and inline alerts on the Login page.
|
||||
|
||||
## Verification
|
||||
|
||||
`app-ui` image builds (Vite), the toast styles are in the bundle and the old ones are gone; appearance and behaviour (both themes, several toasts, hover pause, narrow window, toast over a modal) are checked manually.
|
||||
|
||||
## Notes
|
||||
|
||||
- Durations are unified: 5 s, errors 8 s (was 3 to 5 s).
|
||||
- Toasts are global, so a message raised right before a route change stays visible after it.
|
||||
- Touch devices have no hover: toasts there simply time out.
|
||||
|
||||
## Existing installations
|
||||
|
||||
Rebuild the UI image (`app-ui`); no configuration or data changes.
|
||||
@@ -0,0 +1,20 @@
|
||||
# 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.
|
||||
@@ -21,6 +21,7 @@ Welcome to the documentation for the OpenVPN Monitor suite.
|
||||
- [Egress via Hysteria2 (2026-09-30)](../Changes/2026-09-30_Egress_via_Hysteria2.md)
|
||||
- [Profile notes (2026-10-04)](../Changes/2026-10-04_Profile_Notes.md)
|
||||
- [Async PKI init (2026-10-04)](../Changes/2026-10-04_Async_PKI_Init.md)
|
||||
- [Toast notifications (2026-10-04)](../Changes/2026-10-04_Toast_Notifications.md)
|
||||
|
||||
## 🔍 Core Monitoring (`APP_CORE`)
|
||||
The core module responsible for log parsing, real-time statistics, and the primary API.
|
||||
|
||||
Reference in new issue
Block a user