Fix toast dismiss, add delete confirms, and polish dashboard CTAs.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { reactive } from 'vue'
|
||||
import { reactive, toRef } from 'vue'
|
||||
|
||||
export type ToastTone = 'success' | 'error' | 'info' | 'warning'
|
||||
|
||||
@@ -19,12 +19,15 @@ function push(message: string, tone: ToastTone) {
|
||||
}
|
||||
|
||||
function dismiss(id: string) {
|
||||
state.items = state.items.filter((item) => item.id !== id)
|
||||
const index = state.items.findIndex((item) => item.id === id)
|
||||
if (index !== -1) {
|
||||
state.items.splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
export function useToast() {
|
||||
return {
|
||||
toasts: state.items,
|
||||
toasts: toRef(state, 'items'),
|
||||
dismiss,
|
||||
success: (message: string) => push(message, 'success'),
|
||||
error: (message: string) => push(message, 'error'),
|
||||
|
||||
Reference in New Issue
Block a user