From 422b4c9170f00a37e14d5bea05e859505b8b2979 Mon Sep 17 00:00:00 2001 From: HrithikSampson Date: Thu, 3 Oct 2024 17:23:16 +0530 Subject: [PATCH 1/2] sort the rounds in project page --- .../project/projectDonations/QfRoundSelector.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/views/project/projectDonations/QfRoundSelector.tsx b/src/components/views/project/projectDonations/QfRoundSelector.tsx index 9f6feba4ea..848a1b11dc 100644 --- a/src/components/views/project/projectDonations/QfRoundSelector.tsx +++ b/src/components/views/project/projectDonations/QfRoundSelector.tsx @@ -37,9 +37,14 @@ export const QfRoundSelector: FC = ({ const navigationNextRef = useRef(null); const sortedRounds = - projectData?.qfRounds?.sort( - (a, b) => Number(b.isActive) - Number(a.isActive), - ) || []; + projectData?.qfRounds?.sort((a: IQFRound, b: IQFRound) => { + const activeFirstCompare = Number(b.isActive) - Number(a.isActive); + console.log(a.beginDate, b.beginDate); + if (activeFirstCompare === 0) { + return new Date(b.beginDate) > new Date(a.beginDate) ? 1 : -1; + } + return activeFirstCompare; + }) || []; const isRecurringSelected = projectDonationSwiperState.isRecurringSelected; const selectedQF = projectDonationSwiperState.selectedQF; From d7c2c1fc6177fa0b7d0c6089a53e196836e20527 Mon Sep 17 00:00:00 2001 From: HrithikSampson Date: Thu, 3 Oct 2024 17:26:36 +0530 Subject: [PATCH 2/2] chore: remove log statements --- .../views/project/projectDonations/QfRoundSelector.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/views/project/projectDonations/QfRoundSelector.tsx b/src/components/views/project/projectDonations/QfRoundSelector.tsx index 848a1b11dc..726f585e86 100644 --- a/src/components/views/project/projectDonations/QfRoundSelector.tsx +++ b/src/components/views/project/projectDonations/QfRoundSelector.tsx @@ -39,7 +39,6 @@ export const QfRoundSelector: FC = ({ const sortedRounds = projectData?.qfRounds?.sort((a: IQFRound, b: IQFRound) => { const activeFirstCompare = Number(b.isActive) - Number(a.isActive); - console.log(a.beginDate, b.beginDate); if (activeFirstCompare === 0) { return new Date(b.beginDate) > new Date(a.beginDate) ? 1 : -1; }