2024-04-15 03:16:57 +02:00
|
|
|
<template>
|
2024-06-21 04:09:09 +02:00
|
|
|
<ErrorBoundary>
|
2024-06-12 06:41:27 +02:00
|
|
|
<div class="mx-auto max-w-2xl w-full">
|
2024-06-21 04:09:09 +02:00
|
|
|
<TimelineScroller>
|
|
|
|
|
<AccountProfile :account="account ?? undefined" />
|
|
|
|
|
<AccountTimeline :id="accountId" :key="accountId" />
|
|
|
|
|
</TimelineScroller>
|
2024-06-12 06:41:27 +02:00
|
|
|
</div>
|
2024-06-21 04:09:09 +02:00
|
|
|
</ErrorBoundary>
|
2024-04-15 03:16:57 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2024-06-20 01:57:38 +02:00
|
|
|
import type { Account } from "@lysand-org/client/types";
|
2024-06-21 04:09:09 +02:00
|
|
|
import ErrorBoundary from "~/components/errors/ErrorBoundary.vue";
|
2024-06-21 07:12:04 +02:00
|
|
|
import AccountProfile from "~/components/social-elements/users/Account.vue";
|
2024-06-21 04:09:09 +02:00
|
|
|
import AccountTimeline from "~/components/timelines/account.vue";
|
|
|
|
|
import TimelineScroller from "~/components/timelines/timeline-scroller.vue";
|
2024-04-25 08:56:01 +02:00
|
|
|
|
2024-04-26 07:54:02 +02:00
|
|
|
definePageMeta({
|
2024-05-08 14:15:21 +02:00
|
|
|
layout: "app",
|
2024-04-25 08:56:01 +02:00
|
|
|
});
|
|
|
|
|
|
2024-04-26 07:54:02 +02:00
|
|
|
const route = useRoute();
|
2024-06-10 05:24:55 +02:00
|
|
|
const client = useClient();
|
2024-04-26 07:54:02 +02:00
|
|
|
const username = (route.params.username as string).replace("@", "");
|
2024-04-25 08:56:01 +02:00
|
|
|
|
2024-04-27 06:50:30 +02:00
|
|
|
const accounts = useAccountSearch(client, username);
|
2024-06-12 06:41:27 +02:00
|
|
|
watch(accounts, (newValue) => {
|
|
|
|
|
if (Array.isArray(newValue)) {
|
|
|
|
|
if (!newValue.find((account) => account.acct === username)) {
|
|
|
|
|
useEvent("error", {
|
|
|
|
|
title: "Account not found",
|
|
|
|
|
message: `The account <code>@${username}</code> does not exist.`,
|
|
|
|
|
code: "ERR_ACCOUNT_NOT_FOUND",
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-04-27 06:50:30 +02:00
|
|
|
const account = computed<Account | null>(
|
|
|
|
|
() => accounts.value?.find((account) => account.acct === username) ?? null,
|
|
|
|
|
);
|
2024-05-08 14:15:21 +02:00
|
|
|
const accountId = computed(() => account.value?.id ?? undefined);
|
2024-04-26 07:54:02 +02:00
|
|
|
|
2024-05-08 14:15:21 +02:00
|
|
|
useServerSeoMeta({
|
|
|
|
|
title: computed(() =>
|
|
|
|
|
account.value ? account.value.display_name : "Loading",
|
|
|
|
|
),
|
|
|
|
|
ogTitle: computed(() =>
|
|
|
|
|
account.value ? account.value.display_name : "Loading",
|
|
|
|
|
),
|
|
|
|
|
ogImage: computed(() => (account.value ? account.value.avatar : undefined)),
|
|
|
|
|
ogType: "profile",
|
|
|
|
|
ogDescription: computed(() =>
|
|
|
|
|
account.value ? account.value.note : undefined,
|
|
|
|
|
),
|
|
|
|
|
description: computed(() =>
|
|
|
|
|
account.value ? account.value.note : undefined,
|
|
|
|
|
),
|
2024-06-21 08:01:33 +02:00
|
|
|
robots: computed(() => ({
|
|
|
|
|
noindex: !!account.value?.noindex,
|
|
|
|
|
nofollow: !!account.value?.noindex,
|
|
|
|
|
noarchive: !!account.value?.noindex,
|
|
|
|
|
noimageindex: !!account.value?.noindex,
|
|
|
|
|
})),
|
2024-04-25 08:56:01 +02:00
|
|
|
});
|
2024-04-22 09:38:51 +02:00
|
|
|
</script>
|