summaryrefslogtreecommitdiff
path: root/packages/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'packages/frontend')
-rw-r--r--packages/frontend/src/components/MkPaginationControl.vue18
-rw-r--r--packages/frontend/src/pages/admin/modlog.vue10
2 files changed, 24 insertions, 4 deletions
diff --git a/packages/frontend/src/components/MkPaginationControl.vue b/packages/frontend/src/components/MkPaginationControl.vue
index ce19005504..8eab987d2a 100644
--- a/packages/frontend/src/components/MkPaginationControl.vue
+++ b/packages/frontend/src/components/MkPaginationControl.vue
@@ -9,13 +9,23 @@ 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"
:modelValue="formatDateTimeString(new Date(date), 'yyyy-MM-dd')"
@@ -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>
diff --git a/packages/frontend/src/pages/admin/modlog.vue b/packages/frontend/src/pages/admin/modlog.vue
index 9c1c1d0cc2..76b313026b 100644
--- a/packages/frontend/src/pages/admin/modlog.vue
+++ b/packages/frontend/src/pages/admin/modlog.vue
@@ -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,
})),
},
});