import { Button } from '@affine/admin/components/ui/button'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@affine/admin/components/ui/select'; import type { Table } from '@tanstack/react-table'; import { ChevronLeftIcon, ChevronRightIcon, ChevronsLeftIcon, ChevronsRightIcon, } from 'lucide-react'; import { useCallback, useTransition } from 'react'; interface DataTablePaginationProps { table: Table; } export function DataTablePagination({ table, }: DataTablePaginationProps) { const [, startTransition] = useTransition(); // to handle the error: a component suspended while responding to synchronous input. // This will cause the UI to be replaced with a loading indicator. // To fix, updates that suspend should be wrapped with startTransition. const onPageSizeChange = useCallback( (value: string) => { startTransition(() => { table.setPageSize(Number(value)); }); }, [table] ); const handleFirstPage = useCallback(() => { startTransition(() => { table.setPageIndex(0); }); }, [startTransition, table]); const handlePreviousPage = useCallback(() => { startTransition(() => { table.previousPage(); }); }, [startTransition, table]); const handleNextPage = useCallback(() => { startTransition(() => { table.nextPage(); }); }, [startTransition, table]); const handleLastPage = useCallback(() => { startTransition(() => { table.setPageIndex(table.getPageCount() - 1); }); }, [startTransition, table]); return (

Rows per page

Page {table.getState().pagination.pageIndex + 1} of{' '} {table.getPageCount()}
); }