merge: On user profiles, move pinned notes down with the other note tabs (resolves #555) (!651)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/651

Closes #555

Approved-by: dakkar <dakkar@thenautilus.net>
Approved-by: Marie <github@yuugi.dev>
This commit is contained in:
Hazelnoot 2024-10-10 16:33:39 +00:00
commit 2be802131f
4 changed files with 27 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>
<div v-else class="_panel">
<MkNote v-for="note of user.pinnedNotes" :key="note.id" class="note" :class="$style.pinnedNote" :note="note" :pinned="true"/>
</div>
</div>
<MkNotes v-else :class="$style.tl" :noGap="true" :pagination="AllPagination"/>
</MkLazy> </MkLazy>
</MkStickyContainer> </MkStickyContainer>
</div> </div>
@ -194,6 +204,7 @@ 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';
const MkNote = defineAsyncComponent(() => const MkNote = defineAsyncComponent(() =>
(defaultStore.state.noteDesign === 'misskey') ? import('@/components/MkNote.vue') : (defaultStore.state.noteDesign === 'misskey') ? import('@/components/MkNote.vue') :
@ -795,7 +806,7 @@ onUnmounted(() => {
} }
.tab { .tab {
margin: calc(var(--margin) / 2) 0; margin-bottom: calc(var(--margin) / 2);
padding: calc(var(--margin) / 2) 0; padding: calc(var(--margin) / 2) 0;
background: color-mix(in srgb, var(--bg) 65%, transparent); background: color-mix(in srgb, var(--bg) 65%, transparent);
backdrop-filter: var(--blur, blur(15px)); backdrop-filter: var(--blur, blur(15px));
@ -812,4 +823,8 @@ onUnmounted(() => {
margin-left: 4px; margin-left: 4px;
color: var(--success); color: var(--success);
} }
.pinnedNote:not(:last-child) {
border-bottom: solid 0.5px var(--divider);
}
</style> </style>