2023-07-27 14:31:52 +09:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2022-07-01 18:55:45 +09:00
|
|
|
<template>
|
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
2023-05-19 20:52:15 +09:00
|
|
|
<MkSpacer :contentMax="1000">
|
2022-12-30 13:37:14 +09:00
|
|
|
<Transition name="fade" mode="out-in">
|
2022-07-01 18:55:45 +09:00
|
|
|
<div v-if="user">
|
2022-07-03 14:44:18 +09:00
|
|
|
<XFollowList :user="user" type="followers"/>
|
2022-07-01 18:55:45 +09:00
|
|
|
</div>
|
2022-07-18 21:43:31 +09:00
|
|
|
<MkError v-else-if="error" @retry="fetchUser()"/>
|
2022-07-01 18:55:45 +09:00
|
|
|
<MkLoading v-else/>
|
2022-12-30 13:37:14 +09:00
|
|
|
</Transition>
|
2022-07-01 18:55:45 +09:00
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-02-16 23:09:41 +09:00
|
|
|
import { computed, watch } from 'vue';
|
2023-09-04 13:33:38 +09:00
|
|
|
import * as Misskey from 'misskey-js';
|
2022-07-01 18:55:45 +09:00
|
|
|
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;
|
|
|
|
}>(), {
|
|
|
|
});
|
|
|
|
|
2023-09-04 13:33:38 +09:00
|
|
|
let user = $ref<null | Misskey.entities.UserDetailed>(null);
|
2022-07-01 18:55:45 +09:00
|
|
|
let error = $ref(null);
|
|
|
|
|
|
|
|
function fetchUser(): void {
|
|
|
|
if (props.acct == null) return;
|
|
|
|
user = null;
|
2023-09-04 13:33:38 +09:00
|
|
|
os.api('users/show', Misskey.acct.parse(props.acct)).then(u => {
|
2022-07-01 18:55:45 +09:00
|
|
|
user = u;
|
|
|
|
}).catch(err => {
|
|
|
|
error = err;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
watch(() => props.acct, fetchUser, {
|
|
|
|
immediate: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
|
|
|
definePageMetadata(computed(() => user ? {
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-user',
|
2022-07-01 18:55:45 +09:00
|
|
|
title: user.name ? `${user.name} (@${user.username})` : `@${user.username}`,
|
|
|
|
subtitle: i18n.ts.followers,
|
|
|
|
userName: user,
|
|
|
|
avatar: user,
|
|
|
|
} : null));
|
|
|
|
</script>
|