2024-04-27 03:28:12 +02:00
|
|
|
<template>
|
|
|
|
|
<div class="flex flex-col p-1 bg-dark-400">
|
|
|
|
|
<div class="px-4 pt-2 pb-3 flex flex-row gap-2 items-center">
|
|
|
|
|
<Skeleton :enabled="!notification" shape="rect" class="!h-6" :min-width="40" :max-width="100"
|
|
|
|
|
width-unit="%">
|
2024-05-12 11:04:00 +02:00
|
|
|
<iconify-icon :icon="icon" width="1.5rem" height="1.5rem" class="text-gray-200" aria-hidden="true" />
|
2024-05-12 10:37:57 +02:00
|
|
|
<AvatarsCentered v-if="notification?.account?.avatar" :src="notification?.account.avatar"
|
2024-05-03 05:28:31 +02:00
|
|
|
:alt="`${notification?.account.acct}'s avatar'`"
|
|
|
|
|
class="h-6 w-6 shrink-0 rounded ring-1 ring-white/10" />
|
2024-04-28 07:02:27 +02:00
|
|
|
<span class="text-gray-200"><strong v-html="accountName"></strong> {{ text
|
|
|
|
|
}}</span>
|
2024-04-27 03:28:12 +02:00
|
|
|
</Skeleton>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2024-05-12 09:30:02 +02:00
|
|
|
<LazySocialElementsNotesNote v-if="notification?.status || !notification" :note="notification?.status"
|
2024-04-27 03:28:12 +02:00
|
|
|
:small="true" />
|
|
|
|
|
<div v-else-if="notification.account" class="p-6 ring-1 ring-white/5 bg-dark-800">
|
|
|
|
|
<SocialElementsUsersSmallCard :account="notification.account" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2024-04-27 06:50:30 +02:00
|
|
|
import type { Notification } from "~/types/mastodon/notification";
|
2024-04-27 03:28:12 +02:00
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
|
notification?: Notification;
|
|
|
|
|
}>();
|
|
|
|
|
|
2024-04-27 06:50:30 +02:00
|
|
|
const accountName = useParsedContent(
|
|
|
|
|
props.notification?.account?.display_name ?? "",
|
|
|
|
|
props.notification?.account?.emojis ?? [],
|
|
|
|
|
);
|
2024-04-27 03:28:12 +02:00
|
|
|
const text = computed(() => {
|
2024-04-27 06:50:30 +02:00
|
|
|
if (!props.notification) return "";
|
2024-04-27 03:28:12 +02:00
|
|
|
|
|
|
|
|
switch (props.notification.type) {
|
2024-04-27 06:50:30 +02:00
|
|
|
case "mention":
|
|
|
|
|
return "mentioned you";
|
|
|
|
|
case "reblog":
|
|
|
|
|
return "reblogged your note";
|
|
|
|
|
case "favourite":
|
|
|
|
|
return "liked your note";
|
|
|
|
|
case "follow":
|
|
|
|
|
return "followed you";
|
|
|
|
|
case "follow_request":
|
|
|
|
|
return "requested to follow you";
|
2024-04-27 03:28:12 +02:00
|
|
|
default:
|
2024-04-27 06:50:30 +02:00
|
|
|
console.error("Unknown notification type", props.notification.type);
|
|
|
|
|
return "";
|
2024-04-27 03:28:12 +02:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
const icon = computed(() => {
|
2024-04-27 06:50:30 +02:00
|
|
|
if (!props.notification) return "";
|
2024-04-27 03:28:12 +02:00
|
|
|
|
|
|
|
|
switch (props.notification.type) {
|
2024-04-27 06:50:30 +02:00
|
|
|
case "mention":
|
|
|
|
|
return "tabler:at";
|
|
|
|
|
case "reblog":
|
|
|
|
|
return "tabler:repeat";
|
|
|
|
|
case "favourite":
|
|
|
|
|
return "tabler:heart";
|
|
|
|
|
case "follow":
|
|
|
|
|
return "tabler:plus";
|
|
|
|
|
case "follow_request":
|
|
|
|
|
return "tabler:plus";
|
2024-04-27 03:28:12 +02:00
|
|
|
default:
|
2024-04-27 06:50:30 +02:00
|
|
|
return "";
|
2024-04-27 03:28:12 +02:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
</script>
|