From 75fc797807803b255e1eac9d93617d67782df071 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Mon, 11 May 2026 20:41:23 +0000 Subject: [PATCH 1/4] Work in progress --- src/routeTree.gen.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/routeTree.gen.ts b/src/routeTree.gen.ts index 908955b..92d70af 100644 --- a/src/routeTree.gen.ts +++ b/src/routeTree.gen.ts @@ -1335,3 +1335,12 @@ const rootRouteChildren: RootRouteChildren = { export const routeTree = rootRouteImport ._addFileChildren(rootRouteChildren) ._addFileTypes() + +import type { getRouter } from './router.tsx' +import type { createStart } from '@tanstack/react-start' +declare module '@tanstack/react-start' { + interface Register { + ssr: true + router: Awaited> + } +} From f7c5cbc2d7437e241f518bbae55fb8426e7ebe97 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Mon, 11 May 2026 20:41:40 +0000 Subject: [PATCH 2/4] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/timer/header-timer.tsx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/components/timer/header-timer.tsx b/src/components/timer/header-timer.tsx index 999b0ec..506d2b1 100644 --- a/src/components/timer/header-timer.tsx +++ b/src/components/timer/header-timer.tsx @@ -7,6 +7,7 @@ import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; import { Checkbox } from "@/components/ui/checkbox"; +import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"; import { Popover, PopoverContent, @@ -50,6 +51,8 @@ export function HeaderTimer() { const [feeItems, setFeeItems] = useState([]); const [feeItemId, setFeeItemId] = useState(""); const [showNewFee, setShowNewFee] = useState(false); + const [pricingMode, setPricingMode] = useState<"hourly" | "flat">("hourly"); + const [customAmount, setCustomAmount] = useState(""); const [staff, setStaff] = useState>([]); const [enteredById, setEnteredById] = useState(""); @@ -98,13 +101,16 @@ export function HeaderTimer() { [feeItems, feeItemId], ); - const isFlatFee = selectedFee?.pricing_type === "flat"; + const isFlatFee = pricingMode === "flat" || selectedFee?.pricing_type === "flat"; // If a fee item has no rate (0), fall back to the case rate then the user's // profile rate. Flat-fee items always use their own amount. + const customAmountNum = Number(customAmount); + const hasCustomAmount = customAmount !== "" && !Number.isNaN(customAmountNum) && customAmountNum > 0; const feeRate = selectedFee && Number(selectedFee.amount) > 0 ? selectedFee.amount : null; - const effectiveRate = - feeRate ?? activeCase?.default_hourly_rate ?? profileRate ?? 0; + const effectiveRate = hasCustomAmount + ? customAmountNum + : (feeRate ?? activeCase?.default_hourly_rate ?? profileRate ?? 0); const handleSelectFee = (id: string) => { setFeeItemId(id); @@ -112,6 +118,7 @@ export function HeaderTimer() { if (fee && !timer.description.trim()) { setDescription(fee.description?.trim() || fee.name); } + if (fee) setPricingMode(fee.pricing_type); }; const handleSave = async () => { @@ -119,11 +126,12 @@ export function HeaderTimer() { if (!timer.caseId) return toast.error("Select a case before saving"); if (!timer.description.trim()) return toast.error("Description required"); if (elapsedMs < 1000 && !isFlatFee) return toast.error("Timer hasn't recorded any time yet"); + if (isFlatFee && !(effectiveRate > 0)) return toast.error("Enter a flat fee amount"); setSaving(true); const { hours: tracked } = consume(); // For a flat-fee item, store 1 hour at the flat amount so the total = flat amount. const hours = isFlatFee ? 1 : tracked; - const rate = isFlatFee ? selectedFee!.amount : effectiveRate; + const rate = effectiveRate; const { error } = await supabase.from("time_entries").insert({ case_id: timer.caseId, user_id: enteredById || user.id, @@ -148,6 +156,8 @@ export function HeaderTimer() { ); setBillable(true); setFeeItemId(""); + setPricingMode("hourly"); + setCustomAmount(""); setEnteredById(user.id); setOpen(false); }; @@ -157,6 +167,8 @@ export function HeaderTimer() { reset(); setBillable(true); setFeeItemId(""); + setPricingMode("hourly"); + setCustomAmount(""); }; const dotClass = isRunning From 833ef700282ce9c48834de621b18fb4e5b930994 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Mon, 11 May 2026 20:41:50 +0000 Subject: [PATCH 3/4] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routeTree.gen.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/routeTree.gen.ts b/src/routeTree.gen.ts index 92d70af..908955b 100644 --- a/src/routeTree.gen.ts +++ b/src/routeTree.gen.ts @@ -1335,12 +1335,3 @@ const rootRouteChildren: RootRouteChildren = { export const routeTree = rootRouteImport ._addFileChildren(rootRouteChildren) ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} From 5e80ae585bb53b1006050589c15f9ea99a21d858 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Mon, 11 May 2026 20:42:03 +0000 Subject: [PATCH 4/4] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/timer/header-timer.tsx | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/components/timer/header-timer.tsx b/src/components/timer/header-timer.tsx index 506d2b1..be21767 100644 --- a/src/components/timer/header-timer.tsx +++ b/src/components/timer/header-timer.tsx @@ -296,6 +296,44 @@ export function HeaderTimer() { )} +
+ +
+ v && setPricingMode(v as "hourly" | "flat")} + className="justify-start" + > + + Per hour + + + Flat fee + + +
+ + $ + + setCustomAmount(e.target.value)} + className="h-8 pl-5 text-sm" + /> +
+
+
+