This commit is contained in:
syuilo 2025-05-03 13:16:59 +09:00
parent dafc6b2d45
commit 8cbd3dcd42
4 changed files with 33 additions and 26 deletions

View File

@ -4,37 +4,40 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<MkPagination ref="pagingComponent" :pagination="pagination" :disableAutoLoad="disableAutoLoad"> <component :is="prefer.s.enablePullToRefresh ? MkPullToRefresh : 'div'" :refresher="() => reload()">
<template #empty> <MkPagination ref="pagingComponent" :pagination="pagination" :disableAutoLoad="disableAutoLoad">
<div class="_fullinfo"> <template #empty>
<img :src="infoImageUrl" draggable="false"/> <div class="_fullinfo">
<div>{{ i18n.ts.noNotes }}</div> <img :src="infoImageUrl" draggable="false"/>
</div> <div>{{ i18n.ts.noNotes }}</div>
</template> </div>
</template>
<template #default="{ items: notes }"> <template #default="{ items: notes }">
<div :class="[$style.root, { [$style.noGap]: noGap, '_gaps': !noGap, [$style.reverse]: pagination.reversed }]"> <div :class="[$style.root, { [$style.noGap]: noGap, '_gaps': !noGap, [$style.reverse]: pagination.reversed }]">
<template v-for="(note, i) in notes" :key="note.id"> <template v-for="(note, i) in notes" :key="note.id">
<div v-if="note._shouldInsertAd_" :class="[$style.noteWithAd, { '_gaps': !noGap }]" :data-scroll-anchor="note.id"> <div v-if="note._shouldInsertAd_" :class="[$style.noteWithAd, { '_gaps': !noGap }]" :data-scroll-anchor="note.id">
<MkNote :class="$style.note" :note="note" :withHardMute="true"/> <MkNote :class="$style.note" :note="note" :withHardMute="true"/>
<div :class="$style.ad"> <div :class="$style.ad">
<MkAd :preferForms="['horizontal', 'horizontal-big']"/> <MkAd :preferForms="['horizontal', 'horizontal-big']"/>
</div>
</div> </div>
</div> <MkNote v-else :class="$style.note" :note="note" :withHardMute="true" :data-scroll-anchor="note.id"/>
<MkNote v-else :class="$style.note" :note="note" :withHardMute="true" :data-scroll-anchor="note.id"/> </template>
</template> </div>
</div> </template>
</template> </MkPagination>
</MkPagination> </component>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { useTemplateRef } from 'vue'; import { useTemplateRef } from 'vue';
import type { Paging } from '@/components/MkPagination.vue';
import MkNote from '@/components/MkNote.vue'; import MkNote from '@/components/MkNote.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination from '@/components/MkPagination.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { infoImageUrl } from '@/instance.js'; import { infoImageUrl } from '@/instance.js';
import MkPullToRefresh from '@/components/MkPullToRefresh.vue';
import { prefer } from '@/preferences.js';
const props = defineProps<{ const props = defineProps<{
pagination: Paging; pagination: Paging;
@ -44,8 +47,12 @@ const props = defineProps<{
const pagingComponent = useTemplateRef('pagingComponent'); const pagingComponent = useTemplateRef('pagingComponent');
function reload() {
return pagingComponent.value?.paginator.reload();
}
defineExpose({ defineExpose({
pagingComponent, reload,
}); });
</script> </script>

View File

@ -48,7 +48,7 @@ async function post() {
await os.post(); await os.post();
store.set('postFormHashtags', ''); store.set('postFormHashtags', '');
store.set('postFormWithHashtags', false); store.set('postFormWithHashtags', false);
notes.value?.pagingComponent?.reload(); notes.value?.reload();
} }
const headerActions = computed(() => [{ const headerActions = computed(() => [{

View File

@ -35,7 +35,7 @@ const tlComponent = ref<InstanceType<typeof MkNotes>>();
function reloadTimeline() { function reloadTimeline() {
return new Promise<void>((res) => { return new Promise<void>((res) => {
tlComponent.value?.pagingComponent?.reload().then(() => { tlComponent.value?.reload().then(() => {
res(); res();
}); });
}); });

View File

@ -15,8 +15,8 @@ SPDX-License-Identifier: AGPL-3.0-only
import { ref } from 'vue'; import { ref } from 'vue';
import XColumn from './column.vue'; import XColumn from './column.vue';
import type { Column } from '@/deck.js'; import type { Column } from '@/deck.js';
import { i18n } from '@/i18n.js';
import MkNotes from '@/components/MkNotes.vue'; import MkNotes from '@/components/MkNotes.vue';
import { i18n } from '../../i18n.js';
defineProps<{ defineProps<{
column: Column; column: Column;
@ -27,7 +27,7 @@ const tlComponent = ref<InstanceType<typeof MkNotes>>();
function reloadTimeline() { function reloadTimeline() {
return new Promise<void>((res) => { return new Promise<void>((res) => {
tlComponent.value?.pagingComponent?.reload().then(() => { tlComponent.value?.reload().then(() => {
res(); res();
}); });
}); });