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,33 @@
|
||||
<template>
|
||||
<div class="toast-stack">
|
||||
<TransitionGroup name="toast" tag="div" class="toast-stack-list">
|
||||
<div v-for="t in toasts" :key="t.id" class="app-toast" :class="'app-toast-' + t.type"
|
||||
:role="t.type === 'error' ? 'alert' : 'status'"
|
||||
:aria-live="t.type === 'error' ? 'assertive' : 'polite'" aria-atomic="true"
|
||||
@mouseenter="pause(t.id)" @mouseleave="resume(t.id)">
|
||||
<i class="fas app-toast-icon" :class="ICONS[t.type]" aria-hidden="true"></i>
|
||||
<div class="app-toast-text">{{ t.text }}</div>
|
||||
<button type="button" class="app-toast-close" aria-label="Close notification" @click="dismiss(t.id)">
|
||||
<i class="fas fa-times" aria-hidden="true"></i>
|
||||
</button>
|
||||
<div v-if="t.timeout > 0" class="app-toast-progress" :style="{ animationDuration: t.timeout + 'ms' }"></div>
|
||||
</div>
|
||||
</TransitionGroup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onBeforeUnmount } from 'vue';
|
||||
import { useToast } from '../composables/useToast';
|
||||
|
||||
const { toasts, dismiss, pause, resume, clear } = useToast();
|
||||
|
||||
const ICONS = {
|
||||
success: 'fa-check-circle',
|
||||
warning: 'fa-exclamation-triangle',
|
||||
error: 'fa-exclamation-circle',
|
||||
info: 'fa-info-circle'
|
||||
};
|
||||
|
||||
onBeforeUnmount(clear);
|
||||
</script>
|
||||
Reference in new issue
Block a user