2024-04-27 03:28:12 +02:00
|
|
|
<template>
|
|
|
|
|
<div v-if="small" class="flex flex-row">
|
2024-05-08 14:15:21 +02:00
|
|
|
<NuxtLink :href="accountUrl" class="shrink-0">
|
2024-06-21 04:09:09 +02:00
|
|
|
<Avatar :src="note?.account.avatar" :alt="`${note?.account.acct}'s avatar`"
|
2024-05-12 10:37:57 +02:00
|
|
|
class="size-6 rounded ring-1 ring-white/5" />
|
2024-06-10 06:33:14 +02:00
|
|
|
<span class="sr-only">Account profile</span>
|
2024-05-08 14:15:21 +02:00
|
|
|
</NuxtLink>
|
2024-04-27 03:28:12 +02:00
|
|
|
<div class="flex flex-col items-start justify-around ml-4 grow overflow-hidden">
|
|
|
|
|
<div class="flex flex-row text-sm items-center justify-between w-full">
|
2024-07-22 01:05:51 +02:00
|
|
|
<NuxtLink :href="accountUrl" class="font-semibold text-text-200 line-clamp-1 break-all">
|
2024-04-27 03:28:12 +02:00
|
|
|
<Skeleton :enabled="!note" :min-width="90" :max-width="170" shape="rect">
|
|
|
|
|
{{
|
2024-06-20 01:57:38 +02:00
|
|
|
note?.account.display_name }}
|
2024-04-27 03:28:12 +02:00
|
|
|
</Skeleton>
|
|
|
|
|
</NuxtLink>
|
2024-07-22 01:05:51 +02:00
|
|
|
<NuxtLink :href="noteUrl" class="text-text-300 ml-2 line-clamp-1 break-all shrink-0">
|
2024-04-27 03:28:12 +02:00
|
|
|
<Skeleton :enabled="!note" :min-width="50" :max-width="100" shape="rect">
|
|
|
|
|
{{ timeAgo }}
|
|
|
|
|
</Skeleton>
|
|
|
|
|
</NuxtLink>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else class="flex flex-row">
|
2024-07-21 19:59:00 +02:00
|
|
|
<UserCard :account="note?.account">
|
|
|
|
|
<NuxtLink :href="accountUrl" class="shrink-0">
|
2024-07-21 18:16:03 +02:00
|
|
|
<Avatar :src="note?.account.avatar" :alt="`${note?.account.acct}'s avatar`"
|
|
|
|
|
class="h-12 w-12 rounded ring-1 ring-white/5" />
|
|
|
|
|
<span class="sr-only">Account profile</span>
|
2024-07-21 19:59:00 +02:00
|
|
|
</NuxtLink>
|
|
|
|
|
</UserCard>
|
2024-04-27 03:28:12 +02:00
|
|
|
<div class="flex flex-col items-start justify-around ml-4 grow overflow-hidden">
|
|
|
|
|
<div class="flex flex-row items-center justify-between w-full">
|
2024-07-22 01:05:51 +02:00
|
|
|
<NuxtLink :href="accountUrl" class="font-semibold text-text-200 line-clamp-1 break-all">
|
2024-04-27 03:28:12 +02:00
|
|
|
<Skeleton :enabled="!note" :min-width="90" :max-width="170" shape="rect">
|
|
|
|
|
{{
|
2024-06-20 01:57:38 +02:00
|
|
|
note?.account.display_name }}
|
2024-04-27 03:28:12 +02:00
|
|
|
</Skeleton>
|
|
|
|
|
</NuxtLink>
|
2024-07-22 01:05:51 +02:00
|
|
|
<NuxtLink :href="noteUrl" class="text-text-300 text-sm ml-2 line-clamp-1 break-all shrink-0"
|
2024-05-12 05:53:42 +02:00
|
|
|
:alt="fullTime" :title="fullTime">
|
2024-04-27 03:28:12 +02:00
|
|
|
<Skeleton :enabled="!note" :min-width="50" :max-width="100" shape="rect">
|
|
|
|
|
{{ timeAgo }}
|
|
|
|
|
</Skeleton>
|
|
|
|
|
</NuxtLink>
|
|
|
|
|
</div>
|
2024-07-22 01:05:51 +02:00
|
|
|
<span class="text-text-300 text-sm line-clamp-1 break-all w-full group">
|
2024-04-27 03:28:12 +02:00
|
|
|
<Skeleton :enabled="!note" :min-width="130" :max-width="250" shape="rect">
|
2024-05-12 05:53:42 +02:00
|
|
|
<span class="group-hover:hidden">
|
|
|
|
|
@{{
|
2024-06-20 01:57:38 +02:00
|
|
|
note?.account.acct
|
2024-05-12 05:53:42 +02:00
|
|
|
}}</span>
|
|
|
|
|
<span @click="copyAccount" v-if="!hasCopied"
|
|
|
|
|
class="hidden select-none group-hover:flex cursor-pointer items-center gap-x-1">
|
2024-07-22 01:05:51 +02:00
|
|
|
<iconify-icon icon="tabler:clipboard" height="1rem" width="1rem" class="text-text-200"
|
2024-05-12 11:04:00 +02:00
|
|
|
aria-hidden="true" />
|
2024-05-12 05:53:42 +02:00
|
|
|
Click to copy
|
|
|
|
|
</span>
|
|
|
|
|
<span v-else class="hidden group-hover:flex select-none items-center gap-x-1">
|
2024-05-12 11:04:00 +02:00
|
|
|
<iconify-icon icon="tabler:check" height="1rem" width="1rem" class="text-green-500"
|
|
|
|
|
aria-hidden="true" />
|
2024-05-12 05:53:42 +02:00
|
|
|
Copied!
|
|
|
|
|
</span>
|
2024-04-27 03:28:12 +02:00
|
|
|
</Skeleton>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2024-06-20 01:57:38 +02:00
|
|
|
import type { Status } from "@lysand-org/client/types";
|
2024-06-21 04:09:09 +02:00
|
|
|
import Avatar from "~/components/avatars/avatar.vue";
|
|
|
|
|
import Skeleton from "~/components/skeleton/Skeleton.vue";
|
2024-07-21 18:16:03 +02:00
|
|
|
import UserCard from "~/components/social-elements/users/UserCard.vue";
|
2024-04-27 03:28:12 +02:00
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
|
note?: Status;
|
|
|
|
|
small?: boolean;
|
|
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
const noteUrl = props.note && `/@${props.note.account.acct}/${props.note.id}`;
|
|
|
|
|
const accountUrl = props.note && `/@${props.note.account.acct}`;
|
|
|
|
|
const timeAgo = useTimeAgo(props.note?.created_at ?? 0);
|
2024-05-12 05:53:42 +02:00
|
|
|
const fullTime = Intl.DateTimeFormat("default", {
|
|
|
|
|
dateStyle: "medium",
|
|
|
|
|
timeStyle: "short",
|
|
|
|
|
}).format(new Date(props.note?.created_at ?? 0));
|
|
|
|
|
const hasCopied = ref(false);
|
|
|
|
|
|
|
|
|
|
const { copy } = useClipboard();
|
|
|
|
|
const copyAccount = () => {
|
|
|
|
|
if (props.note) {
|
|
|
|
|
copy(`@${props.note.account.acct}`);
|
|
|
|
|
hasCopied.value = true;
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
hasCopied.value = false;
|
|
|
|
|
}, 2000);
|
|
|
|
|
}
|
|
|
|
|
};
|
2024-04-27 03:28:12 +02:00
|
|
|
</script>
|