Refactor: Extract common logic and reduce file size
Refactors `Index.tsx` and `JobCardHeader.tsx` to reduce bloat and extract common logic, such as job status coloring, into reusable components or utility functions. This improves code maintainability and readability.
This commit is contained in:
@@ -4,6 +4,8 @@ import { formatISK } from '@/utils/priceUtils';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { ChevronDown, ChevronUp } from 'lucide-react';
|
||||
import { getStatusBackgroundColor } from '@/utils/jobStatusUtils';
|
||||
|
||||
interface RecapPopoverProps {
|
||||
title: string;
|
||||
@@ -19,6 +21,7 @@ const RecapPopover: React.FC<RecapPopoverProps> = ({
|
||||
calculateJobValue
|
||||
}) => {
|
||||
const navigate = useNavigate();
|
||||
const [sortDescending, setSortDescending] = useState(true);
|
||||
|
||||
const jobContributions = jobs
|
||||
.map(job => ({
|
||||
|
||||
Reference in New Issue
Block a user