enhance: タグ検索においてローカルのみやファイル付きを指定できるように (MisskeyIO#527)

cheery-picked from TeamNijimiss/misskey@4fe36c8eb9

Co-authored-by: Nafu Satsuki <satsuki@nafusoft.dev>
This commit is contained in:
まっちゃとーにゅ 2024-03-16 17:37:58 +09:00 committed by GitHub
parent 5c019eec04
commit c2e1f60943
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 51 additions and 3 deletions

View file

@ -5,9 +5,17 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<MkStickyContainer>
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :contentMax="800">
<MkNotes ref="notes" class="" :pagination="pagination"/>
<div v-if="tab === 'all'">
<MkNotes class="" :pagination="pagination"/>
</div>
<div v-else-if="tab === 'localOnly'">
<MkNotes class="" :pagination="localOnlyPagination"/>
</div>
<div v-else-if="tab === 'withFiles'">
<MkNotes class="" :pagination="withFilesPagination"/>
</div>
</MkSpacer>
<template v-if="$i" #footer>
<div :class="$style.footer">
@ -29,6 +37,8 @@ import { $i } from '@/account.js';
import { defaultStore } from '@/store.js';
import * as os from '@/os.js';
const tab = ref('all');
const props = defineProps<{
tag: string;
}>();
@ -42,6 +52,24 @@ const pagination = {
};
const notes = ref<InstanceType<typeof MkNotes>>();
const localOnlyPagination = {
endpoint: 'notes/search-by-tag' as const,
limit: 10,
params: computed(() => ({
tag: props.tag,
local: true,
})),
};
const withFilesPagination = {
endpoint: 'notes/search-by-tag' as const,
limit: 10,
params: computed(() => ({
tag: props.tag,
withFiles: true,
})),
};
async function post() {
defaultStore.set('postFormHashtags', props.tag);
defaultStore.set('postFormWithHashtags', true);
@ -53,7 +81,16 @@ async function post() {
const headerActions = computed(() => []);
const headerTabs = computed(() => []);
const headerTabs = computed(() => [{
key: 'all',
title: i18n.ts.all,
}, {
key: 'localOnly',
title: i18n.ts.localOnly,
}, {
key: 'withFiles',
title: i18n.ts.withFiles,
}]);
definePageMetadata(() => ({
title: props.tag,