"use client"; import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight } from "lucide-react"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; const DEFAULT_GROUP_SIZE = 10; interface PageGroupNavProps { currentPage: number; totalPages: number; onPageChange: (page: number) => void; disabled?: boolean; groupSize?: number; } export function PageGroupNav({ currentPage, totalPages, onPageChange, disabled = false, groupSize = DEFAULT_GROUP_SIZE, }: PageGroupNavProps) { const safeTotal = Math.max(1, totalPages); const currentGroupIndex = Math.floor((currentPage - 1) / groupSize); const groupStartPage = currentGroupIndex * groupSize + 1; const lastGroupIndex = Math.floor((safeTotal - 1) / groupSize); const lastGroupStartPage = lastGroupIndex * groupSize + 1; const isFirstGroup = currentGroupIndex === 0; const isLastGroup = currentGroupIndex === lastGroupIndex; const slots: (number | null)[] = []; for (let i = 0; i < groupSize; i++) { const page = groupStartPage + i; slots.push(page <= safeTotal ? page : null); } return (