feat(ui): compact toast notifications and skeleton editor selection

This commit is contained in:
Matthieu
2025-09-30 15:57:02 +02:00
parent 9a55e29b74
commit 7b2e509b04
2 changed files with 31 additions and 18 deletions

View File

@@ -1,10 +1,11 @@
import { ref } from 'vue'
const toasts = ref([])
const MAX_TOASTS = 3
let nextId = 1
export function useToast () {
const showToast = (message, type = 'info', duration = 5000) => {
const showToast = (message, type = 'info', duration = 3500) => {
const id = nextId++
const toast = {
id,
@@ -13,6 +14,10 @@ export function useToast () {
visible: true
}
if (toasts.value.length >= MAX_TOASTS) {
toasts.value.shift()
}
toasts.value.push(toast)
// Auto-remove after duration
@@ -27,7 +32,7 @@ export function useToast () {
return showToast(message, 'success', duration)
}
const showError = (message, duration = 7000) => {
const showError = (message, duration = 5000) => {
return showToast(message, 'error', duration)
}