Deletions, group moves and validation

This commit is contained in:
2025-07-15 16:53:37 +02:00
parent 412a84150e
commit 3efc4d7fa5
11 changed files with 268 additions and 52 deletions

View File

@ -4,7 +4,17 @@ import { defineStore } from 'pinia'
interface Alert {
id: number
message: string
type: 'info' | 'success' | 'warning' | 'error'
title?: string
type: 'info' | 'success' | 'warning' | 'error' | 'danger'
icon: string
}
const iconMap = {
'info': 'info-circle',
'success': 'check2-circle',
'warning': 'exclamation-triangle',
'error': 'exclamation-octagon',
'danger': 'exclamation-octagon',
}
export const useAlertsStore = defineStore('alerts', {
@ -12,11 +22,24 @@ export const useAlertsStore = defineStore('alerts', {
alerts: [] as Alert[],
}),
actions: {
showAlert(message: string, type: Alert['type'] = 'info') {
showAlert(message: string, type: Alert['type'] = 'info', title?: string) {
if (type === 'error') {
type = 'danger'
}
if (!title) {
if (type === 'danger') {
title = 'Error'
} else {
title = type
}
}
const icon = iconMap[type]
this.alerts.push({
id: Date.now(),
message,
title,
type,
icon,
})
},
removeAlert(id: number) {