merge: Add "pinned" section to notes tab on user profiles (!689)

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

Approved-by: dakkar <dakkar@thenautilus.net>
Approved-by: Tess K <me@thvxl.se>
This commit is contained in:
dakkar 2024-11-13 11:14:59 +00:00
commit 0a05841f33
2 changed files with 23 additions and 9 deletions

View file

@ -141,8 +141,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkLazy> <MkLazy>
<XActivity :key="user.id" :user="user" :collapsed="true"/> <XActivity :key="user.id" :user="user" :collapsed="true"/>
</MkLazy> </MkLazy>
<MkLazy> <MkLazy v-if="user.listenbrainz && listenbrainzdata">
<XListenBrainz v-if="user.listenbrainz && listenbrainzdata" :key="user.id" :user="user" :collapsed="true"/> <XListenBrainz :key="user.id" :user="user" :collapsed="true"/>
</MkLazy> </MkLazy>
</template> </template>
<!-- <div v-if="!disableNotes"> <!-- <div v-if="!disableNotes">
@ -303,7 +303,7 @@ const pagination = {
endpoint: 'users/featured-notes' as const, endpoint: 'users/featured-notes' as const,
limit: 10, limit: 10,
params: computed(() => ({ params: computed(() => ({
userId: props.user.id, userId: props.user.id
})), })),
}; };
@ -820,10 +820,6 @@ onUnmounted(() => {
color: var(--success); color: var(--success);
} }
.pinnedNote:not(:last-child) {
border-bottom: solid 0.5px var(--divider);
}
.infoBadges { .infoBadges {
position: absolute; position: absolute;
top: 12px; top: 12px;

View file

@ -7,22 +7,40 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkStickyContainer> <MkStickyContainer>
<template #header> <template #header>
<MkTab v-model="tab" :class="$style.tab"> <MkTab v-model="tab" :class="$style.tab">
<option value="pinned">{{ i18n.ts.pinnedOnly }}</option>
<option value="featured">{{ i18n.ts.featured }}</option> <option value="featured">{{ i18n.ts.featured }}</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>
<MkNotes :noGap="true" :pagination="pagination" :class="$style.tl"/> <div v-if="tab === '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 :noGap="true" :pagination="pagination" :class="$style.tl"/>
</MkStickyContainer> </MkStickyContainer>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed } from 'vue'; import { ref, computed, defineAsyncComponent } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkNotes from '@/components/MkNotes.vue'; import MkNotes from '@/components/MkNotes.vue';
import MkTab from '@/components/MkTab.vue'; import MkTab from '@/components/MkTab.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { infoImageUrl } from '@/instance.js';
import { defaultStore } from '@/store.js';
const MkNote = defineAsyncComponent(() =>
defaultStore.state.noteDesign === 'sharkey'
? import('@/components/SkNote.vue')
: import('@/components/MkNote.vue'),
);
const props = defineProps<{ const props = defineProps<{
user: Misskey.entities.UserDetailed; user: Misskey.entities.UserDetailed;