2024-11-30 02:19:32 +01:00
|
|
|
<template>
|
2025-12-09 23:26:59 +01:00
|
|
|
<div class="flex items-start justify-between">
|
|
|
|
|
<div class="flex items-center gap-3">
|
|
|
|
|
<NuxtLink :href="urlAsPath">
|
2026-01-09 23:10:45 +01:00
|
|
|
<Avatar
|
|
|
|
|
:src="note.account.avatar"
|
|
|
|
|
:name="note.account.display_name"
|
|
|
|
|
/>
|
2025-12-09 23:26:59 +01:00
|
|
|
</NuxtLink>
|
|
|
|
|
<div class="flex flex-col gap-0.5">
|
|
|
|
|
<div class="flex items-center gap-1">
|
|
|
|
|
<span
|
|
|
|
|
class="text-sm font-semibold"
|
2026-01-09 23:10:45 +01:00
|
|
|
v-render-emojis="note.account.emojis"
|
|
|
|
|
>{{ note.account.display_name }}</span
|
2025-12-09 23:26:59 +01:00
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="flex items-center gap-1 text-muted-foreground text-xs"
|
2025-12-09 22:32:22 +01:00
|
|
|
>
|
2025-12-09 23:26:59 +01:00
|
|
|
<span>
|
|
|
|
|
@{{ `${username}${instance ? `@${instance}` : ""}` }}
|
|
|
|
|
</span>
|
|
|
|
|
<span>·</span>
|
|
|
|
|
<span>{{ timeAgo }}</span>
|
|
|
|
|
</div>
|
2025-07-10 05:13:42 +02:00
|
|
|
</div>
|
2024-11-30 02:19:32 +01:00
|
|
|
</div>
|
2026-01-09 23:10:45 +01:00
|
|
|
<Menu @edit="emit('edit')" @delete="emit('delete')">
|
2025-12-09 23:26:59 +01:00
|
|
|
<Button variant="ghost" size="icon">
|
2026-01-09 21:47:12 +01:00
|
|
|
<Ellipsis />
|
2025-12-09 23:26:59 +01:00
|
|
|
</Button>
|
|
|
|
|
</Menu>
|
2024-11-30 18:21:40 +01:00
|
|
|
</div>
|
2024-11-30 02:19:32 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2024-12-02 11:17:25 +01:00
|
|
|
import type {
|
|
|
|
|
UseTimeAgoMessages,
|
|
|
|
|
UseTimeAgoUnitNamesDefault,
|
|
|
|
|
} from "@vueuse/core";
|
2026-01-09 23:10:45 +01:00
|
|
|
import { Ellipsis } from "lucide-vue-next";
|
2024-12-03 14:07:00 +01:00
|
|
|
import Avatar from "../profiles/avatar.vue";
|
2025-12-09 23:26:59 +01:00
|
|
|
import { Button } from "../ui/button";
|
|
|
|
|
import Menu from "./menu.vue";
|
2026-01-09 23:10:45 +01:00
|
|
|
import { key } from "./provider";
|
2024-11-30 02:19:32 +01:00
|
|
|
|
2026-01-09 23:10:45 +01:00
|
|
|
// biome-ignore lint/style/noNonNullAssertion: We want an error if not provided
|
|
|
|
|
const { note } = inject(key)!;
|
2024-11-30 02:19:32 +01:00
|
|
|
|
2026-01-09 23:10:45 +01:00
|
|
|
const [username, instance] = note.account.acct.split("@");
|
2024-12-02 11:17:25 +01:00
|
|
|
const digitRegex = /\d/;
|
2026-01-09 23:10:45 +01:00
|
|
|
const accountUrl = wrapUrl(`/@${note.account.acct}`);
|
|
|
|
|
const urlAsPath = new URL(accountUrl).pathname;
|
|
|
|
|
|
|
|
|
|
const timeAgo = useTimeAgo(note.created_at, {
|
2024-12-02 11:17:25 +01:00
|
|
|
messages: {
|
|
|
|
|
justNow: "now",
|
|
|
|
|
past: (n) => (n.match(digitRegex) ? `${n}` : n),
|
|
|
|
|
future: (n) => (n.match(digitRegex) ? `in ${n}` : n),
|
|
|
|
|
month: (n) => `${n}mo`,
|
|
|
|
|
year: (n) => `${n}y`,
|
|
|
|
|
day: (n) => `${n}d`,
|
|
|
|
|
week: (n) => `${n}w`,
|
|
|
|
|
hour: (n) => `${n}h`,
|
|
|
|
|
minute: (n) => `${n}m`,
|
|
|
|
|
second: (n) => `${n}s`,
|
|
|
|
|
invalid: "",
|
|
|
|
|
} as UseTimeAgoMessages<UseTimeAgoUnitNamesDefault>,
|
|
|
|
|
});
|
2024-11-30 02:19:32 +01:00
|
|
|
|
2025-12-09 23:26:59 +01:00
|
|
|
const emit = defineEmits<{
|
|
|
|
|
edit: [];
|
|
|
|
|
delete: [];
|
|
|
|
|
}>();
|
2024-12-31 15:55:02 +01:00
|
|
|
</script>
|