2024-12-02 11:17:25 +01:00
|
|
|
<template>
|
2024-12-02 12:33:53 +01:00
|
|
|
<Card>
|
|
|
|
|
<Collapsible>
|
2024-12-02 11:17:25 +01:00
|
|
|
<Tooltip>
|
|
|
|
|
<TooltipTrigger :as-child="true">
|
2024-12-02 12:33:53 +01:00
|
|
|
<CardHeader v-if="notification.account"
|
|
|
|
|
class="flex-row items-center gap-2 px-4 py-2 border-b border-border">
|
|
|
|
|
<component :is="icon" class="size-5 shrink-0" />
|
2024-12-02 11:17:25 +01:00
|
|
|
<Avatar class="size-6 rounded-md border border-card">
|
|
|
|
|
<AvatarImage :src="notification.account.avatar" alt="" />
|
|
|
|
|
<AvatarFallback class="rounded-lg"> AA </AvatarFallback>
|
|
|
|
|
</Avatar>
|
2024-12-02 12:33:53 +01:00
|
|
|
<span class="font-semibold">{{
|
|
|
|
|
notification.account.display_name
|
|
|
|
|
}}</span>
|
|
|
|
|
<CollapsibleTrigger :as-child="true">
|
|
|
|
|
<Button variant="ghost" size="icon" class="ml-auto [&_svg]:data-[state=open]:-rotate-180">
|
|
|
|
|
<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">
|
|
|
|
|
<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" />
|
|
|
|
|
</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";
|
|
|
|
|
import { Avatar, AvatarFallback, AvatarImage } from "~/components/ui/avatar";
|
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";
|
|
|
|
|
import Note from "../notes/note.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":
|
|
|
|
|
return "Mentioned you";
|
|
|
|
|
case "reblog":
|
|
|
|
|
return "Reblogged your note";
|
|
|
|
|
case "follow":
|
|
|
|
|
return "Followed you";
|
|
|
|
|
case "favourite":
|
|
|
|
|
return "Liked your note";
|
|
|
|
|
case "follow_request":
|
|
|
|
|
return "Requested to follow you";
|
|
|
|
|
case "follow_accept":
|
|
|
|
|
return "Accepted your follow request";
|
|
|
|
|
default:
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-12-02 12:33:53 +01:00
|
|
|
</script>
|