Backend modules from tastefully 8bd93d15: core-libs, core-session, api-gateway, mobile-api, services-auth, services-system, services-counter, services-member, services-log, services-email. solvway-admin-portal from babyboo f64d096ea, solvway-customer-portal from tastefully 8bd93d15. Copied as tracked files only. Literal secrets replaced with environment placeholders: - services-email: SMTP_PASSWORD, MAILGUN_API_KEY, SENDGRID_API_KEY, MAILJET_API_KEY, MAILJET_SECRET_KEY (optional, empty default) - services-system: JUMIO_TOKEN, JUMIO_SECRET (optional) - services-auth: USER_AUTH_API_SECRET (required); commented JWT secret removed - core-libs: JWT_TOKEN default removed (required), XXL_JOB_TOKEN default removed, ipgeolocation key read from IPGEOLOCATION_API_KEY - services-system EkycAppConfig: commented Jumio credentials removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
61 lines
2.0 KiB
TypeScript
61 lines
2.0 KiB
TypeScript
import { ChevronLeft, ChevronRight } from 'lucide-react'
|
|
import { Button } from '@/app/components/ui/button'
|
|
import { useT } from '@/app/lib/i18n/MessagesProvider'
|
|
|
|
interface TablePagerProps {
|
|
/** 1-based. */
|
|
page: number
|
|
pageSize: number
|
|
total: number
|
|
onPageChange: (page: number) => void
|
|
isLoading?: boolean
|
|
}
|
|
|
|
/**
|
|
* The one pager every paged listing uses (fit-admin-listing-pages). It sticks to the bottom of the
|
|
* screen while its table is on screen, so it is visible without scrolling.
|
|
*/
|
|
export function TablePager({ page, pageSize, total, onPageChange, isLoading = false }: TablePagerProps) {
|
|
const t = useT()
|
|
const pageCount = Math.max(1, Math.ceil(total / pageSize))
|
|
const first = (page - 1) * pageSize + 1
|
|
const last = Math.min(page * pageSize, total)
|
|
const range = total === 0 ? t('PagerEmpty') : t('PagerRange', { first, last, total })
|
|
|
|
return (
|
|
<div
|
|
data-slot="table-pager"
|
|
className="sticky bottom-0 z-20 flex flex-wrap items-center justify-between gap-2 border-t bg-background py-2"
|
|
>
|
|
<p className="whitespace-nowrap text-sm text-muted-foreground">
|
|
<span className="tabular">{range}</span>
|
|
</p>
|
|
<div className="flex items-center gap-2">
|
|
<Button
|
|
variant="outline"
|
|
size="sm"
|
|
className="h-9"
|
|
onClick={() => onPageChange(page - 1)}
|
|
disabled={page <= 1 || isLoading}
|
|
>
|
|
<ChevronLeft aria-hidden="true" className="size-4" />
|
|
{t('PagerPrevious')}
|
|
</Button>
|
|
<span className="tabular whitespace-nowrap text-sm text-muted-foreground">
|
|
{t('PagerPageOf', { page, pages: pageCount })}
|
|
</span>
|
|
<Button
|
|
variant="outline"
|
|
size="sm"
|
|
className="h-9"
|
|
onClick={() => onPageChange(page + 1)}
|
|
disabled={page >= pageCount || isLoading}
|
|
>
|
|
{t('PagerNext')}
|
|
<ChevronRight aria-hidden="true" className="size-4" />
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|