2022-07-01 04:55:45 -05:00
|
|
|
<template>
|
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
|
|
|
<MkSpacer :content-max="1000">
|
|
|
|
<transition name="fade" mode="out-in">
|
|
|
|
<div v-if="user">
|
2022-07-03 00:44:18 -05:00
|
|
|
<XFollowList :user="user" type="followers"/>
|
2022-07-01 04:55:45 -05:00
|
|
|
</div>
|
2022-07-18 07:43:31 -05:00
|
|
|
<MkError v-else-if="error" @retry="fetchUser()"/>
|
2022-07-01 04:55:45 -05:00
|
|
|
<MkLoading v-else/>
|
|
|
|
</transition>
|
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { defineAsyncComponent, computed, inject, onMounted, onUnmounted, watch } from 'vue';
|
|
|
|
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 04:01:30 -06:00
|
|
|
icon: 'ti ti-user',
|
2022-07-01 04:55:45 -05:00
|
|
|
title: user.name ? `${user.name} (@${user.username})` : `@${user.username}`,
|
|
|
|
subtitle: i18n.ts.followers,
|
|
|
|
userName: user,
|
|
|
|
avatar: user,
|
|
|
|
} : null));
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
</style>
|