This commit is contained in:
rustmailer
2026-08-09 16:45:00 +08:00
parent a07e8b3a78
commit 4809f298e9
4 changed files with 14 additions and 17 deletions

View File

@@ -45,7 +45,7 @@ interface PaginationProps {
setPageSize: (pageSize: number) => void
}
export function AttachmentListPagination({
export function TablePagination({
totalItems,
pageIndex,
pageSize,

View File

@@ -20,7 +20,7 @@
import { Card, CardContent } from '@/components/ui/card';
import { FixedHeader } from '@/components/layout/fixed-header';
import { Main } from '@/components/layout/main';
import { AttachmentListPagination } from '@/components/pagination';
import { TablePagination } from '@/components/pagination';
import React from 'react';
import AttachmentProvider, { AttachmentDialogType } from './context';
import useDialogState from '@/hooks/use-dialog-state';
@@ -119,7 +119,7 @@ export default function AttachmentSearch() {
setSortBy={setSortBy}
setSortOrder={setSortOrder}
/>
{total > 0 && <AttachmentListPagination
{total > 0 && <TablePagination
totalItems={total}
hasNextPage={() => page < totalPages}
pageIndex={page - 1}

View File

@@ -9,7 +9,7 @@ import { useQuery } from '@tanstack/react-query'
import { useTranslation } from 'react-i18next'
import { Main } from '@/components/layout/main'
import { FixedHeader } from '@/components/layout/fixed-header'
import { AttachmentListPagination } from '@/components/pagination'
import { TablePagination } from '@/components/pagination'
import { Button } from '@/components/ui/button'
import {
Select,
@@ -276,10 +276,10 @@ export default function AuditLog() {
start_ms: applied.start ? applied.start.getTime() : undefined,
end_ms: applied.end
? new Date(
applied.end.getFullYear(),
applied.end.getMonth(),
applied.end.getDate() + 1,
).getTime()
applied.end.getFullYear(),
applied.end.getMonth(),
applied.end.getDate() + 1,
).getTime()
: undefined,
}),
placeholderData: (prev) => prev,
@@ -459,19 +459,16 @@ export default function AuditLog() {
</TableBody>
</Table>
</div>
<div className='mt-3 flex items-center justify-between'>
<span className='text-sm text-muted-foreground'>
{t('table.total', { total: data?.total ?? 0 })}
</span>
<AttachmentListPagination
{data && data.total > 0 && <div className='mt-2'>
<TablePagination
totalItems={data?.total ?? 0}
pageIndex={page - 1}
pageSize={PAGE_SIZE}
hasNextPage={() => (data?.total ?? 0) > page * PAGE_SIZE}
setPageIndex={(i) => setPage(i + 1)}
setPageSize={() => {}}
setPageSize={() => { }}
/>
</div>
</div>}
{isFetching && (
<div className='mt-2 text-xs text-muted-foreground'>
{t('audit.loading', 'Loading…')}

View File

@@ -21,7 +21,7 @@ import { Card, CardContent } from '@/components/ui/card';
import { FixedHeader } from '@/components/layout/fixed-header';
import { Main } from '@/components/layout/main';
import { useSearchMessages } from '@/hooks/use-search-messages';
import { AttachmentListPagination } from '@/components/pagination';
import { TablePagination } from '@/components/pagination';
import React from 'react';
import { EmailEnvelope } from '@/api';
import { MailDisplayDrawer } from './mail-display-dialog';
@@ -128,7 +128,7 @@ export default function EmailSearch() {
setSortBy={setSortBy}
setSortOrder={setSortOrder}
/>
{total > 0 && <AttachmentListPagination
{total > 0 && <TablePagination
totalItems={total}
hasNextPage={() => page < totalPages}
pageIndex={page - 1}