mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 11:55:23 +02:00
feat: enable sorting and filtering on CPNP No. column in Cosmetic Items tab
This commit is contained in:
@@ -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,18 +190,17 @@ 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}`}
|
||||||
onClick={(e) => { e.stopPropagation(); setOpenFilter(openFilter === col ? null : col); }}
|
onClick={(e) => { e.stopPropagation(); setOpenFilter(openFilter === col ? null : col); }}
|
||||||
@@ -231,7 +230,6 @@ export function CosmeticItemsView({ data, headers, onSaveRow, onCaptureState, ro
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</th>
|
</th>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
Reference in New Issue
Block a user