2024-11-16 19:41:19 +11:00
|
|
|
<template>
|
|
|
|
|
<div class="pointer-events-auto w-full bg-zinc-950/40 rounded">
|
|
|
|
|
<div class="p-4">
|
|
|
|
|
<div class="flex items-start">
|
|
|
|
|
<div class="w-0 flex-1 pt-0.5">
|
|
|
|
|
<p class="text-sm font-medium text-zinc-100">
|
|
|
|
|
{{ notification.title }}
|
|
|
|
|
</p>
|
2024-11-19 11:11:59 +11:00
|
|
|
<p class="mt-1 text-sm text-zinc-400 line-clamp-3">
|
2024-11-16 19:41:19 +11:00
|
|
|
{{ notification.description }}
|
|
|
|
|
</p>
|
|
|
|
|
<div
|
|
|
|
|
v-if="notification.actions.length > 0"
|
|
|
|
|
class="mt-3 flex space-x-7"
|
|
|
|
|
>
|
2025-03-11 17:08:31 +11:00
|
|
|
<NuxtLink
|
|
|
|
|
v-for="[name, link] in notification.actions.map((e) =>
|
2025-04-15 21:46:34 -04:00
|
|
|
e.split('|'),
|
2025-03-11 17:08:31 +11:00
|
|
|
)"
|
2025-04-12 16:03:35 -04:00
|
|
|
:key="name"
|
2024-11-16 19:41:19 +11:00
|
|
|
type="button"
|
2025-03-11 17:08:31 +11:00
|
|
|
:href="link"
|
|
|
|
|
class="rounded-md text-sm font-medium text-blue-600 hover:text-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"
|
2024-11-16 19:41:19 +11:00
|
|
|
>
|
2025-03-11 17:08:31 +11:00
|
|
|
{{ name }}
|
|
|
|
|
</NuxtLink>
|
2024-11-16 19:41:19 +11:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="ml-4 flex shrink-0">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
2024-11-19 11:11:59 +11:00
|
|
|
class="inline-flex rounded-md text-zinc-400 hover:text-zinc-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"
|
2025-04-13 21:44:29 -04:00
|
|
|
@click="() => deleteMe()"
|
2024-11-16 19:41:19 +11:00
|
|
|
>
|
2025-07-30 13:40:49 +10:00
|
|
|
<span class="sr-only">{{ $t("common.close") }}</span>
|
2024-11-16 19:41:19 +11:00
|
|
|
<XMarkIcon class="size-5" aria-hidden="true" />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { XMarkIcon } from "@heroicons/vue/24/solid";
|
2025-11-30 23:01:52 +11:00
|
|
|
import type { SerializeObject } from "nitropack";
|
2025-07-25 07:28:00 -04:00
|
|
|
import type { NotificationModel } from "~/prisma/client/models";
|
2024-11-16 19:41:19 +11:00
|
|
|
|
2025-11-30 23:01:52 +11:00
|
|
|
const props = defineProps<{
|
|
|
|
|
notification: SerializeObject<NotificationModel>;
|
|
|
|
|
}>();
|
2024-11-16 19:41:19 +11:00
|
|
|
|
|
|
|
|
async function deleteMe() {
|
2025-07-30 13:40:49 +10:00
|
|
|
await $dropFetch(`/api/v1/notifications/:id`, {
|
2024-11-16 19:41:19 +11:00
|
|
|
method: "DELETE",
|
2025-07-30 13:40:49 +10:00
|
|
|
params: {
|
|
|
|
|
id: props.notification.id,
|
|
|
|
|
},
|
2024-11-16 19:41:19 +11:00
|
|
|
});
|
|
|
|
|
const notifications = useNotifications();
|
|
|
|
|
const indexOfMe = notifications.value.findIndex(
|
2025-04-15 21:46:34 -04:00
|
|
|
(e) => e.id === props.notification.id,
|
2024-11-16 19:41:19 +11:00
|
|
|
);
|
|
|
|
|
// Delete me
|
|
|
|
|
notifications.value.splice(indexOfMe, 1);
|
|
|
|
|
}
|
|
|
|
|
</script>
|