From 1d74cd493ce1599ab8c9a9e9f976a651a66adff7 Mon Sep 17 00:00:00 2001 From: SylvainP1 <5533467-SylvainP1@users.noreply.replit.com> Date: Fri, 24 Apr 2026 08:33:34 +0000 Subject: [PATCH] Add a toggle to display daily totals in hours or days Update the UI to include a switch that allows users to toggle between displaying time totals in hours (h) or days (j). When in days view, totals are rounded up with 8 hours equaling 1 day. This change affects the display of row totals, column totals, and the grand total. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 55837015-10e9-4be9-b857-7f5e6be73772 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 22ef23e4-98ff-4918-acea-488d8cc9708f Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1cc377db-7ea0-49f2-97ce-c3e87e0228cc/55837015-10e9-4be9-b857-7f5e6be73772/qXEnLes Replit-Helium-Checkpoint-Created: true --- .../cra-app/src/pages/timesheet-detail.tsx | 51 +++++++++++++++---- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/artifacts/cra-app/src/pages/timesheet-detail.tsx b/artifacts/cra-app/src/pages/timesheet-detail.tsx index 7f4ddef..bc46edb 100644 --- a/artifacts/cra-app/src/pages/timesheet-detail.tsx +++ b/artifacts/cra-app/src/pages/timesheet-detail.tsx @@ -112,6 +112,7 @@ export default function TimesheetDetailPage() { const [localDescriptions, setLocalDescriptions] = useState>({}); const [isAddingLine, setIsAddingLine] = useState(false); const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false); + const [showDays, setShowDays] = useState(false); const dirtyKeysRef = useRef>(new Set()); const { data: projects } = useListProjects({ query: { queryKey: getListProjectsQueryKey() } }); @@ -421,17 +422,43 @@ export default function TimesheetDetailPage() {
- {isEditable && ( -
- +
+
+ {isEditable && ( + + )} +
+
+
+ h + + j +
- Total: {grandTotal}h + Total: + {showDays ? `${Math.ceil(grandTotal / 8)}j` : `${grandTotal}h`} +
- )} +
@@ -571,7 +598,9 @@ export default function TimesheetDetailPage() { @@ -593,12 +622,12 @@ export default function TimesheetDetailPage() { total >= 8 ? "text-green-700 font-bold bg-green-50" : "" )} > - {total > 0 ? total : ""} + {total > 0 ? (showDays ? `${Math.ceil(total / 8)}j` : total) : ""} ); })}
{rowTotals[line.id] > 0 ? ( - {rowTotals[line.id]}h + + {showDays ? `${Math.ceil(rowTotals[line.id] / 8)}j` : `${rowTotals[line.id]}h`} + ) : "-"}
- {grandTotal}h + {showDays ? `${Math.ceil(grandTotal / 8)}j` : `${grandTotal}h`}