diff --git a/apps/Frontend/src/components/claims/claim-form.tsx b/apps/Frontend/src/components/claims/claim-form.tsx index 2ca5049..08e59f5 100644 --- a/apps/Frontend/src/components/claims/claim-form.tsx +++ b/apps/Frontend/src/components/claims/claim-form.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect } from "react"; +import { useState, useEffect, useRef } from "react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { @@ -39,7 +39,6 @@ import { } from "@repo/db/types"; import { Decimal } from "decimal.js"; import { - COMBO_BUTTONS, mapPricesForForm, applyComboToForm, getDescriptionForCode, @@ -257,6 +256,16 @@ export function ClaimForm({ setForm({ ...form, serviceLines: updatedLines }); }; + // for serviceLine rows, to auto scroll when it got updated by combo buttons and all. + const rowRefs = useRef<(HTMLDivElement | null)[]>([]); + + const scrollToLine = (index: number) => { + const el = rowRefs.current[index]; + if (el) { + el.scrollIntoView({ behavior: "smooth", block: "start" }); + } + }; + // Map Price function const onMapPrice = () => { setForm((prev) => @@ -573,7 +582,11 @@ export function ClaimForm({ return (