Skip to content

Commit

Permalink
Sort active grants DESC (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
carletex authored Jun 28, 2024
1 parent 85a25da commit 2fb633a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/nextjs/app/_components/ActiveGrants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ export const ActiveGrants = async () => {
return null;
}

// Sort by approved date DESC
const sortedActiveGrants = activeGrants.sort((a, b) => {
if (a.approvedAt && b.approvedAt) {
return b.approvedAt - a.approvedAt;
}
return 0;
});

return (
<div className="container flex flex-col justify-center max-w-[90%] xl:max-w-7xl mx-auto py-16 lg:pt-20 lg:pb-28 gap-6">
<div className="self-center lg:self-start w-fit relative">
Expand All @@ -42,7 +50,7 @@ export const ActiveGrants = async () => {
</tr>
</thead>
<tbody className="">
{activeGrants.map(grant => (
{sortedActiveGrants.map(grant => (
<ActiveGrantRow key={grant.id} {...grant} />
))}
</tbody>
Expand Down

0 comments on commit 2fb633a

Please sign in to comment.