Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resources/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ body {
.lucide {
width: 16px;
height: 16px;
flex-shrink: 0;
}
12 changes: 12 additions & 0 deletions resources/js/components/FlashMessages.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@
import { ref, watch } from 'vue'
import { usePage } from '@inertiajs/vue3'
import { Check, CircleX, Info, TriangleAlert, Megaphone } from 'lucide-vue-next'
import { FlashProps } from '@/types'

const page = usePage()
const flashed = ref(0)

const clearFlash = (type: keyof FlashProps) => {
if (page.props.flash?.[type]) {
page.props.flash[type] = null
}
}

watch(() => page.props.flash, () => {
flashed.value++
}, { deep: true })
Expand All @@ -21,6 +28,7 @@ watch(() => page.props.flash, () => {
class="mb-6"
severity="success"
closable
@close="clearFlash('success')"
>
<template #icon>
<Check />
Expand All @@ -32,6 +40,7 @@ watch(() => page.props.flash, () => {
class="mb-6"
severity="info"
closable
@close="clearFlash('info')"
>
<template #icon>
<Info />
Expand All @@ -43,6 +52,7 @@ watch(() => page.props.flash, () => {
class="mb-6"
severity="warn"
closable
@close="clearFlash('warn')"
>
<template #icon>
<TriangleAlert />
Expand All @@ -54,6 +64,7 @@ watch(() => page.props.flash, () => {
class="mb-6"
severity="error"
closable
@close="clearFlash('error')"
>
<template #icon>
<CircleX />
Expand All @@ -65,6 +76,7 @@ watch(() => page.props.flash, () => {
class="mb-6"
severity="secondary"
closable
@close="clearFlash('message')"
>
<template #icon>
<Megaphone />
Expand Down