This commit is contained in:
parent
0c955d4057
commit
4f2327f5c2
|
|
@ -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 }) => (
|
||||
<FormItem>
|
||||
<div className="grid grid-cols-2 md:grid-cols-4 gap-4">
|
||||
{ANALYSTS.map((analyst) => (
|
||||
<FormItem
|
||||
key={analyst.value}
|
||||
className="flex flex-row items-center space-x-3 space-y-0"
|
||||
>
|
||||
<FormControl>
|
||||
<Checkbox
|
||||
checked={field.value?.includes(analyst.value)}
|
||||
onCheckedChange={(checked) => {
|
||||
return checked
|
||||
? field.onChange([
|
||||
...(field.value ?? []),
|
||||
analyst.value,
|
||||
])
|
||||
: field.onChange(
|
||||
field.value?.filter(
|
||||
(value: string) =>
|
||||
value !== analyst.value
|
||||
)
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormLabel className="font-normal cursor-pointer leading-none">
|
||||
{analyst.label}
|
||||
</FormLabel>
|
||||
</FormItem>
|
||||
))}
|
||||
{ANALYSTS.map((analyst) => {
|
||||
const isSelected = field.value?.includes(analyst.value);
|
||||
return (
|
||||
<FormItem
|
||||
key={analyst.value}
|
||||
className="space-y-0"
|
||||
>
|
||||
<FormControl>
|
||||
<div
|
||||
onClick={() => {
|
||||
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"
|
||||
)}
|
||||
>
|
||||
<div
|
||||
className={cn(
|
||||
"flex h-5 w-5 shrink-0 items-center justify-center rounded-sm border transition-colors",
|
||||
isSelected
|
||||
? "border-primary bg-primary text-primary-foreground"
|
||||
: "border-muted-foreground"
|
||||
)}
|
||||
>
|
||||
{isSelected && <CheckIcon className="h-3.5 w-3.5" />}
|
||||
</div>
|
||||
<span className="font-medium select-none">{analyst.label}</span>
|
||||
</div>
|
||||
</FormControl>
|
||||
</FormItem>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue