diff --git a/web-citizen-reporting/web-citizen-reporting-template/src/components/ReportAnswersStep.tsx b/web-citizen-reporting/web-citizen-reporting-template/src/components/ReportAnswersStep.tsx index 42c618a32..adca0797f 100644 --- a/web-citizen-reporting/web-citizen-reporting-template/src/components/ReportAnswersStep.tsx +++ b/web-citizen-reporting/web-citizen-reporting-template/src/components/ReportAnswersStep.tsx @@ -46,8 +46,16 @@ import { useSuspenseQuery } from "@tanstack/react-query"; import { notFound } from "@tanstack/react-router"; import { format } from "date-fns"; import { CalendarIcon } from "lucide-react"; -import React, { useCallback, useEffect } from "react"; +import React, { useCallback, useEffect, useState } from "react"; import { useFormContext } from "react-hook-form"; +import { + Select, + SelectContent, + SelectGroup, + SelectItem, + SelectTrigger, + SelectValue, +} from "./ui/select"; function QuestionText({ languageCode, @@ -95,6 +103,10 @@ function ReportAnswersStep() { const formValues = form.watch(); + const [selectedLanguage, setSelectedLanguage] = useState( + citizenReportForm.defaultLanguage + ); + useEffect(() => { citizenReportForm.questions.forEach((question) => { if (isMultiSelectQuestion(question)) { @@ -146,11 +158,33 @@ function ReportAnswersStep() { return ( - - {citizenReportForm.name[citizenReportForm.defaultLanguage]} + +
{citizenReportForm.name[selectedLanguage]}
+ +
+
Language:
+ +
- {citizenReportForm.description[citizenReportForm.defaultLanguage]} + {citizenReportForm.description[selectedLanguage]}
@@ -166,11 +200,11 @@ function ReportAnswersStep() { @@ -198,11 +232,11 @@ function ReportAnswersStep() { @@ -284,11 +318,11 @@ function ReportAnswersStep() { - {option.text[citizenReportForm.defaultLanguage]} + {option.text[selectedLanguage]} ))} @@ -353,11 +387,11 @@ function ReportAnswersStep() {
{question.options.map((option) => ( diff --git a/web-citizen-reporting/web-citizen-reporting-template/src/queries/use-locations.tsx b/web-citizen-reporting/web-citizen-reporting-template/src/queries/use-locations.tsx index 5773a3380..ce4b6edc3 100644 --- a/web-citizen-reporting/web-citizen-reporting-template/src/queries/use-locations.tsx +++ b/web-citizen-reporting/web-citizen-reporting-template/src/queries/use-locations.tsx @@ -1,4 +1,3 @@ -import { getForms } from "@/api/get-forms"; import { getLocations } from "@/api/get-locations"; import { queryOptions, useQuery } from "@tanstack/react-query";