diff --git a/frontend/components/analysis/AnalysisForm.tsx b/frontend/components/analysis/AnalysisForm.tsx index 6adae5f0..d4643adf 100644 --- a/frontend/components/analysis/AnalysisForm.tsx +++ b/frontend/components/analysis/AnalysisForm.tsx @@ -8,6 +8,9 @@ import { useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; import * as z from "zod"; import { format } from "date-fns"; +import { CheckIcon } from "lucide-react"; + +import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; import { DatePicker } from "@/components/ui/date-picker"; @@ -154,34 +157,44 @@ export function AnalysisForm({ onSubmit, loading = false }: AnalysisFormProps) { render={({ field }) => (
- {ANALYSTS.map((analyst) => ( - - - { - return checked - ? field.onChange([ - ...(field.value ?? []), - analyst.value, - ]) - : field.onChange( - field.value?.filter( - (value: string) => - value !== analyst.value - ) - ); - }} - /> - - - {analyst.label} - - - ))} + {ANALYSTS.map((analyst) => { + const isSelected = field.value?.includes(analyst.value); + return ( + + +
{ + const newValue = isSelected + ? field.value?.filter((v: string) => v !== analyst.value) + : [...(field.value ?? []), analyst.value]; + field.onChange(newValue); + }} + className={cn( + "relative flex cursor-pointer flex-row items-center gap-3 rounded-lg border-2 p-4 transition-all hover:bg-accent", + isSelected + ? "border-primary bg-primary/5 text-primary" + : "border-muted-foreground/25 bg-card text-muted-foreground" + )} + > +
+ {isSelected && } +
+ {analyst.label} +
+
+
+ ); + })}
diff --git a/frontend/package.json b/frontend/package.json index 4cfffa2b..173e9129 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -28,7 +28,7 @@ "react": "19.2.0", "react-day-picker": "^9.11.3", "react-dom": "19.2.0", - "react-hook-form": "^7.66.1", + "react-hook-form": "^7.67.0", "react-markdown": "^10.1.0", "recharts": "^3.4.1", "rehype-raw": "^7.0.0", diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index dc641d5e..f537cc4c 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -10,7 +10,7 @@ importers: dependencies: '@hookform/resolvers': specifier: ^5.2.2 - version: 5.2.2(react-hook-form@7.66.1(react@19.2.0)) + version: 5.2.2(react-hook-form@7.67.0(react@19.2.0)) '@radix-ui/react-checkbox': specifier: ^1.3.3 version: 1.3.3(@types/react-dom@19.2.3(@types/react@19.2.6))(@types/react@19.2.6)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) @@ -66,8 +66,8 @@ importers: specifier: 19.2.0 version: 19.2.0(react@19.2.0) react-hook-form: - specifier: ^7.66.1 - version: 7.66.1(react@19.2.0) + specifier: ^7.67.0 + version: 7.67.0(react@19.2.0) react-markdown: specifier: ^10.1.0 version: 10.1.0(@types/react@19.2.6)(react@19.2.0) @@ -2567,8 +2567,8 @@ packages: peerDependencies: react: ^19.2.0 - react-hook-form@7.66.1: - resolution: {integrity: sha512-2KnjpgG2Rhbi+CIiIBQQ9Df6sMGH5ExNyFl4Hw9qO7pIqMBR8Bvu9RQyjl3JM4vehzCh9soiNUM/xYMswb2EiA==} + react-hook-form@7.67.0: + resolution: {integrity: sha512-E55EOwKJHHIT/I6J9DmQbCWToAYSw9nN5R57MZw9rMtjh+YQreMDxRLfdjfxQbiJ3/qbg3Z02wGzBX4M+5fMtQ==} engines: {node: '>=18.0.0'} peerDependencies: react: ^16.8.0 || ^17 || ^18 || ^19 @@ -3212,10 +3212,10 @@ snapshots: '@floating-ui/utils@0.2.10': {} - '@hookform/resolvers@5.2.2(react-hook-form@7.66.1(react@19.2.0))': + '@hookform/resolvers@5.2.2(react-hook-form@7.67.0(react@19.2.0))': dependencies: '@standard-schema/utils': 0.3.0 - react-hook-form: 7.66.1(react@19.2.0) + react-hook-form: 7.67.0(react@19.2.0) '@humanfs/core@0.19.1': {} @@ -5819,7 +5819,7 @@ snapshots: react: 19.2.0 scheduler: 0.27.0 - react-hook-form@7.66.1(react@19.2.0): + react-hook-form@7.67.0(react@19.2.0): dependencies: react: 19.2.0