2023-07-27 08:31:52 +03:00
|
|
|
<!--
|
2024-02-13 17:59:27 +02:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 08:31:52 +03:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
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">
|
2022-07-03 08:44:18 +03:00
|
|
|
<XFollowList :user="user" type="followers"/>
|
2022-07-01 12:55:45 +03:00
|
|
|
</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-12-07 07:42:09 +02:00
|
|
|
import { computed, watch, ref } from 'vue';
|
2023-09-04 07:33:38 +03:00
|
|
|
import * as Misskey from 'misskey-js';
|
2022-07-01 12:55:45 +03:00
|
|
|
import XFollowList from './follow-list.vue';
|
2024-01-04 11:32:46 +02:00
|
|
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
2023-09-19 10:37:43 +03:00
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
2022-07-01 12:55:45 +03:00
|
|
|
|
|
|
|
const props = withDefaults(defineProps<{
|
|
|
|
acct: string;
|
|
|
|
}>(), {
|
|
|
|
});
|
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
const user = ref<null | Misskey.entities.UserDetailed>(null);
|
2023-12-26 07:19:35 +02:00
|
|
|
const error = ref<any>(null);
|
2022-07-01 12:55:45 +03:00
|
|
|
|
|
|
|
function fetchUser(): void {
|
|
|
|
if (props.acct == null) return;
|
2023-12-07 07:42:09 +02:00
|
|
|
user.value = null;
|
2024-01-04 11:32:46 +02:00
|
|
|
misskeyApi('users/show', Misskey.acct.parse(props.acct)).then(u => {
|
2023-12-07 07:42:09 +02:00
|
|
|
user.value = u;
|
2022-07-01 12:55:45 +03:00
|
|
|
}).catch(err => {
|
2023-12-07 07:42:09 +02:00
|
|
|
error.value = err;
|
2022-07-01 12:55:45 +03:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
watch(() => props.acct, fetchUser, {
|
|
|
|
immediate: true,
|
|
|
|
});
|
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
const headerActions = computed(() => []);
|
2022-07-01 12:55:45 +03:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
const headerTabs = computed(() => []);
|
2022-07-01 12:55:45 +03:00
|
|
|
|
2024-02-16 09:17:09 +02:00
|
|
|
definePageMetadata(() => ({
|
|
|
|
title: i18n.ts.user,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-user ph-bold ph-lg',
|
2024-02-16 09:17:09 +02:00
|
|
|
...user.value ? {
|
|
|
|
title: user.value.name ? `${user.value.name} (@${user.value.username})` : `@${user.value.username}`,
|
|
|
|
subtitle: i18n.ts.followers,
|
|
|
|
userName: user.value,
|
|
|
|
avatar: user.value,
|
|
|
|
} : {},
|
|
|
|
}));
|
2022-07-01 12:55:45 +03:00
|
|
|
</script>
|