merge: upstream
This commit is contained in:
commit
5db583a3eb
701 changed files with 50809 additions and 13660 deletions
|
|
@ -9,7 +9,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<div>
|
||||
<div v-if="user">
|
||||
<XHome v-if="tab === 'home'" :user="user"/>
|
||||
<XTimeline v-else-if="tab === 'notes'" :user="user"/>
|
||||
<MkSpacer v-else-if="tab === 'notes'" :contentMax="800" style="padding-top: 0">
|
||||
<XTimeline :user="user"/>
|
||||
</MkSpacer>
|
||||
<XActivity v-else-if="tab === 'activity'" :user="user"/>
|
||||
<XAchievements v-else-if="tab === 'achievements'" :user="user"/>
|
||||
<XReactions v-else-if="tab === 'reactions'" :user="user"/>
|
||||
|
|
@ -18,6 +20,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<XPages v-else-if="tab === 'pages'" :user="user"/>
|
||||
<XFlashs v-else-if="tab === 'flashs'" :user="user"/>
|
||||
<XGallery v-else-if="tab === 'gallery'" :user="user"/>
|
||||
<XRaw v-else-if="tab === 'raw'" :user="user"/>
|
||||
</div>
|
||||
<MkError v-else-if="error" @retry="fetchUser()"/>
|
||||
<MkLoading v-else/>
|
||||
|
|
@ -26,7 +29,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { defineAsyncComponent, computed, watch } from 'vue';
|
||||
import { defineAsyncComponent, computed, watch, ref } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { acct as getAcct } from '@/filters/user.js';
|
||||
import * as os from '@/os.js';
|
||||
|
|
@ -44,6 +47,7 @@ const XLists = defineAsyncComponent(() => import('./lists.vue'));
|
|||
const XPages = defineAsyncComponent(() => import('./pages.vue'));
|
||||
const XFlashs = defineAsyncComponent(() => import('./flashs.vue'));
|
||||
const XGallery = defineAsyncComponent(() => import('./gallery.vue'));
|
||||
const XRaw = defineAsyncComponent(() => import('./raw.vue'));
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
acct: string;
|
||||
|
|
@ -52,17 +56,17 @@ const props = withDefaults(defineProps<{
|
|||
page: 'home',
|
||||
});
|
||||
|
||||
let tab = $ref(props.page);
|
||||
let user = $ref<null | Misskey.entities.UserDetailed>(null);
|
||||
let error = $ref(null);
|
||||
const tab = ref(props.page);
|
||||
const user = ref<null | Misskey.entities.UserDetailed>(null);
|
||||
const error = ref(null);
|
||||
|
||||
function fetchUser(): void {
|
||||
if (props.acct == null) return;
|
||||
user = null;
|
||||
user.value = null;
|
||||
os.api('users/show', Misskey.acct.parse(props.acct)).then(u => {
|
||||
user = u;
|
||||
user.value = u;
|
||||
}).catch(err => {
|
||||
error = err;
|
||||
error.value = err;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -70,9 +74,9 @@ watch(() => props.acct, fetchUser, {
|
|||
immediate: true,
|
||||
});
|
||||
|
||||
const headerActions = $computed(() => []);
|
||||
const headerActions = computed(() => []);
|
||||
|
||||
const headerTabs = $computed(() => user ? [{
|
||||
const headerTabs = computed(() => user.value ? [{
|
||||
key: 'home',
|
||||
title: i18n.ts.overview,
|
||||
icon: 'ph-house ph-bold ph-lg',
|
||||
|
|
@ -84,11 +88,11 @@ const headerTabs = $computed(() => user ? [{
|
|||
key: 'activity',
|
||||
title: i18n.ts.activity,
|
||||
icon: 'ph-chart-line ph-bold ph-lg',
|
||||
}, ...(user.host == null ? [{
|
||||
}, ...(user.value.host == null ? [{
|
||||
key: 'achievements',
|
||||
title: i18n.ts.achievements,
|
||||
icon: 'ph-trophy ph-bold ph-lg',
|
||||
}] : []), ...($i && ($i.id === user.id)) || user.publicReactions ? [{
|
||||
}] : []), ...($i && ($i.id === user.value.id)) || user.value.publicReactions ? [{
|
||||
key: 'reactions',
|
||||
title: i18n.ts.reaction,
|
||||
icon: 'ph-smiley ph-bold ph-lg',
|
||||
|
|
@ -112,17 +116,21 @@ const headerTabs = $computed(() => user ? [{
|
|||
key: 'gallery',
|
||||
title: i18n.ts.gallery,
|
||||
icon: 'ph-images-square ph-bold ph-lg',
|
||||
}, {
|
||||
key: 'raw',
|
||||
title: 'Raw',
|
||||
icon: 'ph-code ph-bold ph-lg',
|
||||
}] : []);
|
||||
|
||||
definePageMetadata(computed(() => user ? {
|
||||
definePageMetadata(computed(() => user.value ? {
|
||||
icon: 'ph-user ph-bold ph-lg',
|
||||
title: user.name ? `${user.name} (@${user.username})` : `@${user.username}`,
|
||||
subtitle: `@${getAcct(user)}`,
|
||||
userName: user,
|
||||
avatar: user,
|
||||
path: `/@${user.username}`,
|
||||
title: user.value.name ? `${user.value.name} (@${user.value.username})` : `@${user.value.username}`,
|
||||
subtitle: `@${getAcct(user.value)}`,
|
||||
userName: user.value,
|
||||
avatar: user.value,
|
||||
path: `/@${user.value.username}`,
|
||||
share: {
|
||||
title: user.name,
|
||||
title: user.value.name,
|
||||
},
|
||||
} : null));
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue