File tree Expand file tree Collapse file tree 7 files changed +83
-18
lines changed
apps/frontend/src/routes/_auth/questionnaire Expand file tree Collapse file tree 7 files changed +83
-18
lines changed Original file line number Diff line number Diff line change 1
1
import { Button , Group } from "@quassel/ui" ;
2
2
import { createFileRoute , Link , useNavigate } from "@tanstack/react-router" ;
3
+ import { i18n } from "../../../../stores/i18n" ;
4
+ import { useStore } from "@nanostores/react" ;
5
+
6
+ export const messages = i18n ( "questionnaireEntries" , {
7
+ formAction : "Continue" ,
8
+ backAction : "Back" ,
9
+ } ) ;
3
10
4
11
function QuestionnaireEntries ( ) {
5
12
const n = useNavigate ( ) ;
6
13
const p = Route . useParams ( ) ;
7
14
15
+ const t = useStore ( messages ) ;
16
+
8
17
const handleSubmit = ( ) => {
9
18
n ( { to : "/questionnaire/$id/remarks" , params : p } ) ;
10
19
} ;
@@ -13,9 +22,9 @@ function QuestionnaireEntries() {
13
22
< form onSubmit = { handleSubmit } >
14
23
< Group >
15
24
< Link to = "/questionnaire/$id/period" params = { p } >
16
- < Button variant = "light" > Back </ Button >
25
+ < Button variant = "light" > { t . backAction } </ Button >
17
26
</ Link >
18
- < Button type = "submit" > Continue </ Button >
27
+ < Button type = "submit" > { t . formAction } </ Button >
19
28
</ Group >
20
29
</ form >
21
30
) ;
Original file line number Diff line number Diff line change 1
1
import { Button , Group } from "@quassel/ui" ;
2
2
import { createFileRoute , Link , useNavigate } from "@tanstack/react-router" ;
3
+ import { i18n } from "../../../../../stores/i18n" ;
4
+ import { useStore } from "@nanostores/react" ;
5
+
6
+ export const messages = i18n ( "questionnaireOverview" , {
7
+ title : "Thanks for submitting the questionnaire!" ,
8
+ newPeriodAction : "Continue with new period" ,
9
+ closeAction : "Close" ,
10
+ } ) ;
3
11
4
12
function QuestionnaireOverview ( ) {
5
13
const n = useNavigate ( ) ;
14
+ const t = useStore ( messages ) ;
6
15
7
16
const handleClose = ( ) => {
8
17
// TODO handle closing quesitonnaire ("logout")
@@ -12,12 +21,12 @@ function QuestionnaireOverview() {
12
21
13
22
return (
14
23
< >
15
- < h3 > Thanks for submitting the questionnaire! </ h3 >
24
+ < h3 > { t . title } </ h3 >
16
25
< Group >
17
26
< Link to = "/questionnaire/new" >
18
- < Button variant = "outline" > Continue with new period </ Button >
27
+ < Button variant = "outline" > { t . newPeriodAction } </ Button >
19
28
</ Link >
20
- < Button onClick = { handleClose } > Close </ Button >
29
+ < Button onClick = { handleClose } > { t . closeAction } </ Button >
21
30
</ Group >
22
31
</ >
23
32
) ;
Original file line number Diff line number Diff line change 1
1
import { Button } from "@quassel/ui" ;
2
2
import { createFileRoute , useNavigate } from "@tanstack/react-router" ;
3
+ import { i18n } from "../../../../../stores/i18n" ;
4
+ import { useStore } from "@nanostores/react" ;
5
+
6
+ export const messages = i18n ( "questionnairePeriod" , {
7
+ title : "Period" ,
8
+ formAction : "Continue" ,
9
+ } ) ;
3
10
4
11
function QuestionnairePeriod ( ) {
5
12
const n = useNavigate ( ) ;
6
13
const p = Route . useParams ( ) ;
7
14
15
+ const t = useStore ( messages ) ;
16
+
8
17
const handleSubmit = ( ) => {
9
18
n ( { to : "/questionnaire/$id/entries" , params : p } ) ;
10
19
} ;
11
20
12
21
return (
13
22
< >
14
- < h3 > Period </ h3 >
23
+ < h3 > { t . title } </ h3 >
15
24
< form onSubmit = { handleSubmit } >
16
- < Button type = "submit" > Continue </ Button >
25
+ < Button type = "submit" > { t . formAction } </ Button >
17
26
</ form >
18
27
</ >
19
28
) ;
Original file line number Diff line number Diff line change 1
1
import { Button , Group } from "@quassel/ui" ;
2
2
import { createFileRoute , Link , useNavigate } from "@tanstack/react-router" ;
3
+ import { i18n } from "../../../../../stores/i18n" ;
4
+ import { useStore } from "@nanostores/react" ;
5
+
6
+ export const messages = i18n ( "questionnaireRemarks" , {
7
+ title : "Add remarks" ,
8
+ backAction : "Back" ,
9
+ saveAction : "Save" ,
10
+ formAction : "Save and complete" ,
11
+ } ) ;
3
12
4
13
function QuestionnaireRemarks ( ) {
5
14
const n = useNavigate ( ) ;
6
15
const p = Route . useParams ( ) ;
7
16
17
+ const t = useStore ( messages ) ;
18
+
8
19
const handleSubmit = ( ) => {
9
20
n ( { to : "/questionnaire/$id/overview" , params : p } ) ;
10
21
} ;
11
22
12
23
return (
13
24
< form onSubmit = { handleSubmit } >
14
- < h3 > Add remarks </ h3 >
25
+ < h3 > { t . title } </ h3 >
15
26
< Group >
16
27
< Link to = "/questionnaire/$id/entries" params = { p } >
17
- < Button variant = "light" > Back </ Button >
28
+ < Button variant = "light" > { t . backAction } </ Button >
18
29
</ Link >
19
- < Button variant = "outline" > Save </ Button >
20
- < Button type = "submit" > Save and Complete </ Button >
30
+ < Button variant = "outline" > { t . saveAction } </ Button >
31
+ < Button type = "submit" > { t . formAction } </ Button >
21
32
</ Group >
22
33
</ form >
23
34
) ;
Original file line number Diff line number Diff line change 1
1
import { Button , Stack , TextInput } from "@quassel/ui" ;
2
2
import { createFileRoute , useNavigate } from "@tanstack/react-router" ;
3
+ import { i18n } from "../../../../stores/i18n" ;
4
+ import { useStore } from "@nanostores/react" ;
5
+
6
+ export const messages = i18n ( "questionnaire" , {
7
+ title : "Start new questionnaire" ,
8
+ formAction : "Continue" ,
9
+ } ) ;
3
10
4
11
function Questionnaire ( ) {
5
12
const n = useNavigate ( ) ;
13
+ const t = useStore ( messages ) ;
6
14
7
15
const handleSubmit = ( ) => {
8
16
n ( { to : "/questionnaire/participant" } ) ;
9
17
} ;
10
18
11
19
return (
12
20
< >
13
- < h3 > Questionnaire </ h3 >
21
+ < h3 > { t . title } </ h3 >
14
22
< form onSubmit = { handleSubmit } >
15
23
< Stack >
16
24
< TextInput />
17
25
< TextInput />
18
- < Button type = "submit" > Start questionnaire </ Button >
26
+ < Button type = "submit" > { t . formAction } </ Button >
19
27
</ Stack >
20
28
</ form >
21
29
</ >
Original file line number Diff line number Diff line change 1
1
import { Button } from "@quassel/ui" ;
2
2
import { createFileRoute , useNavigate } from "@tanstack/react-router" ;
3
+ import { i18n } from "../../../../stores/i18n" ;
4
+ import { useStore } from "@nanostores/react" ;
5
+
6
+ export const messages = i18n ( "questionnaireNew" , {
7
+ title : "Create new period of life" ,
8
+ formAction : "Create" ,
9
+ } ) ;
3
10
4
11
function QuestionnaireNew ( ) {
5
12
const n = useNavigate ( ) ;
13
+ const t = useStore ( messages ) ;
6
14
7
15
const handleSubmit = ( ) => {
8
16
// TODO create new questionnaire and receive ID
@@ -12,10 +20,10 @@ function QuestionnaireNew() {
12
20
13
21
return (
14
22
< >
15
- < h3 > Period </ h3 >
23
+ < h3 > { t . title } </ h3 >
16
24
< form onSubmit = { handleSubmit } >
17
25
{ /* TODO period form */ }
18
- < Button type = "submit" > Create </ Button >
26
+ < Button type = "submit" > { t . formAction } </ Button >
19
27
</ form >
20
28
</ >
21
29
) ;
Original file line number Diff line number Diff line change 1
1
import { Button } from "@quassel/ui" ;
2
2
import { createFileRoute , useNavigate } from "@tanstack/react-router" ;
3
+ import { i18n } from "../../../../stores/i18n" ;
4
+ import { useStore } from "@nanostores/react" ;
5
+
6
+ export const messages = i18n ( "questionnaireParticipant" , {
7
+ title : "Participant" ,
8
+ formAction : "Continue" ,
9
+ } ) ;
3
10
4
11
function QuestionnaireParticipant ( ) {
5
12
const n = useNavigate ( ) ;
13
+ const t = useStore ( messages ) ;
6
14
7
15
const handleSubmit = ( ) => {
8
16
n ( { to : "/questionnaire/new" } ) ;
9
17
} ;
10
18
11
19
return (
12
- < form onSubmit = { handleSubmit } >
13
- < Button type = "submit" > New questionnaire</ Button >
14
- </ form >
20
+ < >
21
+ < h3 > { t . title } </ h3 >
22
+ < form onSubmit = { handleSubmit } >
23
+ < Button type = "submit" > { t . formAction } </ Button >
24
+ </ form >
25
+ </ >
15
26
) ;
16
27
}
17
28
You can’t perform that action at this time.
0 commit comments