feat(ui): compact toast notifications and skeleton editor selection
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user