1
- import { Button } from "@quassel/ui" ;
1
+ import { Button , Stack , Table } from "@quassel/ui" ;
2
2
import { createFileRoute , useNavigate } from "@tanstack/react-router" ;
3
- import { i18n } from "../../../../stores/i18n" ;
3
+ import { format , i18n } from "../../../../stores/i18n" ;
4
4
import { useStore } from "@nanostores/react" ;
5
+ import { $questionnaire } from "../../../../stores/questionnaire" ;
5
6
6
7
export const messages = i18n ( "questionnaireParticipant" , {
7
8
title : "Participant" ,
9
+ participantLabel : "Child" ,
10
+ studyLabel : "Study" ,
11
+ birthdateMissing : "Birthdate missing" ,
8
12
formAction : "Continue" ,
9
13
} ) ;
10
14
11
15
function QuestionnaireParticipant ( ) {
12
16
const n = useNavigate ( ) ;
17
+
13
18
const t = useStore ( messages ) ;
19
+ const { time } = useStore ( format ) ;
20
+
21
+ const questionnaire = useStore ( $questionnaire ) ;
22
+ const birthday = questionnaire ?. participant . birthday ;
14
23
15
24
const handleSubmit = ( ) => {
16
25
n ( { to : "/questionnaire/new" } ) ;
@@ -19,9 +28,23 @@ function QuestionnaireParticipant() {
19
28
return (
20
29
< >
21
30
< h3 > { t . title } </ h3 >
22
- < form onSubmit = { handleSubmit } >
23
- < Button type = "submit" > { t . formAction } </ Button >
24
- </ form >
31
+ < Stack >
32
+ < Table >
33
+ < Table . Tr >
34
+ < Table . Th > { t . participantLabel } </ Table . Th >
35
+ < Table . Td > { questionnaire ?. participant . id } </ Table . Td >
36
+ < Table . Td > { birthday ? time ( new Date ( birthday ) ) : < i > { t . birthdateMissing } </ i > } </ Table . Td >
37
+ </ Table . Tr >
38
+ < Table . Tr >
39
+ < Table . Th > { t . studyLabel } </ Table . Th >
40
+ < Table . Td > { questionnaire ?. study . id } </ Table . Td >
41
+ < Table . Td > { questionnaire ?. study . title } </ Table . Td >
42
+ </ Table . Tr >
43
+ </ Table >
44
+ < form onSubmit = { handleSubmit } >
45
+ < Button type = "submit" > { t . formAction } </ Button >
46
+ </ form >
47
+ </ Stack >
25
48
</ >
26
49
) ;
27
50
}
0 commit comments