fix: invert backend sorting to make new payloads appear first and fix group sorting
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 51s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 51s
This commit is contained in:
@@ -2,6 +2,7 @@ import { useMemo } from 'react';
|
||||
import { useParams, Link, useOutletContext } from 'react-router-dom';
|
||||
import { ArrowLeft, User, Tag, Package, DollarSign, Clock } from 'lucide-react';
|
||||
import type { OrderData } from '../types';
|
||||
import { parseOrderDate } from '../dataService';
|
||||
|
||||
const ClientDetails = () => {
|
||||
const { name } = useParams<{ name: string }>();
|
||||
@@ -37,9 +38,7 @@ const ClientDetails = () => {
|
||||
|
||||
// Sort grouped orders by date descending
|
||||
const groupedOrders = Object.values(groupedOrdersMap).sort((a, b) => {
|
||||
const [dayA, monthA, yearA] = a.date.split('-').map(Number);
|
||||
const [dayB, monthB, yearB] = b.date.split('-').map(Number);
|
||||
return new Date(yearB, monthB - 1, dayB).getTime() - new Date(yearA, monthA - 1, dayA).getTime();
|
||||
return parseOrderDate(b.date).getTime() - parseOrderDate(a.date).getTime();
|
||||
});
|
||||
|
||||
return { groupedOrders, totalSpent, totalItems };
|
||||
|
||||
Reference in New Issue
Block a user