feat(ST-05mofrm7): sorteerlogica herschrijven zodat sortDir correct verwerkt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scrum4Me Agent 2026-05-06 06:42:36 +02:00
parent f9606472fe
commit 99949b5311

View file

@ -267,14 +267,15 @@ export function PbiList({ productId, isDemo }: PbiListProps) {
(sortDir !== 'asc' ? 1 : 0) (sortDir !== 'asc' ? 1 : 0)
const filtered = [...base].sort((a, b) => { const filtered = [...base].sort((a, b) => {
let cmp = 0
if (sortMode === 'code') { if (sortMode === 'code') {
return (a.code ?? '').localeCompare(b.code ?? '', 'nl', { numeric: true }) cmp = (a.code ?? '').localeCompare(b.code ?? '', 'nl', { numeric: true })
} else if (sortMode === 'date') {
cmp = new Date(a.created_at).getTime() - new Date(b.created_at).getTime()
} else {
cmp = a.priority !== b.priority ? a.priority - b.priority : 0
} }
if (sortMode === 'date') { return sortDir === 'asc' ? cmp : -cmp
return new Date(b.created_at).getTime() - new Date(a.created_at).getTime()
}
// priority: sort by priority asc, then drag-and-drop sort_order within group
return a.priority !== b.priority ? a.priority - b.priority : 0
}) })
const sensors = useSensors( const sensors = useSensors(