Merge branch 'main' into codex/update-dependencies-to-latest-versions

This commit is contained in:
beatz174-bit
2025-11-24 19:59:44 +10:00
committed by GitHub
4 changed files with 26 additions and 21 deletions
+7 -15
View File
@@ -91,25 +91,17 @@ export const ActivePickListScreen = () => {
const sortedItems = useMemo(() => {
return [...itemsVisibleByStatus].sort((a, b) => {
const productA = productMap.get(a.product_id);
const productB = productMap.get(b.product_id);
const timeA = a.created_at ?? a.updated_at ?? 0;
const timeB = b.created_at ?? b.updated_at ?? 0;
const nameA = productA ? normalizeName(productA.name) : '';
const nameB = productB ? normalizeName(productB.name) : '';
const nameComparison = nameA.localeCompare(nameB, undefined, { sensitivity: 'base' });
if (nameComparison !== 0) {
return nameComparison;
if (timeA !== timeB) {
return timeA - timeB;
}
if (a.is_carton !== b.is_carton) {
return a.is_carton ? 1 : -1;
}
const nameA = normalizeName(productMap.get(a.product_id)?.name ?? '');
const nameB = normalizeName(productMap.get(b.product_id)?.name ?? '');
const timeA = a.updated_at ?? a.created_at;
const timeB = b.updated_at ?? b.created_at;
return timeA - timeB;
return nameA.localeCompare(nameB, undefined, { sensitivity: 'base' });
});
}, [itemsVisibleByStatus, productMap]);