From 2ba0f735fd0d6edc1aaf518084ef02b62c491ac9 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Mon, 7 Jul 2025 19:52:05 +0200 Subject: [PATCH] Update --- src/components/RecapPopover.tsx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/components/RecapPopover.tsx b/src/components/RecapPopover.tsx index 098f88a..43c7cd1 100644 --- a/src/components/RecapPopover.tsx +++ b/src/components/RecapPopover.tsx @@ -1,4 +1,5 @@ +import { useState } from 'react'; import { IndJob } from '@/lib/types'; import { formatISK } from '@/utils/priceUtils'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; @@ -29,12 +30,16 @@ const RecapPopover: React.FC = ({ value: calculateJobValue(job) })) .filter(({ value }) => value !== 0) - .sort((a, b) => Math.abs(b.value) - Math.abs(a.value)); + .sort((a, b) => sortDescending ? Math.abs(b.value) - Math.abs(a.value) : Math.abs(a.value) - Math.abs(b.value)); const handleJobClick = (jobId: string) => { navigate(`/${jobId}`); }; + const toggleSort = () => { + setSortDescending(!sortDescending); + }; + return ( @@ -42,7 +47,16 @@ const RecapPopover: React.FC = ({ - {title} + + {title} + + {jobContributions.length === 0 ? ( @@ -52,7 +66,7 @@ const RecapPopover: React.FC = ({
handleJobClick(job.id)} - className="flex justify-between items-center p-2 rounded hover:bg-gray-700/50 cursor-pointer transition-colors border-l-2 border-l-gray-600" + className={`flex justify-between items-center p-2 rounded hover:bg-gray-700/50 cursor-pointer transition-colors border-l-2 border-l-gray-600 ${getStatusBackgroundColor(job.status)}`} >