'use client'; import shared from '../../styles/shared.module.css'; import styles from '../../styles/Customizations.module.css'; import { CustomizationItem, Tab, getCosmeticIconUrl } from './types'; type Props = { tab: Tab; allFilteredItems: CustomizationItem[]; pagedItems: CustomizationItem[]; page: number; totalPages: number; search: string; unlockedSet: Set; characterMap: Map; onSearchChange: (s: string) => void; onUnlockAll: () => void; onLockAll: () => void; onUnlockPage: () => void; onLockPage: () => void; onToggle: (id: string) => void; onPageChange: (p: number) => void; }; export default function FlatCategory({ tab, allFilteredItems, pagedItems, page, totalPages, search, unlockedSet, characterMap, onSearchChange, onUnlockAll, onLockAll, onUnlockPage, onLockPage, onToggle, onPageChange }: Props) { const buildPageNumbers = () => { const pages: number[] = []; const start = Math.max(1, Math.min(page - 2, totalPages - 4)); const end = Math.min(totalPages, start + 4); for (let i = start; i <= end; i++) pages.push(i); return pages; }; return ( <>
onSearchChange(e.target.value)} /> {allFilteredItems.length} items
{allFilteredItems.length === 0 ? (
No items found
) : ( <>
{pagedItems.map((item) => { const unlocked = unlockedSet.has(item.id); return (
onToggle(item.id)} > {item.name} {item.name}
); })}
{totalPages > 1 && (
{buildPageNumbers().map((n) => ( ))} {page} / {totalPages}
)} )} ); }