Add: No toast notification system or success feedback + No corrections/supersession UI

This commit is contained in:
voltsrage
2026-06-27 16:36:35 +08:00
parent efd3974d1f
commit 2d36d1a5dd
15 changed files with 598 additions and 29 deletions
@@ -0,0 +1,31 @@
import { ref } from 'vue'
export type ToastType = 'success' | 'error' | 'warning' | 'info'
export interface Toast {
id: number
message: string
type: ToastType
duration: number
}
let nextId = 0
export const toasts = ref<Toast[]>([])
function addToast(message: string, type: ToastType, duration = 4000) {
const id = nextId++
toasts.value.push({ id, message, type, duration })
setTimeout(() => {
toasts.value = toasts.value.filter(t => t.id !== id)
}, duration)
}
export function useToast() {
return {
success: (message: string) => addToast(message, 'success'),
error: (message: string) => addToast(message, 'error', 6000),
warning: (message: string) => addToast(message, 'warning', 5000),
info: (message: string) => addToast(message, 'info'),
toasts,
}
}