feat: enable sorting and filtering on CPNP No. column in Cosmetic Items tab

This commit is contained in:
Christian Vidal Wolf
2026-05-11 08:48:32 +02:00
parent e303c759d7
commit b182ef6037
+3 -5
View File
@@ -54,7 +54,7 @@ export function CosmeticItemsView({ data, headers, onSaveRow, onCaptureState, ro
}, [data, COLUMNS]); }, [data, COLUMNS]);
const getUniqueValues = (col: number): string[] => const getUniqueValues = (col: number): string[] =>
Array.from(columnUniqueValues[col] ?? []).sort(); Array.from(columnUniqueValues[col] as Set<string> ?? []).sort();
const filteredData = useMemo(() => { const filteredData = useMemo(() => {
let result = data.map((row, index) => ({ row, index })); let result = data.map((row, index) => ({ row, index }));
@@ -190,17 +190,16 @@ export function CosmeticItemsView({ data, headers, onSaveRow, onCaptureState, ro
> >
<div <div
className="flex items-center gap-1 cursor-pointer select-none hover:text-white" className="flex items-center gap-1 cursor-pointer select-none hover:text-white"
onClick={() => !isCpnp && handleSort(col)} onClick={() => handleSort(col)}
> >
{label} {label}
{!isCpnp && sortCol === col && ( {sortCol === col && (
sortDesc ? <ChevronDown className="w-3 h-3" /> : <ChevronUp className="w-3 h-3" /> sortDesc ? <ChevronDown className="w-3 h-3" /> : <ChevronUp className="w-3 h-3" />
)} )}
{isCpnp && ( {isCpnp && (
<span className="ml-1 text-[9px] text-indigo-400 font-normal">(editable)</span> <span className="ml-1 text-[9px] text-indigo-400 font-normal">(editable)</span>
)} )}
</div> </div>
{!isCpnp && (
<div className="mt-1 relative"> <div className="mt-1 relative">
<button <button
id={`cosmetic-filter-trigger-${col}`} id={`cosmetic-filter-trigger-${col}`}
@@ -231,7 +230,6 @@ export function CosmeticItemsView({ data, headers, onSaveRow, onCaptureState, ro
/> />
)} )}
</div> </div>
)}
</th> </th>
); );
})} })}