2024-12-02 11:17:25 +01:00
|
|
|
<template>
|
2025-03-28 01:16:24 +01:00
|
|
|
<Card class="*:w-full p-2">
|
2025-04-10 18:44:53 +02:00
|
|
|
<Collapsible :default-open="true" v-slot="{ open }" class="space-y-1">
|
2024-12-02 11:17:25 +01:00
|
|
|
<Tooltip>
|
|
|
|
|
<TooltipTrigger :as-child="true">
|
2025-03-28 01:16:24 +01:00
|
|
|
<CardHeader
|
|
|
|
|
v-if="notification.account"
|
2025-04-10 18:44:53 +02:00
|
|
|
class="flex flex-row items-center gap-2 px-2"
|
2025-03-28 01:16:24 +01:00
|
|
|
>
|
2024-12-02 12:33:53 +01:00
|
|
|
<component :is="icon" class="size-5 shrink-0" />
|
2025-03-28 01:16:24 +01:00
|
|
|
<Avatar
|
|
|
|
|
class="size-5 border border-card"
|
|
|
|
|
:src="notification.account.avatar"
|
|
|
|
|
:name="notification.account.display_name"
|
|
|
|
|
/>
|
|
|
|
|
<span
|
|
|
|
|
class="font-semibold text-sm"
|
|
|
|
|
v-render-emojis="notification.account.emojis"
|
|
|
|
|
>{{ notification.account.display_name }}</span
|
|
|
|
|
>
|
2024-12-02 12:33:53 +01:00
|
|
|
<CollapsibleTrigger :as-child="true">
|
2025-03-28 01:16:24 +01:00
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
|
size="icon"
|
|
|
|
|
class="ml-auto [&_svg]:data-[state=open]:-rotate-180"
|
|
|
|
|
:title="open ? 'Collapse' : 'Expand'"
|
|
|
|
|
>
|
2024-12-02 12:33:53 +01:00
|
|
|
<ChevronDown class="duration-200" />
|
|
|
|
|
</Button>
|
|
|
|
|
</CollapsibleTrigger>
|
2024-12-02 11:17:25 +01:00
|
|
|
</CardHeader>
|
|
|
|
|
</TooltipTrigger>
|
|
|
|
|
<TooltipContent>
|
|
|
|
|
<p>{{ text }}</p>
|
|
|
|
|
</TooltipContent>
|
|
|
|
|
</Tooltip>
|
2024-12-02 12:33:53 +01:00
|
|
|
<CollapsibleContent :as-child="true">
|
|
|
|
|
<CardContent class="p-0">
|
2025-03-28 01:16:24 +01:00
|
|
|
<Note
|
|
|
|
|
v-if="notification.status"
|
|
|
|
|
:note="notification.status"
|
|
|
|
|
:small-layout="true"
|
|
|
|
|
:hide-actions="true"
|
|
|
|
|
/>
|
|
|
|
|
<FollowRequest
|
|
|
|
|
v-else-if="
|
|
|
|
|
notification.type === 'follow_request' &&
|
|
|
|
|
notification.account
|
|
|
|
|
"
|
|
|
|
|
:follower="notification.account"
|
|
|
|
|
/>
|
2024-12-02 12:33:53 +01:00
|
|
|
</CardContent>
|
|
|
|
|
</CollapsibleContent>
|
|
|
|
|
</Collapsible>
|
|
|
|
|
</Card>
|
2024-12-02 11:17:25 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import type { Notification } from "@versia/client/types";
|
|
|
|
|
import {
|
|
|
|
|
AtSign,
|
2024-12-02 12:33:53 +01:00
|
|
|
ChevronDown,
|
2024-12-02 11:17:25 +01:00
|
|
|
Heart,
|
|
|
|
|
Repeat,
|
|
|
|
|
User,
|
|
|
|
|
UserCheck,
|
|
|
|
|
UserPlus,
|
|
|
|
|
} from "lucide-vue-next";
|
2024-12-02 12:33:53 +01:00
|
|
|
import { Button } from "~/components/ui/button";
|
2024-12-02 11:17:25 +01:00
|
|
|
import { Card, CardContent, CardHeader } from "~/components/ui/card";
|
2024-12-02 12:33:53 +01:00
|
|
|
import {
|
|
|
|
|
Collapsible,
|
|
|
|
|
CollapsibleContent,
|
|
|
|
|
CollapsibleTrigger,
|
|
|
|
|
} from "~/components/ui/collapsible";
|
2024-12-02 11:17:25 +01:00
|
|
|
import {
|
|
|
|
|
Tooltip,
|
|
|
|
|
TooltipContent,
|
|
|
|
|
TooltipTrigger,
|
|
|
|
|
} from "~/components/ui/tooltip";
|
2024-12-07 22:17:22 +01:00
|
|
|
import * as m from "~/paraglide/messages.js";
|
2024-12-02 11:17:25 +01:00
|
|
|
import Note from "../notes/note.vue";
|
2024-12-03 14:16:16 +01:00
|
|
|
import Avatar from "../profiles/avatar.vue";
|
2024-12-02 12:33:53 +01:00
|
|
|
import FollowRequest from "./follow-request.vue";
|
2024-12-02 11:17:25 +01:00
|
|
|
|
|
|
|
|
const { notification } = defineProps<{
|
|
|
|
|
notification: Notification;
|
|
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
const icon = computed(() => {
|
|
|
|
|
switch (notification.type) {
|
|
|
|
|
case "mention":
|
|
|
|
|
return AtSign;
|
|
|
|
|
case "reblog":
|
|
|
|
|
return Repeat;
|
|
|
|
|
case "follow":
|
|
|
|
|
return UserPlus;
|
|
|
|
|
case "favourite":
|
|
|
|
|
return Heart;
|
|
|
|
|
case "follow_request":
|
|
|
|
|
return User;
|
|
|
|
|
case "follow_accept":
|
|
|
|
|
return UserCheck;
|
|
|
|
|
default:
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const text = computed(() => {
|
|
|
|
|
switch (notification.type) {
|
|
|
|
|
case "mention":
|
2024-12-07 22:17:22 +01:00
|
|
|
return m.fuzzy_orange_tuna_succeed();
|
2024-12-02 11:17:25 +01:00
|
|
|
case "reblog":
|
2024-12-07 22:17:22 +01:00
|
|
|
return m.grand_proof_quail_read();
|
2024-12-02 11:17:25 +01:00
|
|
|
case "follow":
|
2024-12-07 22:17:22 +01:00
|
|
|
return m.top_steep_scallop_care();
|
2024-12-02 11:17:25 +01:00
|
|
|
case "favourite":
|
2024-12-07 22:17:22 +01:00
|
|
|
return m.swift_just_beetle_devour();
|
2024-12-02 11:17:25 +01:00
|
|
|
case "follow_request":
|
2024-12-07 22:17:22 +01:00
|
|
|
return m.seemly_short_thrush_bloom();
|
2024-12-02 11:17:25 +01:00
|
|
|
case "follow_accept":
|
2024-12-07 22:17:22 +01:00
|
|
|
return m.weird_seemly_termite_scold();
|
2024-12-02 11:17:25 +01:00
|
|
|
default:
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-12-02 12:33:53 +01:00
|
|
|
</script>
|