"use client" import { Button } from "@/components/ui/button" import { Label } from "@/components/ui/label" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select" export type AdminListSortOption = { value: string label: string } const DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100] as const export function AdminListControls({ page, pageSize, total, totalPages, pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS, sort, sortOptions, onPageChange, onPageSizeChange, onSortChange, itemLabel, }: { page: number pageSize: number total: number totalPages: number pageSizeOptions?: readonly number[] sort: string sortOptions: readonly AdminListSortOption[] onPageChange: (page: number) => void onPageSizeChange: (pageSize: number) => void onSortChange: (sort: string) => void itemLabel: string }) { const rangeStart = total === 0 ? 0 : (page - 1) * pageSize + 1 const rangeEnd = Math.min(page * pageSize, total) return (
{total === 0 ? `0 ${itemLabel}` : `${rangeStart.toLocaleString("fr-FR")}–${rangeEnd.toLocaleString("fr-FR")} sur ${total.toLocaleString("fr-FR")} ${itemLabel}`}