mirror of
https://github.com/versia-pub/frontend.git
synced 2026-03-13 03:29:16 +01:00
feat: ✨ Add profile viewer
This commit is contained in:
parent
a6c5093cf5
commit
1194bc4ffb
19 changed files with 466 additions and 47 deletions
|
|
@ -1,8 +1,8 @@
|
|||
<template>
|
||||
<ErrorBoundary>
|
||||
<div class="mx-auto max-w-2xl w-full">
|
||||
<TimelineScroller>
|
||||
<AccountProfile :account="account ?? undefined" />
|
||||
<div class="mx-auto max-w-2xl w-full space-y-2">
|
||||
<TimelineScroller v-if="account">
|
||||
<AccountProfile :account="account" />
|
||||
<AccountTimeline v-if="accountId" :id="accountId" :key="accountId" />
|
||||
</TimelineScroller>
|
||||
</div>
|
||||
|
|
@ -10,9 +10,8 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Account } from "@versia/client/types";
|
||||
import ErrorBoundary from "~/components/errors/ErrorBoundary.vue";
|
||||
import AccountProfile from "~/components/social-elements/users/Account.vue";
|
||||
import AccountProfile from "~/components/profiles/profile.vue";
|
||||
import AccountTimeline from "~/components/timelines/account.vue";
|
||||
import TimelineScroller from "~/components/timelines/timeline-scroller.vue";
|
||||
|
||||
|
|
@ -25,29 +24,7 @@ const username = (route.params.username as string).startsWith("@")
|
|||
? (route.params.username as string).substring(1)
|
||||
: (route.params.username as string);
|
||||
|
||||
const accounts = useAccountSearch(client, username);
|
||||
watch(accounts, (newValue) => {
|
||||
if (Array.isArray(newValue)) {
|
||||
if (
|
||||
!newValue.find(
|
||||
(account) =>
|
||||
account.acct.toLowerCase() === username.toLowerCase(),
|
||||
)
|
||||
) {
|
||||
useEvent("error", {
|
||||
title: "Account not found",
|
||||
message: `The account <code>@${username}</code> does not exist.`,
|
||||
code: "ERR_ACCOUNT_NOT_FOUND",
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
const account = computed<Account | null>(
|
||||
() =>
|
||||
accounts.value?.find(
|
||||
(account) => account.acct.toLowerCase() === username.toLowerCase(),
|
||||
) ?? null,
|
||||
);
|
||||
const account = useAccountFromAcct(client, username);
|
||||
const accountId = computed(() => account.value?.id ?? undefined);
|
||||
|
||||
useServerSeoMeta({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue