1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-03 11:26:14 +02:00

feat: モデログを検索できるように

This commit is contained in:
syuilo
2025-06-28 21:38:54 +09:00
parent 3c5ed0ffbb
commit 3c6f07fc8c
4 changed files with 37 additions and 9 deletions

View File

@@ -9,12 +9,22 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSelect v-model="order" :class="$style.order" :items="[{ label: i18n.ts._order.newest, value: 'newest' }, { label: i18n.ts._order.oldest, value: 'oldest' }]">
<template #prefix><i class="ti ti-arrows-sort"></i></template>
</MkSelect>
<MkButton v-if="canSearch" v-tooltip="i18n.ts.search" iconOnly transparent rounded :active="search" @click="search = !search"><i class="ti ti-search"></i></MkButton>
<MkButton v-if="canSearch" v-tooltip="i18n.ts.search" iconOnly transparent rounded :active="searchOpened" @click="searchOpened = !searchOpened"><i class="ti ti-search"></i></MkButton>
<MkButton v-if="canFilter" v-tooltip="i18n.ts.filter" iconOnly transparent rounded :active="filterOpened" @click="filterOpened = !filterOpened"><i class="ti ti-filter"></i></MkButton>
<MkButton v-tooltip="i18n.ts.dateAndTime" iconOnly transparent rounded :active="date != null" @click="date = date == null ? Date.now() : null"><i class="ti ti-calendar-clock"></i></MkButton>
<MkButton v-tooltip="i18n.ts.reload" iconOnly transparent rounded @click="emit('reload')"><i class="ti ti-refresh"></i></MkButton>
</div>
<MkInput
v-if="searchOpened"
v-model="q"
type="search"
debounce
>
<template #label>{{ i18n.ts.search }}</template>
<template #prefix><i class="ti ti-search"></i></template>
</MkInput>
<MkInput
v-if="date != null"
type="date"
@@ -50,7 +60,7 @@ const emit = defineEmits<{
(ev: 'reload'): void;
}>();
const search = ref(false);
const searchOpened = ref(false);
const filterOpened = ref(props.filterOpened);
const order = defineModel<'newest' | 'oldest'>('order', {
@@ -60,6 +70,10 @@ const order = defineModel<'newest' | 'oldest'>('order', {
const date = defineModel<number | null>('date', {
default: null,
});
const q = defineModel<string | null>('q', {
default: null,
});
</script>
<style lang="scss" module>

View File

@@ -7,7 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<PageWithHeader :actions="headerActions" :tabs="headerTabs">
<div class="_spacer" style="--MI_SPACER-w: 900px;">
<div class="_gaps">
<MkPaginationControl v-model:order="order" v-model:date="date" canFilter @reload="paginator.reload()">
<MkPaginationControl v-model:order="order" v-model:date="date" v-model:q="q" canSearch canFilter @reload="paginator.reload()">
<MkSelect v-model="type" style="margin: 0; flex: 1;">
<template #label>{{ i18n.ts.type }}</template>
<option :value="null">{{ i18n.ts.all }}</option>
@@ -20,7 +20,11 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkPaginationControl>
<component :is="prefer.s.enablePullToRefresh ? MkPullToRefresh : 'div'" :refresher="() => paginator.reload()">
<MkTl :events="timeline" groupBy="d">
<MkLoading v-if="paginator.fetching.value"/>
<MkError v-else-if="paginator.error.value" @retry="paginator.init()"/>
<MkTl v-else :events="timeline" groupBy="d">
<template #left="{ event }">
<div>
<MkAvatar :user="event.user" style="width: 26px; height: 26px;"/>
@@ -59,6 +63,7 @@ const order = ref<'newest' | 'oldest'>('newest');
const date = ref<number | null>(null);
const type = ref<string | null>(null);
const moderatorId = ref('');
const q = ref<string | null>(null);
const paginator = usePagination({
ctx: {
@@ -68,6 +73,7 @@ const paginator = usePagination({
params: computed(() => ({
type: type.value,
userId: moderatorId.value === '' ? null : moderatorId.value,
search: q.value,
})),
},
});