Skip to content

Commit e61a80e

Browse files
committed
feat(frontend): display participant informations
1 parent 6dec088 commit e61a80e

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

apps/frontend/src/routes/_auth/questionnaire/_questionnaire/participant.tsx

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
1-
import { Button } from "@quassel/ui";
1+
import { Button, Stack, Table } from "@quassel/ui";
22
import { createFileRoute, useNavigate } from "@tanstack/react-router";
3-
import { i18n } from "../../../../stores/i18n";
3+
import { format, i18n } from "../../../../stores/i18n";
44
import { useStore } from "@nanostores/react";
5+
import { $questionnaire } from "../../../../stores/questionnaire";
56

67
export const messages = i18n("questionnaireParticipant", {
78
title: "Participant",
9+
participantLabel: "Child",
10+
studyLabel: "Study",
11+
birthdateMissing: "Birthdate missing",
812
formAction: "Continue",
913
});
1014

1115
function QuestionnaireParticipant() {
1216
const n = useNavigate();
17+
1318
const t = useStore(messages);
19+
const { time } = useStore(format);
20+
21+
const questionnaire = useStore($questionnaire);
22+
const birthday = questionnaire?.participant.birthday;
1423

1524
const handleSubmit = () => {
1625
n({ to: "/questionnaire/new" });
@@ -19,9 +28,23 @@ function QuestionnaireParticipant() {
1928
return (
2029
<>
2130
<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>
2548
</>
2649
);
2750
}

0 commit comments

Comments
 (0)