misc: improve pagination
This commit is contained in:
1 parent
868f0c589a
commit
cc25808742
4 files changed
+13
-6
No files matched your search
@@ -123,7 +123,8 @@
|
|||||||
class="h-full flex items-center justify-center gap-1 ml-auto w-max mr-2"
|
class="h-full flex items-center justify-center gap-1 ml-auto w-max mr-2"
|
||||||
>
|
>
|
||||||
{#if node.children.length > 0}
|
{#if node.children.length > 0}
|
||||||
<FormattedNumber number={node.children.length}></FormattedNumber>
|
<FormattedNumber number={node.comment_view.counts.child_count}
|
||||||
|
></FormattedNumber>
|
||||||
{/if}
|
{/if}
|
||||||
<Icon
|
<Icon
|
||||||
src={open ? Minus : Plus}
|
src={open ? Minus : Plus}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
title={$t('common.back')}
|
title={$t('common.back')}
|
||||||
size="square-md"
|
size="square-md"
|
||||||
rounding="pill"
|
rounding="pill"
|
||||||
class="text-inherit dark:text-inherit"
|
class="text-inherit dark:text-inherit disabled:!opacity-20 disabled:!bg-transparent"
|
||||||
disabled={(!cursor?.back && cursor?.next) || page <= 1}
|
disabled={(!cursor?.back && cursor?.next) || page <= 1}
|
||||||
>
|
>
|
||||||
<Icon src={ChevronLeft} size="24" mini slot="suffix" />
|
<Icon src={ChevronLeft} size="24" mini slot="suffix" />
|
||||||
|
|||||||
@@ -127,7 +127,7 @@
|
|||||||
<option value="true">{$t('filter.unread')}</option>
|
<option value="true">{$t('filter.unread')}</option>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-4 list-none flex-1 h-full justify-center mt-4">
|
<div class="flex flex-col gap-4 list-none flex-1 h-full mt-4">
|
||||||
{#if !data.data || (data.data?.length ?? 0) == 0}
|
{#if !data.data || (data.data?.length ?? 0) == 0}
|
||||||
<Placeholder
|
<Placeholder
|
||||||
icon={Inbox}
|
icon={Inbox}
|
||||||
@@ -143,12 +143,12 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{#if !(data.page == 1 && (data?.data?.length ?? 0) == 0)}
|
{#if !(data.page == 1 && (data?.data?.length ?? 0) == 0)}
|
||||||
<div
|
<div
|
||||||
class="sticky z-30 mx-auto max-w-full"
|
class="sticky z-30 mx-auto max-w-full self-end mt-auto"
|
||||||
style="bottom: max(1.5rem, {$contentPadding.bottom}px);"
|
style="bottom: max(1.5rem, {$contentPadding.bottom}px);"
|
||||||
>
|
>
|
||||||
<Tabs routes={[]} class="mx-auto">
|
<Tabs routes={[]} class="mx-auto">
|
||||||
<Pageination
|
<Pageination
|
||||||
hasMore={!(!data.data || (data.data?.length ?? 0) == 0)}
|
hasMore={!(!data.data || (data.data?.length ?? 0) < data.limit)}
|
||||||
page={data.page}
|
page={data.page}
|
||||||
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -58,5 +58,11 @@ export async function load({ url, fetch }) {
|
|||||||
publishedToDate(a.published).getTime()
|
publishedToDate(a.published).getTime()
|
||||||
)
|
)
|
||||||
|
|
||||||
return { unreadOnly: unreadOnly, type: type, page: page, data: data }
|
return {
|
||||||
|
unreadOnly: unreadOnly,
|
||||||
|
type: type,
|
||||||
|
page: page,
|
||||||
|
data: data,
|
||||||
|
limit: 20,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user