1- import { Form , Heading } from '@douglasneuroinformatics/libui/components' ;
1+ import { Button , Dialog , Form , Heading } from '@douglasneuroinformatics/libui/components' ;
2+ import { useTranslation } from '@douglasneuroinformatics/libui/hooks' ;
23import type { AnyUnilingualFormInstrument , FormInstrument } from '@opendatacapture/runtime-core' ;
4+ import { InfoIcon } from 'lucide-react' ;
35import type { Promisable } from 'type-fest' ;
46
57export type FormContentProps = {
@@ -8,9 +10,33 @@ export type FormContentProps = {
810} ;
911
1012export const FormContent = ( { instrument, onSubmit } : FormContentProps ) => {
13+ const { t } = useTranslation ( ) ;
14+ const instructions = instrument . clientDetails ?. instructions ?? instrument . details . instructions ;
1115 return (
1216 < div className = "space-y-6" >
13- < Heading variant = "h4" > { instrument . details . title } </ Heading >
17+ < div className = "flex gap-2" >
18+ < Heading variant = "h4" > { instrument . clientDetails ?. title ?? instrument . details . title } </ Heading >
19+ < Dialog >
20+ < Dialog . Trigger asChild >
21+ < Button disabled = { ! instructions ?. length } size = "icon" variant = "ghost" >
22+ < InfoIcon />
23+ </ Button >
24+ </ Dialog . Trigger >
25+ < Dialog . Content className = "sm:max-w-[425px]" >
26+ < Dialog . Header >
27+ < Dialog . Title >
28+ { t ( {
29+ en : 'Instructions' ,
30+ fr : 'Instructions'
31+ } ) }
32+ </ Dialog . Title >
33+ </ Dialog . Header >
34+ < Dialog . Body className = "py-2" >
35+ < p className = "text-muted-foreground text-sm" > { instructions ?. join ( ', ' ) } </ p >
36+ </ Dialog . Body >
37+ </ Dialog . Content >
38+ </ Dialog >
39+ </ div >
1440 < Form
1541 preventResetValuesOnReset
1642 content = { instrument . content }
0 commit comments