2022-07-01 12:55:45 +03:00
|
|
|
<template>
|
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
2023-05-19 14:52:15 +03:00
|
|
|
<MkSpacer :contentMax="1000">
|
2022-12-30 06:37:14 +02:00
|
|
|
<Transition name="fade" mode="out-in">
|
2022-07-01 12:55:45 +03:00
|
|
|
<div v-if="user">
|
|
|
|
<XFollowList :user="user" type="following"/>
|
|
|
|
</div>
|
2022-07-18 15:43:31 +03:00
|
|
|
<MkError v-else-if="error" @retry="fetchUser()"/>
|
2022-07-01 12:55:45 +03:00
|
|
|
<MkLoading v-else/>
|
2022-12-30 06:37:14 +02:00
|
|
|
</Transition>
|
2022-07-01 12:55:45 +03:00
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-02-16 16:09:41 +02:00
|
|
|
import { computed, watch } from 'vue';
|
2022-07-01 12:55:45 +03:00
|
|
|
import * as Acct from 'misskey-js/built/acct';
|
|
|
|
import * as misskey from 'misskey-js';
|
|
|
|
import XFollowList from './follow-list.vue';
|
|
|
|
import * as os from '@/os';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
|
|
|
import { i18n } from '@/i18n';
|
|
|
|
|
|
|
|
const props = withDefaults(defineProps<{
|
|
|
|
acct: string;
|
|
|
|
}>(), {
|
|
|
|
});
|
|
|
|
|
|
|
|
let user = $ref<null | misskey.entities.UserDetailed>(null);
|
|
|
|
let error = $ref(null);
|
|
|
|
|
|
|
|
function fetchUser(): void {
|
|
|
|
if (props.acct == null) return;
|
|
|
|
user = null;
|
|
|
|
os.api('users/show', Acct.parse(props.acct)).then(u => {
|
|
|
|
user = u;
|
|
|
|
}).catch(err => {
|
|
|
|
error = err;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
watch(() => props.acct, fetchUser, {
|
|
|
|
immediate: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
|
|
|
definePageMetadata(computed(() => user ? {
|
2022-12-19 12:01:30 +02:00
|
|
|
icon: 'ti ti-user',
|
2022-07-01 12:55:45 +03:00
|
|
|
title: user.name ? `${user.name} (@${user.username})` : `@${user.username}`,
|
|
|
|
subtitle: i18n.ts.following,
|
|
|
|
userName: user,
|
|
|
|
avatar: user,
|
|
|
|
} : null));
|
|
|
|
</script>
|