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:23:29 +02:00
|
|
|
<NuxtLink :href="accountUrl" class="font-semibold text-gray-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-11-04 22:45:54 +01:00
|
|
|
{{ note?.account.display_name }}
|
2024-04-27 03:28:12 +02:00
|
|
|
</Skeleton>
|
|
|
|
|
</NuxtLink>
|
2024-07-22 01:23:29 +02:00
|
|
|
<NuxtLink :href="noteUrl" class="text-gray-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:23:29 +02:00
|
|
|
<NuxtLink :href="accountUrl" class="font-semibold text-gray-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-11-04 22:45:54 +01:00
|
|
|
{{ note?.account.display_name }}
|
2024-04-27 03:28:12 +02:00
|
|
|
</Skeleton>
|
|
|
|
|
</NuxtLink>
|
2024-11-04 22:45:54 +01:00
|
|
|
<NuxtLink v-if="note" :href="noteUrl" class="text-gray-300 text-sm ml-2 line-clamp-1 break-all shrink-0"
|
|
|
|
|
:title="visibilities[note.visibility].text">
|
|
|
|
|
<iconify-icon :icon="visibilities[note.visibility].icon" width="1.25rem" height="1.25rem"
|
|
|
|
|
class="text-gray-400" aria-hidden="true" />
|
|
|
|
|
<span class="sr-only">{{ visibilities[note.visibility].text }}</span>
|
2024-04-27 03:28:12 +02:00
|
|
|
</NuxtLink>
|
|
|
|
|
</div>
|
2024-11-04 22:45:54 +01:00
|
|
|
<div class="flex flex-row items-center justify-between w-full group">
|
|
|
|
|
<span class="text-gray-300 text-sm line-clamp-1 break-all w-full">
|
|
|
|
|
<Skeleton :enabled="!note" :min-width="130" :max-width="250" shape="rect">
|
|
|
|
|
<div class="group-hover:hidden">
|
|
|
|
|
<span class="font-bold bg-gradient-to-tr from-primary-300 via-purple-300 to-indigo-400 text-transparent bg-clip-text">@{{ username }}</span><span class="text-gray-500">{{ instance && "@" }}{{ instance }}</span>
|
|
|
|
|
· <span
|
|
|
|
|
class="text-gray-400 cursor-help ml-auto" :alt="fullTime"
|
|
|
|
|
:title="fullTime">
|
|
|
|
|
<Skeleton :enabled="!note" :min-width="10" :max-width="50" shape="rect">
|
|
|
|
|
{{ timeAgo }}
|
|
|
|
|
</Skeleton>
|
|
|
|
|
</span >
|
|
|
|
|
</div>
|
|
|
|
|
<span @click="copyAccount" v-if="!hasCopied"
|
|
|
|
|
class="hidden select-none w-full group-hover:flex cursor-pointer items-center gap-x-1">
|
|
|
|
|
<iconify-icon icon="tabler:clipboard" height="1rem" width="1rem" class="text-gray-200"
|
|
|
|
|
aria-hidden="true" />
|
|
|
|
|
Click to copy
|
|
|
|
|
</span>
|
|
|
|
|
<span v-else class="hidden group-hover:flex select-none items-center gap-x-1">
|
|
|
|
|
<iconify-icon icon="tabler:check" height="1rem" width="1rem" class="text-green-500"
|
|
|
|
|
aria-hidden="true" />
|
|
|
|
|
Copied!
|
|
|
|
|
</span>
|
|
|
|
|
</Skeleton>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
2024-04-27 03:28:12 +02:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2024-08-28 00:23:29 +02:00
|
|
|
import type { Status } from "@versia/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;
|
|
|
|
|
}>();
|
|
|
|
|
|
2024-11-04 22:45:54 +01:00
|
|
|
const username = props.note?.account.acct.split("@")[0];
|
|
|
|
|
const instance = props.note?.account.acct.split("@")[1];
|
|
|
|
|
|
2024-04-27 03:28:12 +02:00
|
|
|
const noteUrl = props.note && `/@${props.note.account.acct}/${props.note.id}`;
|
|
|
|
|
const accountUrl = props.note && `/@${props.note.account.acct}`;
|
2024-11-04 22:45:54 +01:00
|
|
|
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-11-04 22:45:54 +01:00
|
|
|
|
|
|
|
|
const visibilities = {
|
|
|
|
|
public: {
|
|
|
|
|
icon: "tabler:world",
|
|
|
|
|
text: "This note is public: it can be seen by anyone.",
|
|
|
|
|
},
|
|
|
|
|
unlisted: {
|
|
|
|
|
icon: "tabler:lock-open",
|
|
|
|
|
text: "This note is unlisted: it can be seen by anyone with the link.",
|
|
|
|
|
},
|
|
|
|
|
private: {
|
|
|
|
|
icon: "tabler:lock",
|
|
|
|
|
text: "This note is private: it can only be seen by followers.",
|
|
|
|
|
},
|
|
|
|
|
direct: {
|
|
|
|
|
icon: "tabler:mail",
|
|
|
|
|
text: "This note is direct: it can only be seen by mentioned users.",
|
|
|
|
|
},
|
|
|
|
|
};
|
2024-04-27 03:28:12 +02:00
|
|
|
</script>
|