2024-04-15 03:16:57 +02:00
|
|
|
<template>
|
2024-06-12 06:41:27 +02:00
|
|
|
<ErrorsErrorBoundary>
|
|
|
|
|
<div class="mx-auto max-w-2xl w-full">
|
|
|
|
|
<LazyTimelinesTimelineScroller>
|
|
|
|
|
<LazySocialElementsUsersAccount :account="account ?? undefined" />
|
|
|
|
|
<LazyTimelinesAccount :id="accountId" :key="accountId" />
|
|
|
|
|
</LazyTimelinesTimelineScroller>
|
|
|
|
|
</div>
|
|
|
|
|
</ErrorsErrorBoundary>
|
2024-04-15 03:16:57 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2024-04-26 08:10:44 +02:00
|
|
|
import type { Account } from "~/types/mastodon/account";
|
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-04-25 08:56:01 +02:00
|
|
|
});
|
2024-04-22 09:38:51 +02:00
|
|
|
</script>
|