on user profiles, move pinned notes down with the other notes

This commit is contained in:
Hazel K 2024-10-04 12:22:09 -04:00
parent ba5eec2129
commit 60ec877d3c
4 changed files with 24 additions and 6 deletions

View file

@ -126,6 +126,7 @@ inChannelQuote: "Channel-only Quote"
renoteToChannel: "Renote to channel" renoteToChannel: "Renote to channel"
renoteToOtherChannel: "Renote to other channel" renoteToOtherChannel: "Renote to other channel"
pinnedNote: "Pinned note" pinnedNote: "Pinned note"
pinnedOnly: "Pinned"
pinned: "Pin to profile" pinned: "Pin to profile"
you: "You" you: "You"
clickToShow: "Click to show" clickToShow: "Click to show"

4
locales/index.d.ts vendored
View file

@ -520,6 +520,10 @@ export interface Locale extends ILocale {
* *
*/ */
"pinnedNote": string; "pinnedNote": string;
/**
* Pinned
*/
"pinnedOnly": string;
/** /**
* *
*/ */

View file

@ -126,6 +126,7 @@ inChannelQuote: "チャンネル内引用"
renoteToChannel: "チャンネルにリノート" renoteToChannel: "チャンネルにリノート"
renoteToOtherChannel: "他のチャンネルにリノート" renoteToOtherChannel: "他のチャンネルにリノート"
pinnedNote: "ピン留めされたノート" pinnedNote: "ピン留めされたノート"
pinnedOnly: "Pinned"
pinned: "ピン留め" pinned: "ピン留め"
you: "あなた" you: "あなた"
clickToShow: "クリックして表示" clickToShow: "クリックして表示"

View file

@ -125,10 +125,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> </div>
<div class="contents _gaps"> <div class="contents _gaps">
<div v-if="user.pinnedNotes.length > 0" class="_gaps"> <MkInfo v-if="user.pinnedNotes.length === 0 && $i?.id === user.id">{{ i18n.ts.userPagePinTip }}</MkInfo>
<MkNote v-for="note in user.pinnedNotes" :key="note.id" class="note _panel" :note="note" :pinned="true"/>
</div>
<MkInfo v-else-if="$i && $i.id === user.id">{{ i18n.ts.userPagePinTip }}</MkInfo>
<template v-if="narrow"> <template v-if="narrow">
<MkLazy> <MkLazy>
<XFiles :key="user.id" :user="user"/> <XFiles :key="user.id" :user="user"/>
@ -147,14 +144,27 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> --> </div> -->
<MkStickyContainer> <MkStickyContainer>
<template #header> <template #header>
<!-- You can't use v-if on these, as MkTab first *deletes* and replaces all children with native HTML elements. -->
<!-- Instead, we add a "no notes" placeholder and default to null (all notes) if there's nothing pinned. -->
<!-- It also converts all comments into text! -->
<MkTab v-model="noteview" :class="$style.tab"> <MkTab v-model="noteview" :class="$style.tab">
<option value="pinned">{{ i18n.ts.pinnedOnly }}</option>
<option :value="null">{{ i18n.ts.notes }}</option> <option :value="null">{{ i18n.ts.notes }}</option>
<option value="all">{{ i18n.ts.all }}</option> <option value="all">{{ i18n.ts.all }}</option>
<option value="files">{{ i18n.ts.withFiles }}</option> <option value="files">{{ i18n.ts.withFiles }}</option>
</MkTab> </MkTab>
</template> </template>
<MkLazy> <MkLazy>
<MkNotes :class="$style.tl" :noGap="true" :pagination="AllPagination"/> <div v-if="noteview === 'pinned'" class="_gaps">
<div v-if="user.pinnedNotes.length < 1" class="_fullinfo">
<img :src="infoImageUrl" class="_ghost" aria-hidden="true" :alt="i18n.ts.noNotes"/>
<div>{{ i18n.ts.noNotes }}</div>
</div>
<MkDateSeparatedList v-else v-slot="{ item: note }" :items="user.pinnedNotes" :noGap="true" :ad="true" class="_panel">
<MkNote :key="note.id" class="note" :note="note" :pinned="true"/>
</MkDateSeparatedList>
</div>
<MkNotes v-else :class="$style.tl" :noGap="true" :pagination="AllPagination"/>
</MkLazy> </MkLazy>
</MkStickyContainer> </MkStickyContainer>
</div> </div>
@ -194,6 +204,8 @@ import { misskeyApi } from '@/scripts/misskey-api.js';
import { isFollowingVisibleForMe, isFollowersVisibleForMe } from '@/scripts/isFfVisibleForMe.js'; import { isFollowingVisibleForMe, isFollowersVisibleForMe } from '@/scripts/isFfVisibleForMe.js';
import { useRouter } from '@/router/supplier.js'; import { useRouter } from '@/router/supplier.js';
import { getStaticImageUrl } from '@/scripts/media-proxy.js'; import { getStaticImageUrl } from '@/scripts/media-proxy.js';
import { infoImageUrl } from "@/instance.js";
import MkDateSeparatedList from "@/components/MkDateSeparatedList.vue";
const MkNote = defineAsyncComponent(() => const MkNote = defineAsyncComponent(() =>
(defaultStore.state.noteDesign === 'misskey') ? import('@/components/MkNote.vue') : (defaultStore.state.noteDesign === 'misskey') ? import('@/components/MkNote.vue') :
@ -241,7 +253,7 @@ const memoDraft = ref(props.user.memo);
const isEditingMemo = ref(false); const isEditingMemo = ref(false);
const moderationNote = ref(props.user.moderationNote); const moderationNote = ref(props.user.moderationNote);
const editModerationNote = ref(false); const editModerationNote = ref(false);
const noteview = ref<string | null>(null); const noteview = ref<string | null>(props.user.pinnedNotes.length > 0 ? 'pinned' : null);
const listenbrainzdata = ref(false); const listenbrainzdata = ref(false);
if (props.user.listenbrainz) { if (props.user.listenbrainz) {