merge: upstream
This commit is contained in:
commit
5db583a3eb
701 changed files with 50809 additions and 13660 deletions
|
|
@ -107,11 +107,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<b>{{ number(user.notesCount) }}</b>
|
||||
<span>{{ i18n.ts.notes }}</span>
|
||||
</MkA>
|
||||
<MkA v-if="isFfVisibleForMe(user)" :to="userPage(user, 'following')">
|
||||
<MkA v-if="isFollowingVisibleForMe(user)" :to="userPage(user, 'following')">
|
||||
<b>{{ number(user.followingCount) }}</b>
|
||||
<span>{{ i18n.ts.following }}</span>
|
||||
</MkA>
|
||||
<MkA v-if="isFfVisibleForMe(user)" :to="userPage(user, 'followers')">
|
||||
<MkA v-if="isFollowersVisibleForMe(user)" :to="userPage(user, 'followers')">
|
||||
<b>{{ number(user.followersCount) }}</b>
|
||||
<span>{{ i18n.ts.followers }}</span>
|
||||
</MkA>
|
||||
|
|
@ -128,13 +128,20 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</div>
|
||||
<MkInfo v-else-if="$i && $i.id === user.id">{{ i18n.ts.userPagePinTip }}</MkInfo>
|
||||
<template v-if="narrow">
|
||||
<XFiles :key="user.id" :user="user"/>
|
||||
<XActivity :key="user.id" :user="user"/>
|
||||
<XListenBrainz v-if="user.listenbrainz && listenbrainzdata" :key="user.id" :user="user"/>
|
||||
<MkLazy>
|
||||
<XFiles :key="user.id" :user="user"/>
|
||||
</MkLazy>
|
||||
<MkLazy>
|
||||
<XActivity :key="user.id" :user="user"/>
|
||||
</MkLazy>
|
||||
<MkLazy>
|
||||
<XListenBrainz v-if="user.listenbrainz && listenbrainzdata" :key="user.id" :user="user"/>
|
||||
</MkLazy>
|
||||
</template>
|
||||
<!-- <div v-if="!disableNotes">
|
||||
<div style="margin-bottom: 8px; z-index: 1;">{{ i18n.ts.featured }}</div>
|
||||
<MkNotes :class="$style.tl" :noGap="true" :pagination="pagination"/>
|
||||
<MkLazy>
|
||||
<XTimeline :user="user"/>
|
||||
</MkLazy>
|
||||
</div> -->
|
||||
<MkStickyContainer>
|
||||
<template #header>
|
||||
|
|
@ -144,7 +151,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<option value="files">{{ i18n.ts.withFiles }}</option>
|
||||
</MkTab>
|
||||
</template>
|
||||
<MkNotes :class="$style.tl" :noGap="true" :pagination="AllPagination"/>
|
||||
<MkLazy>
|
||||
<MkNotes :class="$style.tl" :noGap="true" :pagination="AllPagination"/>
|
||||
</MkLazy>
|
||||
</MkStickyContainer>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -159,10 +168,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { defineAsyncComponent, computed, onMounted, onUnmounted, nextTick, watch } from 'vue';
|
||||
import { defineAsyncComponent, computed, onMounted, onUnmounted, nextTick, watch, ref } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import MkTab from '@/components/MkTab.vue';
|
||||
import MkNote from '@/components/MkNote.vue';
|
||||
import MkNotes from '@/components/MkNotes.vue';
|
||||
import SkNote from '@/components/SkNote.vue';
|
||||
import MkFollowButton from '@/components/MkFollowButton.vue';
|
||||
import MkAccountMoved from '@/components/MkAccountMoved.vue';
|
||||
|
|
@ -180,10 +190,9 @@ import { i18n } from '@/i18n.js';
|
|||
import { $i, iAmModerator } from '@/account.js';
|
||||
import { dateString } from '@/filters/date.js';
|
||||
import { confetti } from '@/scripts/confetti.js';
|
||||
import MkNotes from '@/components/MkNotes.vue';
|
||||
import { api } from '@/os.js';
|
||||
import { defaultStore } from '@/store.js';
|
||||
import { isFfVisibleForMe } from '@/scripts/isFfVisibleForMe.js';
|
||||
import { isFollowingVisibleForMe, isFollowersVisibleForMe } from '@/scripts/isFfVisibleForMe.js';
|
||||
|
||||
function calcAge(birthdate: string): number {
|
||||
const date = new Date(birthdate);
|
||||
|
|
@ -203,6 +212,7 @@ function calcAge(birthdate: string): number {
|
|||
const XFiles = defineAsyncComponent(() => import('./index.files.vue'));
|
||||
const XActivity = defineAsyncComponent(() => import('./index.activity.vue'));
|
||||
const XListenBrainz = defineAsyncComponent(() => import("./index.listenbrainz.vue"));
|
||||
//const XTimeline = defineAsyncComponent(() => import('./index.timeline.vue'));
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
user: Misskey.entities.UserDetailed;
|
||||
|
|
@ -214,17 +224,17 @@ const props = withDefaults(defineProps<{
|
|||
|
||||
const router = useRouter();
|
||||
|
||||
let user = $ref(props.user);
|
||||
let parallaxAnimationId = $ref<null | number>(null);
|
||||
let narrow = $ref<null | boolean>(null);
|
||||
let rootEl = $ref<null | HTMLElement>(null);
|
||||
let bannerEl = $ref<null | HTMLElement>(null);
|
||||
let memoTextareaEl = $ref<null | HTMLElement>(null);
|
||||
let memoDraft = $ref(props.user.memo);
|
||||
let isEditingMemo = $ref(false);
|
||||
let moderationNote = $ref(props.user.moderationNote);
|
||||
let editModerationNote = $ref(false);
|
||||
let noteview = $ref<string | null>(null);
|
||||
const user = ref(props.user);
|
||||
const parallaxAnimationId = ref<null | number>(null);
|
||||
const narrow = ref<null | boolean>(null);
|
||||
const rootEl = ref<null | HTMLElement>(null);
|
||||
const bannerEl = ref<null | HTMLElement>(null);
|
||||
const memoTextareaEl = ref<null | HTMLElement>(null);
|
||||
const memoDraft = ref(props.user.memo);
|
||||
const isEditingMemo = ref(false);
|
||||
const moderationNote = ref(props.user.moderationNote);
|
||||
const editModerationNote = ref(false);
|
||||
const noteview = ref<string | null>(null);
|
||||
|
||||
let listenbrainzdata = false;
|
||||
if (props.user.listenbrainz) {
|
||||
|
|
@ -251,8 +261,8 @@ const background = computed(() => {
|
|||
};
|
||||
});
|
||||
|
||||
watch($$(moderationNote), async () => {
|
||||
await os.api('admin/update-user-note', { userId: props.user.id, text: moderationNote });
|
||||
watch(moderationNote, async () => {
|
||||
await os.api('admin/update-user-note', { userId: props.user.id, text: moderationNote.value });
|
||||
});
|
||||
|
||||
const pagination = {
|
||||
|
|
@ -268,39 +278,39 @@ const AllPagination = {
|
|||
limit: 10,
|
||||
params: computed(() => ({
|
||||
userId: props.user.id,
|
||||
withRenotes: noteview === 'all',
|
||||
withReplies: noteview === 'all' || noteview === 'files',
|
||||
withChannelNotes: noteview === 'all',
|
||||
withFiles: noteview === 'files',
|
||||
withRenotes: noteview.value === 'all',
|
||||
withReplies: noteview.value === 'all' || noteview.value === 'files',
|
||||
withChannelNotes: noteview.value === 'all',
|
||||
withFiles: noteview.value === 'files',
|
||||
})),
|
||||
};
|
||||
|
||||
const style = $computed(() => {
|
||||
const style = computed(() => {
|
||||
if (props.user.bannerUrl == null) return {};
|
||||
return {
|
||||
backgroundImage: `url(${ props.user.bannerUrl })`,
|
||||
};
|
||||
});
|
||||
|
||||
const age = $computed(() => {
|
||||
const age = computed(() => {
|
||||
return calcAge(props.user.birthday);
|
||||
});
|
||||
|
||||
function menu(ev) {
|
||||
const { menu, cleanup } = getUserMenu(user, router);
|
||||
function menu(ev: MouseEvent) {
|
||||
const { menu, cleanup } = getUserMenu(user.value, router);
|
||||
os.popupMenu(menu, ev.currentTarget ?? ev.target).finally(cleanup);
|
||||
}
|
||||
|
||||
function parallaxLoop() {
|
||||
parallaxAnimationId = window.requestAnimationFrame(parallaxLoop);
|
||||
parallaxAnimationId.value = window.requestAnimationFrame(parallaxLoop);
|
||||
parallax();
|
||||
}
|
||||
|
||||
function parallax() {
|
||||
const banner = bannerEl as any;
|
||||
const banner = bannerEl.value as any;
|
||||
if (banner == null) return;
|
||||
|
||||
const top = getScrollPosition(rootEl);
|
||||
const top = getScrollPosition(rootEl.value);
|
||||
|
||||
if (top < 0) return;
|
||||
|
||||
|
|
@ -310,33 +320,33 @@ function parallax() {
|
|||
}
|
||||
|
||||
function showMemoTextarea() {
|
||||
isEditingMemo = true;
|
||||
isEditingMemo.value = true;
|
||||
nextTick(() => {
|
||||
memoTextareaEl?.focus();
|
||||
memoTextareaEl.value?.focus();
|
||||
});
|
||||
}
|
||||
|
||||
function adjustMemoTextarea() {
|
||||
if (!memoTextareaEl) return;
|
||||
memoTextareaEl.style.height = '0px';
|
||||
memoTextareaEl.style.height = `${memoTextareaEl.scrollHeight}px`;
|
||||
if (!memoTextareaEl.value) return;
|
||||
memoTextareaEl.value.style.height = '0px';
|
||||
memoTextareaEl.value.style.height = `${memoTextareaEl.value.scrollHeight}px`;
|
||||
}
|
||||
|
||||
async function updateMemo() {
|
||||
await api('users/update-memo', {
|
||||
memo: memoDraft,
|
||||
memo: memoDraft.value,
|
||||
userId: props.user.id,
|
||||
});
|
||||
isEditingMemo = false;
|
||||
isEditingMemo.value = false;
|
||||
}
|
||||
|
||||
watch([props.user], () => {
|
||||
memoDraft = props.user.memo;
|
||||
memoDraft.value = props.user.memo;
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
window.requestAnimationFrame(parallaxLoop);
|
||||
narrow = rootEl!.clientWidth < 1000;
|
||||
narrow.value = rootEl.value!.clientWidth < 1000;
|
||||
|
||||
if (props.user.birthday) {
|
||||
const m = new Date().getMonth() + 1;
|
||||
|
|
@ -355,8 +365,8 @@ onMounted(() => {
|
|||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
if (parallaxAnimationId) {
|
||||
window.cancelAnimationFrame(parallaxAnimationId);
|
||||
if (parallaxAnimationId.value) {
|
||||
window.cancelAnimationFrame(parallaxAnimationId.value);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue