"use client"; import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight, } from "lucide-react"; import { Button } from "@/components/ui/button"; import type { Table } from "@tanstack/react-table"; import { useI18n } from "@/i18n/i18n-context"; interface DataTablePaginationProps { table: Table; } export function DataTablePagination({ table, }: DataTablePaginationProps) { const { t } = useI18n(); const selectedCount = table.getFilteredSelectedRowModel().rows.length; const totalCount = table.getFilteredRowModel().rows.length; const pageIndex = table.getState().pagination.pageIndex; const pageSize = table.getState().pagination.pageSize; const startItem = pageIndex * pageSize + 1; const endItem = Math.min((pageIndex + 1) * pageSize, totalCount); return (
{selectedCount > 0 && ( {t("common.paginationSelected", { count: selectedCount })} )} {t("common.paginationRange", { start: startItem, end: endItem, total: totalCount, })}
); }