mealie/frontend/components/Layout/LayoutParts/TheSnackbar.vue
Hoa (Kyle) Trinh c24d532608
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Docker Nightly Production / Backend Server Tests (push) Waiting to run
Docker Nightly Production / Frontend Tests (push) Waiting to run
Docker Nightly Production / Build Package (push) Waiting to run
Docker Nightly Production / Build Tagged Release (push) Blocked by required conditions
Docker Nightly Production / Notify Discord (push) Blocked by required conditions
Release Drafter / ✏️ Draft release (push) Waiting to run
feat: Migrate to Nuxt 3 framework (#5184)
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
2025-06-19 17:09:12 +00:00

75 lines
1.7 KiB
Vue

<template>
<div class="text-center">
<v-snackbar
v-model="toastAlert.open"
location="top"
:color="toastAlert.color"
timeout="2000"
>
<v-icon
v-if="icon"
dark
start
:icon="icon"
/>
{{ toastAlert.title }}
{{ toastAlert.text }}
<template #actions>
<v-btn
variant="text"
@click="toastAlert.open = false"
>
{{ $t('general.close') }}
</v-btn>
</template>
</v-snackbar>
<v-snackbar
v-model="toastLoading.open"
content-class="py-2"
density="compact"
location="bottom"
:timeout="-1"
:color="toastLoading.color"
>
<div
class="d-flex flex-column align-center justify-start"
@click="toastLoading.open = false"
>
<div class="mb-2 mt-0 text-subtitle-1 text-center">
{{ toastLoading.text }}
</div>
<v-progress-linear
indeterminate
color="white-darken-2"
/>
</div>
</v-snackbar>
</div>
</template>
<script lang="ts">
import { useNuxtApp } from "#app";
import { toastAlert, toastLoading } from "~/composables/use-toast";
export default {
setup() {
const { $globals } = useNuxtApp();
const icon = computed(() => {
switch (toastAlert.color) {
case "error":
return $globals.icons.alertOutline;
case "success":
return $globals.icons.checkBold;
case "info":
return $globals.icons.informationOutline;
default:
return $globals.icons.alertOutline;
}
});
return { icon, toastAlert, toastLoading };
},
};
</script>