diff --git a/artifacts/cra-app/src/pages/timesheet-detail.tsx b/artifacts/cra-app/src/pages/timesheet-detail.tsx index 3535433..14c8f03 100644 --- a/artifacts/cra-app/src/pages/timesheet-detail.tsx +++ b/artifacts/cra-app/src/pages/timesheet-detail.tsx @@ -1,4 +1,4 @@ -import { useState, useMemo, useEffect, useRef, useCallback } from "react"; +import { useState, useMemo, useEffect, useRef, useCallback, type ReactNode } from "react"; import { useParams, Link } from "wouter"; import { useGetTimesheet, @@ -30,6 +30,7 @@ import { SelectValue } from "@/components/ui/select"; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog"; +import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; import { useToast } from "@/hooks/use-toast"; import { formatMonthYear, STATUS_LABELS, STATUS_COLORS, cn } from "@/lib/utils"; import { getDaysInMonth, isWeekend, format } from "date-fns"; @@ -103,18 +104,11 @@ export default function TimesheetDetailPage() { }; }, [timesheet]); - const handleCellClick = (lineId: number, dateStr: string) => { - if (!isEditable) return; - + const HOUR_OPTIONS = [0, 0.5, 1, 2, 3, 4, 5, 6, 7, 7.7]; + + const handleSetHours = (lineId: number, dateStr: string, hours: number) => { const key = `${lineId}-${dateStr}`; - const current = localEntries[key] || 0; - - // Cycle: 0 -> 0.5 -> 1 -> 0 - let next = 0.5; - if (current === 0.5) next = 1; - if (current === 1) next = 0; - - setLocalEntries(prev => ({ ...prev, [key]: next })); + setLocalEntries(prev => ({ ...prev, [key]: hours })); setHasUnsavedChanges(true); }; @@ -367,10 +361,15 @@ export default function TimesheetDetailPage() { const key = `${line.id}-${day.dateStr}`; const val = localEntries[key] || 0; + const cellContent = ( +