Files
api/web/components/UserProfile/DropdownError.vue
2024-05-16 14:13:01 -07:00

30 lines
1.1 KiB
Vue

<script setup lang="ts">
// eslint-disable vue/no-v-html
import { storeToRefs } from 'pinia';
import type { ComposerTranslation } from 'vue-i18n';
import { useErrorsStore } from '~/store/errors';
import type { UserProfileLink } from '~/types/userProfile';
defineProps<{ t: ComposerTranslation; }>();
const errorsStore = useErrorsStore();
const { errors } = storeToRefs(errorsStore);
</script>
<template>
<ul v-if="errors.length" class="list-reset flex flex-col gap-y-8px mb-4px border-2 border-solid border-unraid-red/90 rounded-md">
<li v-for="(error, index) in errors" :key="index" class="flex flex-col gap-8px">
<h3 class="text-18px py-4px px-12px text-white bg-unraid-red/90 font-semibold">
<span>{{ t(error.heading) }}</span>
</h3>
<div class="text-14px px-12px flex flex-col gap-y-8px" :class="{ 'pb-8px': !error.actions }" v-html="t(error.message)" />
<nav v-if="error.actions">
<li v-for="(link, idx) in error.actions" :key="`link_${idx}`">
<UpcDropdownItem :item="link as UserProfileLink" :rounded="false" :t="t" />
</li>
</nav>
</li>
</ul>
</template>