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]);
const getUniqueValues = (col: number): string[] =>
Array.from(columnUniqueValues[col] ?? []).sort();
Array.from(columnUniqueValues[col] as Set<string> ?? []).sort();
const filteredData = useMemo(() => {
let result = data.map((row, index) => ({ row, index }));
@@ -190,17 +190,16 @@ export function CosmeticItemsView({ data, headers, onSaveRow, onCaptureState, ro
>
<div
className="flex items-center gap-1 cursor-pointer select-none hover:text-white"
onClick={() => !isCpnp && handleSort(col)}
onClick={() => handleSort(col)}
>
{label}
{!isCpnp && sortCol === col && (
{sortCol === col && (
sortDesc ? <ChevronDown className="w-3 h-3" /> : <ChevronUp className="w-3 h-3" />
)}
{isCpnp && (
<span className="ml-1 text-[9px] text-indigo-400 font-normal">(editable)</span>
)}
</div>
{!isCpnp && (
<div className="mt-1 relative">
<button
id={`cosmetic-filter-trigger-${col}`}
@@ -231,7 +230,6 @@ export function CosmeticItemsView({ data, headers, onSaveRow, onCaptureState, ro
/>
)}
</div>
)}
</th>
);
})}