{children}
+} diff --git a/src/participation-frm7/components/core/buttons/ParticipationButton.tsx b/src/participation-frm7/components/core/buttons/ParticipationButton.tsx new file mode 100644 index 000000000..6f740369e --- /dev/null +++ b/src/participation-frm7/components/core/buttons/ParticipationButton.tsx @@ -0,0 +1,28 @@ +import clsx from "clsx" +import { ReactNode } from "react" +import { participationBlueButtonStyles, participationWhiteButtonStyles } from "../links/styles" +export { FORM_ERROR } from "src/core/components/forms" + +type Props = { + color?: string + disabled?: boolean + children: string | ReactNode +} & React.ButtonHTMLAttributes{help}
} + +{help}
} + +Max. 2000 Zeichen
+stage: {stage}
+
+ {JSON.stringify(responses, null, 2)}
+
+ email: {emailState}
+ {description}
+ )} +
+ {JSON.stringify(props, null, 2)}
+
+
+ {JSON.stringify(values, null, 2)}
+
+ {children}
-} diff --git a/src/participation-frm7/components/core/buttons/ParticipationButton.tsx b/src/participation-frm7/components/core/buttons/ParticipationButton.tsx deleted file mode 100644 index 6f740369e..000000000 --- a/src/participation-frm7/components/core/buttons/ParticipationButton.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import clsx from "clsx" -import { ReactNode } from "react" -import { participationBlueButtonStyles, participationWhiteButtonStyles } from "../links/styles" -export { FORM_ERROR } from "src/core/components/forms" - -type Props = { - color?: string - disabled?: boolean - children: string | ReactNode -} & React.ButtonHTMLAttributes{help}
} - -{help}
} - -Max. 2000 Zeichen
-{description}
- )} -
diff --git a/src/participation-frm7/components/frm7.tsx b/src/participation-frm7/components/frm7.tsx
index 9361a6934..6845f9649 100644
--- a/src/participation-frm7/components/frm7.tsx
+++ b/src/participation-frm7/components/frm7.tsx
@@ -66,7 +66,7 @@ const ParticipationFrm7MainPage: BlitzPage = () => {
const surveySessionId_ = await getOrCreateSurveySessionId()
await createSurveyResponseMutation({
surveySessionId: surveySessionId_,
- surveyId: surveyDefinition.id,
+ surveyPart: surveyDefinition.id,
data: JSON.stringify(surveyResponses),
})
})()
@@ -90,7 +90,7 @@ const ParticipationFrm7MainPage: BlitzPage = () => {
const surveySessionId_ = await getOrCreateSurveySessionId()
await createSurveyResponseMutation({
surveySessionId: surveySessionId_,
- surveyId: feedbackDefinition.id,
+ surveyPart: feedbackDefinition.id,
data: JSON.stringify(feedbackResponses),
})
})()
diff --git a/src/participation/components/rs8.tsx b/src/participation/components/rs8.tsx
index 0377113d0..51106b045 100644
--- a/src/participation/components/rs8.tsx
+++ b/src/participation/components/rs8.tsx
@@ -46,7 +46,7 @@ const ParticipationMainPage: BlitzPage = () => {
if (surveySessionId) {
return surveySessionId
} else {
- const surveySession = await createSurveySessionMutation({ surveyId: 1 })
+ const surveySession = await createSurveySessionMutation({ surveyId: surveyDefinition.id })
setSurveySessionId(surveySession.id)
return surveySession.id
}
@@ -60,7 +60,7 @@ const ParticipationMainPage: BlitzPage = () => {
const surveySessionId_ = await getOrCreateSurveySessionId()
await createSurveyResponseMutation({
surveySessionId: surveySessionId_,
- surveyId: surveyDefinition.id,
+ surveyPart: surveyDefinition.id,
data: JSON.stringify(surveyResponses),
})
})()
@@ -84,7 +84,7 @@ const ParticipationMainPage: BlitzPage = () => {
const surveySessionId_ = await getOrCreateSurveySessionId()
await createSurveyResponseMutation({
surveySessionId: surveySessionId_,
- surveyId: feedbackDefinition.id,
+ surveyPart: feedbackDefinition.id,
data: JSON.stringify(feedbackResponses),
})
})()
diff --git a/src/survey-response-topics-on-survey-responses/queries/getSurveyResponseTopicsOnSurveyResponsesBySurveyResponse.ts b/src/survey-response-topics-on-survey-responses/queries/getSurveyResponseTopicsOnSurveyResponsesBySurveyResponse.ts
index 3e2082ac2..44472b738 100644
--- a/src/survey-response-topics-on-survey-responses/queries/getSurveyResponseTopicsOnSurveyResponsesBySurveyResponse.ts
+++ b/src/survey-response-topics-on-survey-responses/queries/getSurveyResponseTopicsOnSurveyResponsesBySurveyResponse.ts
@@ -1,7 +1,6 @@
import { resolver } from "@blitzjs/rpc"
import { paginate } from "blitz"
import db, { Prisma } from "db"
-import { SurveyResponse } from "src/pages/[projectSlug]/surveys/[surveyId]/responses"
type GetSurveyResponseTopicsOnSurveyResponsesInput = { surveyResponseId: number } & Pick<
Prisma.SurveyResponseTopicsOnSurveyResponsesFindManyArgs,
diff --git a/src/survey-responses/mutations/createSurveyResponse.ts b/src/survey-responses/mutations/createSurveyResponse.ts
index 5d3b75e90..566105bca 100644
--- a/src/survey-responses/mutations/createSurveyResponse.ts
+++ b/src/survey-responses/mutations/createSurveyResponse.ts
@@ -4,7 +4,7 @@ import { z } from "zod"
const CreateSurveyResponse = z.object({
surveySessionId: z.number(),
- surveyId: z.number(),
+ surveyPart: z.number(),
data: z.string(),
})
diff --git a/src/survey-responses/mutations/updateSurveyResponse.ts b/src/survey-responses/mutations/updateSurveyResponse.ts
index 1b1367477..de4c0485c 100644
--- a/src/survey-responses/mutations/updateSurveyResponse.ts
+++ b/src/survey-responses/mutations/updateSurveyResponse.ts
@@ -14,7 +14,7 @@ const UpdateSurveyResponseSchema = SurveyResponseSchema.merge(
// We do not want to update this data, it should stay as is
data: true,
surveySessionId: true,
- surveyId: true,
+ surveyPart: true,
})
export default resolver.pipe(
diff --git a/src/survey-responses/queries/getFeedbackSurveyResponses.ts b/src/survey-responses/queries/getFeedbackSurveyResponses.ts
index c24ec2494..cc1cab3dd 100644
--- a/src/survey-responses/queries/getFeedbackSurveyResponses.ts
+++ b/src/survey-responses/queries/getFeedbackSurveyResponses.ts
@@ -21,7 +21,7 @@ export default resolver.pipe(
// Reminder: `response.surveyId` is NOT a relation field
// the field here just represents first or second part of the survey json
// surveyId `2` is src/participation/data/feedback.json
- surveyId: 2,
+ surveyPart: 2,
},
orderBy: { id: "desc" },
include: {
diff --git a/src/survey-responses/queries/getGroupedSurveyResponses.ts b/src/survey-responses/queries/getGroupedSurveyResponses.ts
index 67ab110c8..1ca3716ff 100644
--- a/src/survey-responses/queries/getGroupedSurveyResponses.ts
+++ b/src/survey-responses/queries/getGroupedSurveyResponses.ts
@@ -49,14 +49,14 @@ export default resolver.pipe(
const surveyResponsesFirstPart = surveySessions
.map((session) => session.responses)
.flat()
- .filter((response) => response.surveyId === 1)
+ .filter((response) => response.surveyPart === 1)
.sort((a, b) => b.id - a.id)
// src/participation/data/feedback.json
const surveyResponsesFeedbackPart = surveySessions
.map((session) => session.responses)
.flat()
- .filter((response) => response.surveyId === 2)
+ .filter((response) => response.surveyPart === 2)
// We need to sort again; the frontend received different orders before…
.sort((a, b) => b.id - a.id)
diff --git a/src/survey-responses/schema.ts b/src/survey-responses/schema.ts
index 351a149a4..921f7bebb 100644
--- a/src/survey-responses/schema.ts
+++ b/src/survey-responses/schema.ts
@@ -5,7 +5,7 @@ export const SurveyResponseSchema = z.object({
data: z.string(),
status: z.nativeEnum(SurveyResponseStatusEnum),
surveySessionId: z.coerce.number(),
- surveyId: z.coerce.number(),
+ surveyPart: z.coerce.number(),
note: z.string().nullish(),
operatorId: z.coerce.number().nullish(),
})
From 44e88f1bf8f78629380dcf65627589370f72f7ef Mon Sep 17 00:00:00 2001
From: JohannaPeanut <76495099+JohannaPeanut@users.noreply.github.com>
Date: Mon, 27 Nov 2023 17:33:09 +0100
Subject: [PATCH 005/101] Survey: share core components, reorder files
---
src/participation-frm7/components/Done.tsx | 2 +-
src/participation-frm7/components/Email.tsx | 2 +-
src/participation-frm7/components/More.tsx | 2 +-
.../components/{survey => }/Survey.tsx | 7 +-
.../components/feedback/Feedback.tsx | 5 +-
.../components/feedback/FeedbackFirstPage.tsx | 4 +-
.../feedback/FeedbackSecondPage.tsx | 4 +-
.../components/frm7-inactive.tsx | 4 +-
src/participation-frm7/components/frm7.tsx | 11 ++-
.../survey/ParticipationSpinnerLayover.tsx | 33 --------
.../components/survey/Question.tsx | 83 -------------------
.../components/survey/SurveyButton.tsx | 42 ----------
.../utils/scrollToTopWithDelay.ts | 1 -
src/participation/components/Done.tsx | 2 +-
src/participation/components/Email.tsx | 4 +-
src/participation/components/More.tsx | 4 +-
.../components/{survey => }/Survey.tsx | 6 +-
.../components/core}/Page.tsx | 9 +-
.../ParticipationSpinnerLayover.tsx | 0
.../components/{survey => core}/Question.tsx | 8 +-
.../ParticipationButtonWithAction.tsx} | 8 +-
.../form/ParticipationLabeledCheckbox.tsx | 0
.../ParticipationLabeledCheckboxGroup.tsx | 0
.../form/ParticipationLabeledRadiobutton.tsx | 0
.../ParticipationLabeledRadiobuttonGroup.tsx | 0
.../form/ParticipationLabeledTextField.tsx | 0
.../ParticipationLabeledTextareaField.tsx | 0
.../components/{ => core}/form/SurveyForm.tsx | 0
.../layout/ContainerParticipation.tsx | 0
.../{ => core}/layout/FooterParticipation.tsx | 4 +-
.../{ => core}/layout/HeaderParticipation.tsx | 4 +-
.../{ => core}/layout/LayoutParticipation.tsx | 0
.../{ => core}/layout/ProgressBar.tsx | 0
.../layout/ScreenHeaderParticipation.tsx | 2 +-
.../components/feedback/Feedback.tsx | 2 +-
.../components/feedback/FeedbackFirstPage.tsx | 4 +-
.../feedback/FeedbackSecondPage.tsx | 4 +-
src/participation/components/rs8-inactive.tsx | 4 +-
src/participation/components/rs8.tsx | 8 +-
src/participation/components/survey/Page.tsx | 44 ----------
40 files changed, 59 insertions(+), 258 deletions(-)
rename src/participation-frm7/components/{survey => }/Survey.tsx (93%)
delete mode 100644 src/participation-frm7/components/survey/ParticipationSpinnerLayover.tsx
delete mode 100644 src/participation-frm7/components/survey/Question.tsx
delete mode 100644 src/participation-frm7/components/survey/SurveyButton.tsx
delete mode 100644 src/participation-frm7/utils/scrollToTopWithDelay.ts
rename src/participation/components/{survey => }/Survey.tsx (96%)
rename src/{participation-frm7/components/survey => participation/components/core}/Page.tsx (82%)
rename src/participation/components/{survey => core}/ParticipationSpinnerLayover.tsx (100%)
rename src/participation/components/{survey => core}/Question.tsx (85%)
rename src/participation/components/{survey/SurveyButton.tsx => core/buttons/ParticipationButtonWithAction.tsx} (83%)
rename src/participation/components/{ => core}/form/ParticipationLabeledCheckbox.tsx (100%)
rename src/participation/components/{ => core}/form/ParticipationLabeledCheckboxGroup.tsx (100%)
rename src/participation/components/{ => core}/form/ParticipationLabeledRadiobutton.tsx (100%)
rename src/participation/components/{ => core}/form/ParticipationLabeledRadiobuttonGroup.tsx (100%)
rename src/participation/components/{ => core}/form/ParticipationLabeledTextField.tsx (100%)
rename src/participation/components/{ => core}/form/ParticipationLabeledTextareaField.tsx (100%)
rename src/participation/components/{ => core}/form/SurveyForm.tsx (100%)
rename src/participation/components/{ => core}/layout/ContainerParticipation.tsx (100%)
rename src/participation/components/{ => core}/layout/FooterParticipation.tsx (71%)
rename src/participation/components/{ => core}/layout/HeaderParticipation.tsx (87%)
rename src/participation/components/{ => core}/layout/LayoutParticipation.tsx (100%)
rename src/participation/components/{ => core}/layout/ProgressBar.tsx (100%)
rename src/participation/components/{ => core}/layout/ScreenHeaderParticipation.tsx (91%)
delete mode 100644 src/participation/components/survey/Page.tsx
diff --git a/src/participation-frm7/components/Done.tsx b/src/participation-frm7/components/Done.tsx
index cdf6d1c84..6c919e77c 100644
--- a/src/participation-frm7/components/Done.tsx
+++ b/src/participation-frm7/components/Done.tsx
@@ -1,7 +1,7 @@
export { FORM_ERROR } from "src/core/components/forms"
import { ParticipationLink } from "src/participation/components/core/links/ParticipationLink"
-import { ScreenHeaderParticipation } from "src/participation/components/layout/ScreenHeaderParticipation"
+import { ScreenHeaderParticipation } from "src/participation/components/core/layout/ScreenHeaderParticipation"
export const Done = () => {
return (
diff --git a/src/participation-frm7/components/Email.tsx b/src/participation-frm7/components/Email.tsx
index d51dc680d..96044e5d7 100644
--- a/src/participation-frm7/components/Email.tsx
+++ b/src/participation-frm7/components/Email.tsx
@@ -5,7 +5,7 @@ export { FORM_ERROR } from "src/core/components/forms"
import { ParticipationH2, ParticipationP } from "src/participation/components/core/Text"
import { ParticipationLink } from "src/participation/components/core/links/ParticipationLink"
-import { ScreenHeaderParticipation } from "src/participation/components/layout/ScreenHeaderParticipation"
+import { ScreenHeaderParticipation } from "src/participation/components/core/layout/ScreenHeaderParticipation"
type Props = {
onSubmit: any
diff --git a/src/participation-frm7/components/More.tsx b/src/participation-frm7/components/More.tsx
index 5315b32fe..3c568a97b 100644
--- a/src/participation-frm7/components/More.tsx
+++ b/src/participation-frm7/components/More.tsx
@@ -1,7 +1,7 @@
import { ParticipationH2 } from "src/participation/components/core/Text"
import { ParticipationButton } from "src/participation/components/core/buttons/ParticipationButton"
import { ParticipationButtonWrapper } from "src/participation/components/core/buttons/ParticipationButtonWrapper"
-import { ScreenHeaderParticipation } from "src/participation/components/layout/ScreenHeaderParticipation"
+import { ScreenHeaderParticipation } from "src/participation/components/core/layout/ScreenHeaderParticipation"
export { FORM_ERROR } from "src/core/components/forms"
diff --git a/src/participation-frm7/components/survey/Survey.tsx b/src/participation-frm7/components/Survey.tsx
similarity index 93%
rename from src/participation-frm7/components/survey/Survey.tsx
rename to src/participation-frm7/components/Survey.tsx
index 3027f4a38..6df70a11d 100644
--- a/src/participation-frm7/components/survey/Survey.tsx
+++ b/src/participation-frm7/components/Survey.tsx
@@ -6,11 +6,12 @@ import { stageProgressDefinition } from "src/participation-frm7/components/frm7"
import { Survey as TSurvey } from "src/participation-frm7/data/types"
-import { Page } from "src/participation-frm7/components/survey/Page"
import { ProgressContext } from "src/participation/context/contexts"
-import { scrollToTopWithDelay } from "src/participation-frm7/utils/scrollToTopWithDelay"
+
import { Debug } from "src/participation/components/core/Debug"
-import SurveyForm from "src/participation/components/form/SurveyForm"
+import SurveyForm from "src/participation/components/core/form/SurveyForm"
+import { Page } from "src/participation/components/core/Page"
+import { scrollToTopWithDelay } from "src/participation/utils/scrollToTopWithDelay"
type Props = { survey: TSurvey; onSubmit: ([]) => void }
diff --git a/src/participation-frm7/components/feedback/Feedback.tsx b/src/participation-frm7/components/feedback/Feedback.tsx
index a9fe7dccd..1337e5618 100644
--- a/src/participation-frm7/components/feedback/Feedback.tsx
+++ b/src/participation-frm7/components/feedback/Feedback.tsx
@@ -4,8 +4,9 @@ import { PinContext, ProgressContext } from "src/participation/context/contexts"
import { FeedbackFirstPage } from "src/participation-frm7/components/feedback/FeedbackFirstPage"
import { FeedbackSecondPage } from "src/participation-frm7/components/feedback/FeedbackSecondPage"
-import { scrollToTopWithDelay } from "src/participation-frm7/utils/scrollToTopWithDelay"
-import SurveyForm from "src/participation/components/form/SurveyForm"
+
+import SurveyForm from "src/participation/components/core/form/SurveyForm"
+import { scrollToTopWithDelay } from "src/participation/utils/scrollToTopWithDelay"
export { FORM_ERROR } from "src/core/components/forms"
diff --git a/src/participation-frm7/components/feedback/FeedbackFirstPage.tsx b/src/participation-frm7/components/feedback/FeedbackFirstPage.tsx
index 2beff62f6..5d707c7b0 100644
--- a/src/participation-frm7/components/feedback/FeedbackFirstPage.tsx
+++ b/src/participation-frm7/components/feedback/FeedbackFirstPage.tsx
@@ -1,10 +1,10 @@
import { MapProvider } from "react-map-gl/maplibre"
-import { Question } from "src/participation-frm7/components/survey/Question"
import { ParticipationButton } from "src/participation/components/core/buttons/ParticipationButton"
import { ParticipationButtonWrapper } from "src/participation/components/core/buttons/ParticipationButtonWrapper"
-import { ScreenHeaderParticipation } from "src/participation/components/layout/ScreenHeaderParticipation"
+import { ScreenHeaderParticipation } from "src/participation/components/core/layout/ScreenHeaderParticipation"
import { ParticipationMap } from "src/participation/components/maps/ParticipationMap"
+import { Question } from "src/participation/components/core/Question"
export { FORM_ERROR } from "src/core/components/forms"
diff --git a/src/participation-frm7/components/feedback/FeedbackSecondPage.tsx b/src/participation-frm7/components/feedback/FeedbackSecondPage.tsx
index 399ae6987..7cbbbf78b 100644
--- a/src/participation-frm7/components/feedback/FeedbackSecondPage.tsx
+++ b/src/participation-frm7/components/feedback/FeedbackSecondPage.tsx
@@ -2,7 +2,6 @@ import { useContext } from "react"
import { MultiLineString } from "@turf/helpers"
-import { Question } from "src/participation-frm7/components/survey/Question"
import {
ParticipationH2,
ParticipationH3,
@@ -11,8 +10,9 @@ import {
import { ParticipationButton } from "src/participation/components/core/buttons/ParticipationButton"
import { ParticipationButtonWrapper } from "src/participation/components/core/buttons/ParticipationButtonWrapper"
import { PinContext } from "src/participation/context/contexts"
-import { ScreenHeaderParticipation } from "src/participation/components/layout/ScreenHeaderParticipation"
+import { ScreenHeaderParticipation } from "src/participation/components/core/layout/ScreenHeaderParticipation"
import { ParticipationStaticMap } from "src/participation/components/maps/ParticipationStaticMap"
+import { Question } from "src/participation/components/core/Question"
export { FORM_ERROR } from "src/core/components/forms"
diff --git a/src/participation-frm7/components/frm7-inactive.tsx b/src/participation-frm7/components/frm7-inactive.tsx
index 1a509efc0..176e1f020 100644
--- a/src/participation-frm7/components/frm7-inactive.tsx
+++ b/src/participation-frm7/components/frm7-inactive.tsx
@@ -1,9 +1,9 @@
import { BlitzPage } from "@blitzjs/next"
-import { LayoutParticipation } from "src/participation/components/layout/LayoutParticipation"
+import { LayoutParticipation } from "src/participation/components/core/layout/LayoutParticipation"
import surveyDefinition from "src/participation-frm7/data/survey.json"
import { ParticipationLink } from "src/participation/components/core/links/ParticipationLink"
-import { ScreenHeaderParticipation } from "src/participation/components/layout/ScreenHeaderParticipation"
+import { ScreenHeaderParticipation } from "src/participation/components/core/layout/ScreenHeaderParticipation"
const ParticipationFrm7InactivePage: BlitzPage = () => {
return (
diff --git a/src/participation-frm7/components/frm7.tsx b/src/participation-frm7/components/frm7.tsx
index 6845f9649..d97d1d033 100644
--- a/src/participation-frm7/components/frm7.tsx
+++ b/src/participation-frm7/components/frm7.tsx
@@ -7,7 +7,7 @@ import { Email } from "src/participation-frm7/components/Email"
import { Feedback } from "src/participation-frm7/components/feedback/Feedback"
import { More } from "src/participation-frm7/components/More"
-import { Survey } from "src/participation-frm7/components/survey/Survey"
+import { Survey } from "src/participation-frm7/components/Survey"
import moreDefinition from "src/participation-frm7/data/more.json"
import surveyDefinition from "src/participation-frm7/data/survey.json"
import feedbackDefinition from "src/participation-frm7/data/feedback.json"
@@ -17,13 +17,12 @@ import createSurveySession from "src/survey-sessions/mutations/createSurveySessi
import updateSurveySession from "src/survey-sessions/mutations/updateSurveySession"
import createSurveyResponse from "src/survey-responses/mutations/createSurveyResponse"
-import { scrollToTopWithDelay } from "src/participation-frm7/utils/scrollToTopWithDelay"
-
-import { ParticipationSpinnerLayover } from "src/participation-frm7/components/survey/ParticipationSpinnerLayover"
import getPublicSurveyBySlug from "src/surveys/queries/getPublicSurveyBySlug"
import { Debug } from "src/participation/components/core/Debug"
import { ProgressContext } from "src/participation/context/contexts"
-import { LayoutParticipation } from "src/participation/components/layout/LayoutParticipation"
+import { LayoutParticipation } from "src/participation/components/core/layout/LayoutParticipation"
+import { ParticipationSpinnerLayover } from "src/participation/components/core/ParticipationSpinnerLayover"
+import { scrollToTopWithDelay } from "src/participation/utils/scrollToTopWithDelay"
// For Progressbar: stage and associated arbitrarily set status of the progressbar
export const stageProgressDefinition = {
@@ -35,7 +34,7 @@ export const stageProgressDefinition = {
}
const ParticipationFrm7MainPage: BlitzPage = () => {
- const [stage, setStage] = useState<"SURVEY" | "MORE" | "FEEDBACK" | "EMAIL" | "DONE">("FEEDBACK")
+ const [stage, setStage] = useState<"SURVEY" | "MORE" | "FEEDBACK" | "EMAIL" | "DONE">("SURVEY")
const [progress, setProgress] = useState(1)
const [isSpinner, setIsSpinner] = useState(false)
const [responses, setResponses] = useState([])
diff --git a/src/participation-frm7/components/survey/ParticipationSpinnerLayover.tsx b/src/participation-frm7/components/survey/ParticipationSpinnerLayover.tsx
deleted file mode 100644
index 061fdbffd..000000000
--- a/src/participation-frm7/components/survey/ParticipationSpinnerLayover.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import clsx from "clsx"
-
-export const ParticipationSpinnerLayover: React.FC = () => {
- return (
-
-
-
-
- Absenden…
-
-
-
- )
-}
diff --git a/src/participation-frm7/components/survey/Question.tsx b/src/participation-frm7/components/survey/Question.tsx
deleted file mode 100644
index 62d9b43df..000000000
--- a/src/participation-frm7/components/survey/Question.tsx
+++ /dev/null
@@ -1,83 +0,0 @@
-import {
- SingleOrMultiResponseProps,
- Question as TQuestion,
- TextResponseProps,
-} from "src/participation-frm7/data/types"
-import { ParticipationH2 } from "src/participation/components/core/Text"
-import { ParticipationLabeledCheckboxGroup } from "src/participation/components/form/ParticipationLabeledCheckboxGroup"
-import { ParticipationLabeledRadiobuttonGroup } from "src/participation/components/form/ParticipationLabeledRadiobuttonGroup"
-import { ParticipationLabeledTextareaField } from "src/participation/components/form/ParticipationLabeledTextareaField"
-export { FORM_ERROR } from "src/core/components/forms"
-
-type TSingleOrMultuResponseComponentProps = {
- id: number
-} & SingleOrMultiResponseProps
-
-const SingleResponseComponent: React.FC = ({
- id,
- responses,
-}) => (
- ({
- scope: `single-${id}`,
- name: `${id}-${item.id}`,
- label: item.text.de,
- help: item?.help?.de,
- value: `${item.id}`,
- }))}
- />
-)
-
-const MultipleResponseComponent: React.FC = ({
- id,
- responses,
-}) => (
- ({
- name: `multi-${id}-${item.id}`,
- label: item.text.de,
- help: item?.help?.de,
- }))}
- />
-)
-
-type TTextResponseComponentProps = {
- id: number
-} & TextResponseProps
-
-const TextResponseComponent: React.FC = ({ id }) => (
- <>
-
- >
-)
-
-// TODO type
-const CustomComponent = (props: any) => (
-
-
- {JSON.stringify(props, null, 2)}
-
-
-)
-
-const components = {
- singleResponse: SingleResponseComponent,
- multipleResponse: MultipleResponseComponent,
- text: TextResponseComponent,
- custom: CustomComponent,
-}
-
-type Props = { question: TQuestion; className?: string }
-
-export const Question: React.FC = ({ question, className }) => {
- const { id, label, component, props } = question
- const Component = components[component] || null
- return (
-
- {label.de}
- {/* @ts-ignore */}
- {Component && }
-
- )
-}
diff --git a/src/participation-frm7/components/survey/SurveyButton.tsx b/src/participation-frm7/components/survey/SurveyButton.tsx
deleted file mode 100644
index d76dd6f5a..000000000
--- a/src/participation-frm7/components/survey/SurveyButton.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import { ParticipationButton } from "src/participation/components/core/buttons/ParticipationButton"
-import { Button } from "src/participation/data/types"
-
-export { FORM_ERROR } from "src/core/components/forms"
-
-type Props = {
- button: Button
- buttonActions: { next: () => void; back: () => void }
- disabled?: boolean
-}
-
-export const SurveyButton: React.FC = ({ disabled, button, buttonActions }) => {
- const { label, color, onClick } = button
-
- if (onClick.action === "submit")
- return (
-
- {label.de}
-
- )
-
- let buttonActionSelect: any
- switch (onClick.action) {
- case "nextPage":
- buttonActionSelect = buttonActions.next
- break
- case "previousPage":
- buttonActionSelect = buttonActions.back
- break
- }
-
- return (
-
- {label.de}
-
- )
-}
diff --git a/src/participation-frm7/utils/scrollToTopWithDelay.ts b/src/participation-frm7/utils/scrollToTopWithDelay.ts
deleted file mode 100644
index 38d6de4b3..000000000
--- a/src/participation-frm7/utils/scrollToTopWithDelay.ts
+++ /dev/null
@@ -1 +0,0 @@
-export const scrollToTopWithDelay = () => setTimeout(() => window.scrollTo(0, 0), 150)
diff --git a/src/participation/components/Done.tsx b/src/participation/components/Done.tsx
index a3e2eecd4..6567e52c2 100644
--- a/src/participation/components/Done.tsx
+++ b/src/participation/components/Done.tsx
@@ -1,6 +1,6 @@
export { FORM_ERROR } from "src/core/components/forms"
import { ParticipationLink } from "./core/links/ParticipationLink"
-import { ScreenHeaderParticipation } from "./layout/ScreenHeaderParticipation"
+import { ScreenHeaderParticipation } from "./core/layout/ScreenHeaderParticipation"
export const Done = () => {
return (
diff --git a/src/participation/components/Email.tsx b/src/participation/components/Email.tsx
index 1628abee4..6c08fc7b6 100644
--- a/src/participation/components/Email.tsx
+++ b/src/participation/components/Email.tsx
@@ -4,8 +4,8 @@ import { iframeResizer } from "iframe-resizer"
export { FORM_ERROR } from "src/core/components/forms"
import { ParticipationH2, ParticipationP } from "./core/Text"
import { ParticipationLink } from "./core/links/ParticipationLink"
-import SurveyForm from "./form/SurveyForm"
-import { ScreenHeaderParticipation } from "./layout/ScreenHeaderParticipation"
+import SurveyForm from "./core/form/SurveyForm"
+import { ScreenHeaderParticipation } from "./core/layout/ScreenHeaderParticipation"
type Props = {
onSubmit: any
diff --git a/src/participation/components/More.tsx b/src/participation/components/More.tsx
index be0a5dcf9..8674e1ddd 100644
--- a/src/participation/components/More.tsx
+++ b/src/participation/components/More.tsx
@@ -1,8 +1,8 @@
import { ParticipationH2 } from "./core/Text"
import { ParticipationButton } from "./core/buttons/ParticipationButton"
import { ParticipationButtonWrapper } from "./core/buttons/ParticipationButtonWrapper"
-import SurveyForm from "./form/SurveyForm"
-import { ScreenHeaderParticipation } from "./layout/ScreenHeaderParticipation"
+import SurveyForm from "./core/form/SurveyForm"
+import { ScreenHeaderParticipation } from "./core/layout/ScreenHeaderParticipation"
export { FORM_ERROR } from "src/core/components/forms"
diff --git a/src/participation/components/survey/Survey.tsx b/src/participation/components/Survey.tsx
similarity index 96%
rename from src/participation/components/survey/Survey.tsx
rename to src/participation/components/Survey.tsx
index f2d41d578..1108ae88b 100644
--- a/src/participation/components/survey/Survey.tsx
+++ b/src/participation/components/Survey.tsx
@@ -1,13 +1,13 @@
import { useCallback, useContext, useState } from "react"
-import SurveyForm from "../form/SurveyForm"
+import SurveyForm from "./core/form/SurveyForm"
export { FORM_ERROR } from "src/core/components/forms"
import { stageProgressDefinition } from "src/participation/components/rs8"
import { ProgressContext } from "src/participation/context/contexts"
import { Survey as TSurvey } from "src/participation/data/types"
-import { Debug } from "../core/Debug"
-import { Page } from "./Page"
+import { Debug } from "./core/Debug"
+import { Page } from "./core/Page"
import { scrollToTopWithDelay } from "src/participation/utils/scrollToTopWithDelay"
type Props = { survey: TSurvey; onSubmit: ([]) => void }
diff --git a/src/participation-frm7/components/survey/Page.tsx b/src/participation/components/core/Page.tsx
similarity index 82%
rename from src/participation-frm7/components/survey/Page.tsx
rename to src/participation/components/core/Page.tsx
index 0bd79b47f..297e4f03d 100644
--- a/src/participation-frm7/components/survey/Page.tsx
+++ b/src/participation/components/core/Page.tsx
@@ -1,9 +1,8 @@
-import { ScreenHeaderParticipation } from "src/participation/components/layout/ScreenHeaderParticipation"
-import { SurveyButton } from "./SurveyButton"
-
+import { ScreenHeaderParticipation } from "src/participation/components/core/layout/ScreenHeaderParticipation"
+import { ParticipationButtonWithAction } from "./buttons/ParticipationButtonWithAction"
+import { ParticipationButtonWrapper } from "./buttons/ParticipationButtonWrapper"
import type { Page as TPage } from "src/participation/data/types"
import { Question } from "./Question"
-import { ParticipationButtonWrapper } from "src/participation/components/core/buttons/ParticipationButtonWrapper"
export { FORM_ERROR } from "src/core/components/forms"
type Props = {
@@ -31,7 +30,7 @@ export const Page: React.FC = ({ page, buttonActions, completed }) => {
disabled = !completed
}
return (
- = ({ disabled, button, buttonActions }) => {
+export const ParticipationButtonWithAction: React.FC = ({
+ disabled,
+ button,
+ buttonActions,
+}) => {
const { label, color, onClick } = button
if (onClick.action === "submit")
diff --git a/src/participation/components/form/ParticipationLabeledCheckbox.tsx b/src/participation/components/core/form/ParticipationLabeledCheckbox.tsx
similarity index 100%
rename from src/participation/components/form/ParticipationLabeledCheckbox.tsx
rename to src/participation/components/core/form/ParticipationLabeledCheckbox.tsx
diff --git a/src/participation/components/form/ParticipationLabeledCheckboxGroup.tsx b/src/participation/components/core/form/ParticipationLabeledCheckboxGroup.tsx
similarity index 100%
rename from src/participation/components/form/ParticipationLabeledCheckboxGroup.tsx
rename to src/participation/components/core/form/ParticipationLabeledCheckboxGroup.tsx
diff --git a/src/participation/components/form/ParticipationLabeledRadiobutton.tsx b/src/participation/components/core/form/ParticipationLabeledRadiobutton.tsx
similarity index 100%
rename from src/participation/components/form/ParticipationLabeledRadiobutton.tsx
rename to src/participation/components/core/form/ParticipationLabeledRadiobutton.tsx
diff --git a/src/participation/components/form/ParticipationLabeledRadiobuttonGroup.tsx b/src/participation/components/core/form/ParticipationLabeledRadiobuttonGroup.tsx
similarity index 100%
rename from src/participation/components/form/ParticipationLabeledRadiobuttonGroup.tsx
rename to src/participation/components/core/form/ParticipationLabeledRadiobuttonGroup.tsx
diff --git a/src/participation/components/form/ParticipationLabeledTextField.tsx b/src/participation/components/core/form/ParticipationLabeledTextField.tsx
similarity index 100%
rename from src/participation/components/form/ParticipationLabeledTextField.tsx
rename to src/participation/components/core/form/ParticipationLabeledTextField.tsx
diff --git a/src/participation/components/form/ParticipationLabeledTextareaField.tsx b/src/participation/components/core/form/ParticipationLabeledTextareaField.tsx
similarity index 100%
rename from src/participation/components/form/ParticipationLabeledTextareaField.tsx
rename to src/participation/components/core/form/ParticipationLabeledTextareaField.tsx
diff --git a/src/participation/components/form/SurveyForm.tsx b/src/participation/components/core/form/SurveyForm.tsx
similarity index 100%
rename from src/participation/components/form/SurveyForm.tsx
rename to src/participation/components/core/form/SurveyForm.tsx
diff --git a/src/participation/components/layout/ContainerParticipation.tsx b/src/participation/components/core/layout/ContainerParticipation.tsx
similarity index 100%
rename from src/participation/components/layout/ContainerParticipation.tsx
rename to src/participation/components/core/layout/ContainerParticipation.tsx
diff --git a/src/participation/components/layout/FooterParticipation.tsx b/src/participation/components/core/layout/FooterParticipation.tsx
similarity index 71%
rename from src/participation/components/layout/FooterParticipation.tsx
rename to src/participation/components/core/layout/FooterParticipation.tsx
index 98df39de1..0a6effd0b 100644
--- a/src/participation/components/layout/FooterParticipation.tsx
+++ b/src/participation/components/core/layout/FooterParticipation.tsx
@@ -1,6 +1,6 @@
import React from "react"
-import { FooterLinkList } from "../../../core/layouts/Footer/FooterLinkList"
-import { links } from "../../../core/layouts/Footer/links.const"
+import { FooterLinkList } from "../../../../core/layouts/Footer/FooterLinkList"
+import { links } from "../../../../core/layouts/Footer/links.const"
export const FooterParticipation: React.FC = () => {
return (
diff --git a/src/participation/components/layout/HeaderParticipation.tsx b/src/participation/components/core/layout/HeaderParticipation.tsx
similarity index 87%
rename from src/participation/components/layout/HeaderParticipation.tsx
rename to src/participation/components/core/layout/HeaderParticipation.tsx
index 1a39936b2..ad6420f11 100644
--- a/src/participation/components/layout/HeaderParticipation.tsx
+++ b/src/participation/components/core/layout/HeaderParticipation.tsx
@@ -1,7 +1,7 @@
import { XMarkIcon } from "@heroicons/react/20/solid"
import Image from "next/image"
-import { ProgressBar } from "src/participation/components/layout/ProgressBar"
-import { ParticipationLink } from "../core/links/ParticipationLink"
+import { ProgressBar } from "src/participation/components/core/layout/ProgressBar"
+import { ParticipationLink } from "../links/ParticipationLink"
type Props = {
logoSrc: string
diff --git a/src/participation/components/layout/LayoutParticipation.tsx b/src/participation/components/core/layout/LayoutParticipation.tsx
similarity index 100%
rename from src/participation/components/layout/LayoutParticipation.tsx
rename to src/participation/components/core/layout/LayoutParticipation.tsx
diff --git a/src/participation/components/layout/ProgressBar.tsx b/src/participation/components/core/layout/ProgressBar.tsx
similarity index 100%
rename from src/participation/components/layout/ProgressBar.tsx
rename to src/participation/components/core/layout/ProgressBar.tsx
diff --git a/src/participation/components/layout/ScreenHeaderParticipation.tsx b/src/participation/components/core/layout/ScreenHeaderParticipation.tsx
similarity index 91%
rename from src/participation/components/layout/ScreenHeaderParticipation.tsx
rename to src/participation/components/core/layout/ScreenHeaderParticipation.tsx
index 99994f4f0..02acc3913 100644
--- a/src/participation/components/layout/ScreenHeaderParticipation.tsx
+++ b/src/participation/components/core/layout/ScreenHeaderParticipation.tsx
@@ -1,4 +1,4 @@
-import { ParticipationH1 } from "../core/Text"
+import { ParticipationH1 } from "../Text"
export type ScreenHeaderParticipationProps = {
title: string
diff --git a/src/participation/components/feedback/Feedback.tsx b/src/participation/components/feedback/Feedback.tsx
index 37d25e6a5..3a0c6ba56 100644
--- a/src/participation/components/feedback/Feedback.tsx
+++ b/src/participation/components/feedback/Feedback.tsx
@@ -1,7 +1,7 @@
import { useCallback, useContext, useState } from "react"
import { stageProgressDefinition } from "src/participation/components/rs8"
import { PinContext, ProgressContext } from "src/participation/context/contexts"
-import SurveyForm from "../form/SurveyForm"
+import SurveyForm from "../core/form/SurveyForm"
import { FeedbackFirstPage } from "./FeedbackFirstPage"
import { FeedbackSecondPage } from "./FeedbackSecondPage"
import { scrollToTopWithDelay } from "src/participation/utils/scrollToTopWithDelay"
diff --git a/src/participation/components/feedback/FeedbackFirstPage.tsx b/src/participation/components/feedback/FeedbackFirstPage.tsx
index 3881140a2..75681213c 100644
--- a/src/participation/components/feedback/FeedbackFirstPage.tsx
+++ b/src/participation/components/feedback/FeedbackFirstPage.tsx
@@ -1,8 +1,8 @@
import { MapProvider } from "react-map-gl/maplibre"
import { ParticipationButton } from "../core/buttons/ParticipationButton"
-import { ScreenHeaderParticipation } from "../layout/ScreenHeaderParticipation"
+import { ScreenHeaderParticipation } from "../core/layout/ScreenHeaderParticipation"
import { ParticipationMap } from "../maps/ParticipationMap"
-import { Question } from "../survey/Question"
+import { Question } from "../core/Question"
import { ParticipationButtonWrapper } from "../core/buttons/ParticipationButtonWrapper"
export { FORM_ERROR } from "src/core/components/forms"
diff --git a/src/participation/components/feedback/FeedbackSecondPage.tsx b/src/participation/components/feedback/FeedbackSecondPage.tsx
index e6ef495ed..2aba4ddcc 100644
--- a/src/participation/components/feedback/FeedbackSecondPage.tsx
+++ b/src/participation/components/feedback/FeedbackSecondPage.tsx
@@ -2,10 +2,10 @@ import { useContext } from "react"
import { PinContext } from "src/participation/context/contexts"
import { ParticipationButton } from "../core/buttons/ParticipationButton"
import { ParticipationButtonWrapper } from "../core/buttons/ParticipationButtonWrapper"
-import { ScreenHeaderParticipation } from "../layout/ScreenHeaderParticipation"
+import { ScreenHeaderParticipation } from "../core/layout/ScreenHeaderParticipation"
import { ParticipationH2, ParticipationH3, ParticipationP } from "../core/Text"
import { ParticipationStaticMap } from "../maps/ParticipationStaticMap"
-import { Question } from "../survey/Question"
+import { Question } from "../core/Question"
import { MultiLineString } from "@turf/helpers"
export { FORM_ERROR } from "src/core/components/forms"
diff --git a/src/participation/components/rs8-inactive.tsx b/src/participation/components/rs8-inactive.tsx
index 4508f1d8f..c80455e18 100644
--- a/src/participation/components/rs8-inactive.tsx
+++ b/src/participation/components/rs8-inactive.tsx
@@ -1,7 +1,7 @@
import { BlitzPage } from "@blitzjs/next"
-import { LayoutParticipation } from "src/participation/components/layout/LayoutParticipation"
+import { LayoutParticipation } from "src/participation/components/core/layout/LayoutParticipation"
import surveyDefinition from "src/participation/data/survey.json"
-import { ScreenHeaderParticipation } from "./layout/ScreenHeaderParticipation"
+import { ScreenHeaderParticipation } from "./core/layout/ScreenHeaderParticipation"
import { ParticipationLink } from "./core/links/ParticipationLink"
const ParticipationInactivePage: BlitzPage = () => {
diff --git a/src/participation/components/rs8.tsx b/src/participation/components/rs8.tsx
index 51106b045..22dd01ef4 100644
--- a/src/participation/components/rs8.tsx
+++ b/src/participation/components/rs8.tsx
@@ -5,9 +5,9 @@ import { useMutation } from "@blitzjs/rpc"
import { Done } from "src/participation/components/Done"
import { Email } from "src/participation/components/Email"
import { Feedback } from "src/participation/components/feedback/Feedback"
-import { LayoutParticipation } from "src/participation/components/layout/LayoutParticipation"
+import { LayoutParticipation } from "src/participation/components/core/layout/LayoutParticipation"
import { More } from "src/participation/components/More"
-import { Survey } from "src/participation/components/survey/Survey"
+import { Survey } from "src/participation/components/Survey"
import moreDefinition from "src/participation/data/more.json"
import surveyDefinition from "src/participation/data/survey.json"
import feedbackDefinition from "src/participation/data/feedback.json"
@@ -19,7 +19,7 @@ import createSurveyResponse from "src/survey-responses/mutations/createSurveyRes
import { Debug } from "src/participation/components/core/Debug"
import { scrollToTopWithDelay } from "src/participation/utils/scrollToTopWithDelay"
import { Spinner } from "src/core/components/Spinner"
-import { ParticipationSpinnerLayover } from "src/participation/components/survey/ParticipationSpinnerLayover"
+import { ParticipationSpinnerLayover } from "src/participation/components/core/ParticipationSpinnerLayover"
// For Progressbar: stage and associated arbitrarily set status of the progressbar
export const stageProgressDefinition = {
@@ -31,7 +31,7 @@ export const stageProgressDefinition = {
}
const ParticipationMainPage: BlitzPage = () => {
- const [stage, setStage] = useState<"SURVEY" | "MORE" | "FEEDBACK" | "EMAIL" | "DONE">("FEEDBACK")
+ const [stage, setStage] = useState<"SURVEY" | "MORE" | "FEEDBACK" | "EMAIL" | "DONE">("SURVEY")
const [progress, setProgress] = useState(1)
const [isSpinner, setIsSpinner] = useState(false)
const [responses, setResponses] = useState([])
diff --git a/src/participation/components/survey/Page.tsx b/src/participation/components/survey/Page.tsx
deleted file mode 100644
index b33db80d8..000000000
--- a/src/participation/components/survey/Page.tsx
+++ /dev/null
@@ -1,44 +0,0 @@
-import { ScreenHeaderParticipation } from "src/participation/components/layout/ScreenHeaderParticipation"
-import { SurveyButton } from "./SurveyButton"
-import { ParticipationButtonWrapper } from "../core/buttons/ParticipationButtonWrapper"
-import type { Page as TPage } from "src/participation/data/types"
-import { Question } from "./Question"
-export { FORM_ERROR } from "src/core/components/forms"
-
-type Props = {
- page: TPage
- buttonActions: any
- completed: boolean
-}
-
-export const Page: React.FC = ({ page, buttonActions, completed }) => {
- if (!page) return null
- const { id: pageId, title, description, questions, buttons } = page
-
- return (
-
-
- {questions &&
- questions.length &&
- questions.map((question) => (
-
- ))}
-
- {buttons?.map((button) => {
- let disabled = false
- if (["nextPage", "submit"].includes(button.onClick.action)) {
- disabled = !completed
- }
- return (
-
- )
- })}
-
-
- )
-}
From 2ac32b08803d0bd6266c6c415c117259625595ec Mon Sep 17 00:00:00 2001
From: JohannaPeanut <76495099+JohannaPeanut@users.noreply.github.com>
Date: Mon, 27 Nov 2023 18:49:31 +0100
Subject: [PATCH 006/101] Survey: share Email and More component, clean up json
---
src/participation-frm7/components/Email.tsx | 45 --------------
src/participation-frm7/components/More.tsx | 32 ----------
src/participation-frm7/components/frm7.tsx | 13 +++-
src/participation-frm7/data/email.json | 61 ++++---------------
src/participation-frm7/data/more.json | 41 +++++--------
src/participation/components/Email.tsx | 56 -----------------
src/participation/components/core/Email.tsx | 44 +++++++++++++
.../components/{ => core}/More.tsx | 14 ++---
src/participation/components/rs8.tsx | 12 +++-
src/participation/data/email.json | 61 ++++---------------
src/participation/data/more.json | 41 +++++--------
11 files changed, 119 insertions(+), 301 deletions(-)
delete mode 100644 src/participation-frm7/components/Email.tsx
delete mode 100644 src/participation-frm7/components/More.tsx
delete mode 100644 src/participation/components/Email.tsx
create mode 100644 src/participation/components/core/Email.tsx
rename src/participation/components/{ => core}/More.tsx (57%)
diff --git a/src/participation-frm7/components/Email.tsx b/src/participation-frm7/components/Email.tsx
deleted file mode 100644
index 96044e5d7..000000000
--- a/src/participation-frm7/components/Email.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-import { useCallback, useEffect, useState } from "react"
-import { iframeResizer } from "iframe-resizer"
-
-export { FORM_ERROR } from "src/core/components/forms"
-
-import { ParticipationH2, ParticipationP } from "src/participation/components/core/Text"
-import { ParticipationLink } from "src/participation/components/core/links/ParticipationLink"
-import { ScreenHeaderParticipation } from "src/participation/components/core/layout/ScreenHeaderParticipation"
-
-type Props = {
- onSubmit: any
- email: any // TODO
-}
-
-export const Email: React.FC = ({ onSubmit, email }) => {
- const page = email.pages[0]
-
- useEffect(() => {
- iframeResizer({}, "#mailjet-widget")
- }, [])
-
- return (
-
-
- {page.questions[0].label.de}
- {page.questions[0].props.text.de}
- {/* todo */}
-
- `,
- }}
- />
-
-
- {/* todo */}
-
- Zurück zur Startseite
-
-
-
- )
-}
diff --git a/src/participation-frm7/components/More.tsx b/src/participation-frm7/components/More.tsx
deleted file mode 100644
index 3c568a97b..000000000
--- a/src/participation-frm7/components/More.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-import { ParticipationH2 } from "src/participation/components/core/Text"
-import { ParticipationButton } from "src/participation/components/core/buttons/ParticipationButton"
-import { ParticipationButtonWrapper } from "src/participation/components/core/buttons/ParticipationButtonWrapper"
-import { ScreenHeaderParticipation } from "src/participation/components/core/layout/ScreenHeaderParticipation"
-
-export { FORM_ERROR } from "src/core/components/forms"
-
-type Props = {
- onClickMore: any
- onClickFinish: any
- more: any // TODO
-}
-
-export const More: React.FC = ({ more, onClickMore, onClickFinish }) => {
- const { title, description, questions, buttons } = more.pages[0]
- const question = questions[0]
-
- return (
- <>
-
- {question.label.de}
-
-
- {buttons[0].label.de}
-
-
- {buttons[1].label.de}
-
-
- >
- )
-}
diff --git a/src/participation-frm7/components/frm7.tsx b/src/participation-frm7/components/frm7.tsx
index d97d1d033..2f37e448e 100644
--- a/src/participation-frm7/components/frm7.tsx
+++ b/src/participation-frm7/components/frm7.tsx
@@ -3,10 +3,9 @@ import { BlitzPage, useParam } from "@blitzjs/next"
import { useMutation, useQuery } from "@blitzjs/rpc"
import { Done } from "src/participation-frm7/components/Done"
-import { Email } from "src/participation-frm7/components/Email"
+
import { Feedback } from "src/participation-frm7/components/feedback/Feedback"
-import { More } from "src/participation-frm7/components/More"
import { Survey } from "src/participation-frm7/components/Survey"
import moreDefinition from "src/participation-frm7/data/more.json"
import surveyDefinition from "src/participation-frm7/data/survey.json"
@@ -23,6 +22,8 @@ import { ProgressContext } from "src/participation/context/contexts"
import { LayoutParticipation } from "src/participation/components/core/layout/LayoutParticipation"
import { ParticipationSpinnerLayover } from "src/participation/components/core/ParticipationSpinnerLayover"
import { scrollToTopWithDelay } from "src/participation/utils/scrollToTopWithDelay"
+import { More } from "src/participation/components/core/More"
+import { Email } from "src/participation/components/core/Email"
// For Progressbar: stage and associated arbitrarily set status of the progressbar
export const stageProgressDefinition = {
@@ -146,7 +147,13 @@ const ParticipationFrm7MainPage: BlitzPage = () => {
)
break
case "EMAIL":
- component =
+ component = (
+
+ )
break
case "DONE":
component = = ({ onSubmit, email }) => {
- const [consent, setConsent] = useState(false)
-
- const handleSubmit = (values: Record) => {
- onSubmit(values.email)
- }
-
- const handleChange = useCallback((values: Record) => {
- setConsent(values.consent && values.email)
- }, [])
-
- const page = email.pages[0]
-
- useEffect(() => {
- iframeResizer({}, "#mailjet-widget")
- }, [])
-
- return (
-
-
-
- {page.questions[0].label.de}
- {page.questions[0].props.text.de}
-
-
- `,
- }}
- />
-
-
-
- Zurück zur Startseite
-
-
-
-
- )
-}
diff --git a/src/participation/components/core/Email.tsx b/src/participation/components/core/Email.tsx
new file mode 100644
index 000000000..f84ecee57
--- /dev/null
+++ b/src/participation/components/core/Email.tsx
@@ -0,0 +1,44 @@
+import { iframeResizer } from "iframe-resizer"
+import { useEffect } from "react"
+import { ParticipationH2, ParticipationP } from "./Text"
+import { ScreenHeaderParticipation } from "./layout/ScreenHeaderParticipation"
+import { ParticipationLink } from "./links/ParticipationLink"
+
+export { FORM_ERROR } from "src/core/components/forms"
+
+type Props = {
+ onSubmit: any
+ email: any // TODO
+ homeUrl: string
+}
+
+export const Email: React.FC = ({ onSubmit, email, homeUrl }) => {
+ const { description, questionText, button, title, mailjetWidgetUrl } = email
+
+ useEffect(() => {
+ iframeResizer({}, "#mailjet-widget")
+ }, [])
+
+ return (
+
+
+ {questionText.de}
+ {description.de}
+
+
+ `,
+ }}
+ />
+
+
+
+ {button.label.de}
+
+
+
+ )
+}
diff --git a/src/participation/components/More.tsx b/src/participation/components/core/More.tsx
similarity index 57%
rename from src/participation/components/More.tsx
rename to src/participation/components/core/More.tsx
index 8674e1ddd..deddc3e53 100644
--- a/src/participation/components/More.tsx
+++ b/src/participation/components/core/More.tsx
@@ -1,8 +1,7 @@
-import { ParticipationH2 } from "./core/Text"
-import { ParticipationButton } from "./core/buttons/ParticipationButton"
-import { ParticipationButtonWrapper } from "./core/buttons/ParticipationButtonWrapper"
-import SurveyForm from "./core/form/SurveyForm"
-import { ScreenHeaderParticipation } from "./core/layout/ScreenHeaderParticipation"
+import { ParticipationH2 } from "./Text"
+import { ParticipationButton } from "./buttons/ParticipationButton"
+import { ParticipationButtonWrapper } from "./buttons/ParticipationButtonWrapper"
+import { ScreenHeaderParticipation } from "./layout/ScreenHeaderParticipation"
export { FORM_ERROR } from "src/core/components/forms"
@@ -13,13 +12,12 @@ type Props = {
}
export const More: React.FC = ({ more, onClickMore, onClickFinish }) => {
- const { title, description, questions, buttons } = more.pages[0]
- const question = questions[0]
+ const { title, description, questionText, buttons } = more
return (
<>
- {question.label.de}
+ {questionText.de}
{buttons[0].label.de}
diff --git a/src/participation/components/rs8.tsx b/src/participation/components/rs8.tsx
index 22dd01ef4..ad67ae68f 100644
--- a/src/participation/components/rs8.tsx
+++ b/src/participation/components/rs8.tsx
@@ -3,10 +3,10 @@ import { BlitzPage } from "@blitzjs/next"
import { useMutation } from "@blitzjs/rpc"
import { Done } from "src/participation/components/Done"
-import { Email } from "src/participation/components/Email"
+import { Email } from "src/participation/components/core/Email"
import { Feedback } from "src/participation/components/feedback/Feedback"
import { LayoutParticipation } from "src/participation/components/core/layout/LayoutParticipation"
-import { More } from "src/participation/components/More"
+import { More } from "src/participation/components/core/More"
import { Survey } from "src/participation/components/Survey"
import moreDefinition from "src/participation/data/more.json"
import surveyDefinition from "src/participation/data/survey.json"
@@ -141,7 +141,13 @@ const ParticipationMainPage: BlitzPage = () => {
)
break
case "EMAIL":
- component =
+ component = (
+
+ )
break
case "DONE":
component = = ({
id,
diff --git a/src/participation/components/core/buttons/ParticipationButtonWithAction.tsx b/src/participation/components/core/buttons/ParticipationButtonWithAction.tsx
index f8381a061..3530b13cd 100644
--- a/src/participation/components/core/buttons/ParticipationButtonWithAction.tsx
+++ b/src/participation/components/core/buttons/ParticipationButtonWithAction.tsx
@@ -1,9 +1,9 @@
-import { Button } from "src/participation/data/types"
+import { TButton } from "src/participation/data/types"
import { ParticipationButton } from "./ParticipationButton"
export { FORM_ERROR } from "src/core/components/forms"
type Props = {
- button: Button
+ button: TButton
buttonActions: { next: () => void; back: () => void }
disabled?: boolean
}
diff --git a/src/participation/components/rs8-inactive.tsx b/src/participation/components/rs8-inactive.tsx
index c80455e18..7da20067c 100644
--- a/src/participation/components/rs8-inactive.tsx
+++ b/src/participation/components/rs8-inactive.tsx
@@ -1,6 +1,6 @@
import { BlitzPage } from "@blitzjs/next"
import { LayoutParticipation } from "src/participation/components/core/layout/LayoutParticipation"
-import surveyDefinition from "src/participation/data/survey.json"
+import surveyDefinition from "src/participation/data/survey"
import { ScreenHeaderParticipation } from "./core/layout/ScreenHeaderParticipation"
import { ParticipationLink } from "./core/links/ParticipationLink"
diff --git a/src/participation/components/rs8.tsx b/src/participation/components/rs8.tsx
index ad67ae68f..c7c9f45ba 100644
--- a/src/participation/components/rs8.tsx
+++ b/src/participation/components/rs8.tsx
@@ -1,25 +1,24 @@
-import { createContext, useState } from "react"
import { BlitzPage } from "@blitzjs/next"
import { useMutation } from "@blitzjs/rpc"
+import { useState } from "react"
import { Done } from "src/participation/components/Done"
+import { Survey } from "src/participation/components/Survey"
+import { Debug } from "src/participation/components/core/Debug"
import { Email } from "src/participation/components/core/Email"
-import { Feedback } from "src/participation/components/feedback/Feedback"
-import { LayoutParticipation } from "src/participation/components/core/layout/LayoutParticipation"
import { More } from "src/participation/components/core/More"
-import { Survey } from "src/participation/components/Survey"
-import moreDefinition from "src/participation/data/more.json"
-import surveyDefinition from "src/participation/data/survey.json"
-import feedbackDefinition from "src/participation/data/feedback.json"
-import emailDefinition from "src/participation/data/email.json"
+import { ParticipationSpinnerLayover } from "src/participation/components/core/ParticipationSpinnerLayover"
+import { LayoutParticipation } from "src/participation/components/core/layout/LayoutParticipation"
+import { Feedback } from "src/participation/components/feedback/Feedback"
import { ProgressContext } from "src/participation/context/contexts"
+import { emailDefinition } from "src/participation/data/email"
+import feedbackDefinition from "src/participation/data/feedback.json"
+import { moreDefinition } from "src/participation/data/more"
+import { surveyDefinition } from "src/participation/data/survey"
+import { scrollToTopWithDelay } from "src/participation/utils/scrollToTopWithDelay"
+import createSurveyResponse from "src/survey-responses/mutations/createSurveyResponse"
import createSurveySession from "src/survey-sessions/mutations/createSurveySession"
import updateSurveySession from "src/survey-sessions/mutations/updateSurveySession"
-import createSurveyResponse from "src/survey-responses/mutations/createSurveyResponse"
-import { Debug } from "src/participation/components/core/Debug"
-import { scrollToTopWithDelay } from "src/participation/utils/scrollToTopWithDelay"
-import { Spinner } from "src/core/components/Spinner"
-import { ParticipationSpinnerLayover } from "src/participation/components/core/ParticipationSpinnerLayover"
// For Progressbar: stage and associated arbitrarily set status of the progressbar
export const stageProgressDefinition = {
diff --git a/src/participation/data/email.json b/src/participation/data/email.json
deleted file mode 100644
index 6b8bb9d41..000000000
--- a/src/participation/data/email.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "createdAt": "2023-03-22T14:46:45.712Z",
-
- "title": { "de": "Vielen Dank für Ihre Teilnahme" },
- "questionText": { "de": "Was passiert jetzt?" },
- "description": {
- "de": "Nach Abschluss der Beteiligung (20.08.2023) werden Ihre Anregungen vom Planungsteam ausgewertet und geprüft, ob und inwieweit sie in die weitere Entwurfsplanung einfließen können. Wir bitten im Vorhinein um Verständnis, dass wir nicht jeden Hinweis kommentieren können. Nach der Auswertung werden wir gebündelt Rückmeldung zu den angesprochenen Themen geben."
- },
- "mailjetWidgetUrl": "https://7p8q.mjt.lu/wgt/7p8q/t5g/form?c=f8dcc5f9",
- "button": {
- "label": { "de": "Zurück zur Startseite" },
- "color": "white"
- }
-}
diff --git a/src/participation/data/email.ts b/src/participation/data/email.ts
new file mode 100644
index 000000000..7c46649b4
--- /dev/null
+++ b/src/participation/data/email.ts
@@ -0,0 +1,14 @@
+import { TEmail } from "./types"
+
+export const emailDefinition: TEmail = {
+ title: { de: "Vielen Dank für Ihre Teilnahme" },
+ questionText: { de: "Was passiert jetzt?" },
+ description: {
+ de: "Nach Abschluss der Beteiligung (20.08.2023) werden Ihre Anregungen vom Planungsteam ausgewertet und geprüft, ob und inwieweit sie in die weitere Entwurfsplanung einfließen können. Wir bitten im Vorhinein um Verständnis, dass wir nicht jeden Hinweis kommentieren können. Nach der Auswertung werden wir gebündelt Rückmeldung zu den angesprochenen Themen geben.",
+ },
+ mailjetWidgetUrl: "https://7p8q.mjt.lu/wgt/7p8q/t5g/form?c=f8dcc5f9",
+ button: {
+ label: { de: "Zurück zur Startseite" },
+ color: "white",
+ },
+}
diff --git a/src/participation/data/more.json b/src/participation/data/more.json
deleted file mode 100644
index f44f2a6d4..000000000
--- a/src/participation/data/more.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "createdAt": "2023-03-22T13:22:23.123Z",
- "title": { "de": "Danke, Ihre Daten wurden gesendet." },
- "description": {
- "de": "Wenn Sie möchten, können Sie uns noch weiteres Feedback z. B. zu einem konkreten Thema oder einer bestimmten Stelle zukommen lassen. Drücken Sie dazu bitte auf “Weitere Hinweise geben”. Dort haben Sie auch die Möglichkeit, Hinweise mit Pin auf einer interaktiven Karte zu verorten."
- },
- "questionText": { "de": "Haben Sie noch konkrete Hinweise zu Themen vor Ort?" },
- "buttons": [
- {
- "label": { "de": "Ja, ich habe noch Hinweise" },
- "color": "pink",
- "onClick": { "action": "nextPage" }
- },
- {
- "label": { "de": "Nein, ich möchte die Umfrage beenden" },
- "color": "white",
- "onClick": { "action": "submit" }
- }
- ]
-}
diff --git a/src/participation/data/more.ts b/src/participation/data/more.ts
new file mode 100644
index 000000000..7d506d274
--- /dev/null
+++ b/src/participation/data/more.ts
@@ -0,0 +1,21 @@
+import { TMore } from "./types"
+
+export const moreDefinition: TMore = {
+ title: { de: "Danke, Ihre Daten wurden gesendet." },
+ description: {
+ de: "Wenn Sie möchten, können Sie uns noch weiteres Feedback z. B. zu einem konkreten Thema oder einer bestimmten Stelle zukommen lassen. Drücken Sie dazu bitte auf “Weitere Hinweise geben”. Dort haben Sie auch die Möglichkeit, Hinweise mit Pin auf einer interaktiven Karte zu verorten.",
+ },
+ questionText: { de: "Haben Sie noch konkrete Hinweise zu Themen vor Ort?" },
+ buttons: [
+ {
+ label: { de: "Ja, ich habe noch Hinweise" },
+ color: "pink",
+ onClick: { action: "nextPage" },
+ },
+ {
+ label: { de: "Nein, ich möchte die Umfrage beenden" },
+ color: "white",
+ onClick: { action: "submit" },
+ },
+ ],
+}
diff --git a/src/participation/data/schema.json b/src/participation/data/schema.json
deleted file mode 100644
index b05a77807..000000000
--- a/src/participation/data/schema.json
+++ /dev/null
@@ -1,121 +0,0 @@
-{
- "title": "Survey",
- "version": 1,
- "type": "object",
- "required": ["id", "version", "title", "pages", "createdAt", "faviconUrl"],
- "additionalProperties": false,
- "properties": {
- "id": { "type": "integer", "minimum": 1 },
- "title": { "$ref": "#/$defs/translatableText" },
- "version": { "type": "integer", "enum": [1] },
- "createdAt": { "type": "string", "format": "date" },
- "faviconUrl": { "type": "string" },
- "pages": {
- "type": "array",
- "items": {
- "type": "object",
- "required": ["id", "title", "description", "buttons"],
- "additionalProperties": false,
- "properties": {
- "id": { "type": "integer", "minimum": 1 },
- "title": { "$ref": "#/$defs/translatableText" },
- "description": { "$ref": "#/$defs/translatableText" },
- "questions": {
- "type": "array",
- "items": {
- "type": "object",
- "required": ["id", "component", "label", "props"],
- "additionalProperties": false,
- "properties": {
- "id": { "type": "integer", "minimum": 1 },
- "component": {
- "type": "string",
- "enum": ["singleResponse", "multipleResponse", "text"]
- },
- "label": { "$ref": "#/$defs/translatableText" },
- "//* props.oneOf is here for generating typescript": "*//",
- "props": {
- "oneOf": [
- { "$ref": "#/$defs/SingleOrMultiResponseProps" },
- { "$ref": "#/$defs/TextResponseProps" }
- ]
- }
- },
- "allOf": [
- {
- "if": {
- "properties": {
- "component": { "enum": ["singleResponse", "multipleResponse"] }
- }
- },
- "then": {
- "properties": { "props": { "$ref": "#/$defs/SingleOrMultiResponseProps" } }
- }
- }
- ]
- }
- },
- "buttons": {
- "type": "array",
- "items": {
- "type": "object",
- "required": ["label", "color", "onClick"],
- "additionalProperties": false,
- "properties": {
- "label": { "$ref": "#/$defs/translatableText" },
- "color": { "type": "string", "enum": ["white", "pink"] },
- "onClick": {
- "type": "object",
- "required": ["action"],
- "additionalItems": false,
- "properties": {
- "action": {
- "enum": ["nextPage", "previousPage", "submit"]
- },
- "arguments": { "type": "array" }
- },
- "additionalProperties": false
- }
- }
- }
- }
- }
- }
- }
- },
- "$defs": {
- "translatableText": {
- "type": "object",
- "required": ["de"],
- "additionalProperties": false,
- "properties": {
- "de": { "type": "string", "minLength": 2 }
- }
- },
- "Response": {
- "type": "object",
- "required": ["id", "text"],
- "additionalProperties": false,
- "properties": {
- "id": { "type": "integer", "minimum": 1 },
- "text": { "$ref": "#/$defs/translatableText" }
- }
- },
- "SingleOrMultiResponseProps": {
- "type": "object",
- "required": ["responses"],
- "additionalProperties": false,
- "properties": {
- "responses": {
- "type": "array",
- "minLength": 2,
- "items": { "$ref": "#/$defs/Response" }
- }
- }
- },
- "TextResponseProps": {
- "type": "object",
- "additionalProperties": false
- }
- }
-}
diff --git a/src/participation/data/survey.json b/src/participation/data/survey.json
deleted file mode 100644
index 26e1c560d..000000000
--- a/src/participation/data/survey.json
+++ /dev/null
@@ -1,237 +0,0 @@
-{
- "id": 1,
- "title": { "de": "Beteiligung" },
- "createdAt": "2023-11-03T20:19:43.815Z",
- "version": 1,
- "logoUrl": "https://radschnellweg8-lb-wn.de/logo.png",
- "canonicalUrl": "https://radschnellweg8-lb-wn.de/beteiligung/",
- "pages": [
- {
- "id": 1,
- "title": { "de": "Ihre Meinung ist gefragt" },
- "description": {
- "de": "Auf dem Weg zur Schule, Sportstätte und Arbeitsplatz, beim Wocheneinkauf oder dem Familienausflug – unser Ziel ist, dass der Radschnellweg von vielen Menschen angenommen wird.\n\nDeshalb interessieren uns die Ideen, Anmerkungen und Hinweise von Alltagsexpertinnen und -experten. Sie kennen sich vor Ort aus. Unterstützen Sie das Planungsteam dabei, den RS 8 zum Erfolgsprojekt zu machen!\n\nDie Bürgerbeteiligung läuft noch bis zum 20.08.2023. Die Beantwortung dauert ca. 5-10 Minuten."
- },
- "buttons": [
- {
- "label": { "de": "Beteiligung starten" },
- "color": "pink",
- "onClick": { "action": "nextPage" }
- }
- ]
- },
- {
- "id": 2,
- "title": { "de": "Nutzung" },
- "description": {
- "de": "Zuerst möchten wir Ihnen einige Fragen zur Nutzung des RS 8 Ludwigsburg–Waiblingen stellen."
- },
- "questions": [
- {
- "id": 1,
- "label": { "de": "Würden Sie den RS 8 nutzen?" },
- "component": "singleResponse",
- "props": {
- "responses": [
- { "id": 1, "text": { "de": "Ja" } },
- {
- "id": 2,
- "text": { "de": "Nein" },
- "help": {
- "de": "Warum nicht? Wir freuen uns, wenn Sie das Freifeldtext im späteren Teil „Weiteres Feedback“ nutzen, um uns Ihre Gründe zu nennen. Besten Dank!"
- }
- },
- {
- "id": 3,
- "text": {
- "de": "Ich bin ohnehin nicht zwischen Ludwigsburg und Waiblingen unterwegs."
- }
- }
- ]
- }
- },
- {
- "id": 2,
- "label": { "de": "Wie häufig würden Sie den RS 8 nutzen?" },
- "component": "singleResponse",
- "props": {
- "responses": [
- { "id": 1, "text": { "de": "Täglich" } },
- { "id": 2, "text": { "de": "Mehrmals pro Woche" } },
- { "id": 3, "text": { "de": "Mehrmals im Monat" } },
- { "id": 4, "text": { "de": "Seltener oder Nie" } }
- ]
- }
- },
- {
- "id": 3,
- "label": { "de": "Für welche Zwecke würden Sie den RS 8 nutzen?" },
- "component": "multipleResponse",
- "props": {
- "responses": [
- { "id": 1, "text": { "de": "Einkaufen" } },
- { "id": 2, "text": { "de": "Zur Arbeit/Schule pendeln" } },
- { "id": 3, "text": { "de": "Sport/Freizeit" } },
- { "id": 4, "text": { "de": "Anderes" } }
- ]
- }
- },
- {
- "id": 4,
- "label": { "de": "Würden Sie durch den RS 8 häufiger aufs Auto verzichten?" },
- "component": "singleResponse",
- "props": {
- "responses": [
- { "id": 1, "text": { "de": "Ja" } },
- { "id": 2, "text": { "de": "Nein" } },
- { "id": 3, "text": { "de": "Ich verzichte bereits aufs Auto." } },
- { "id": 4, "text": { "de": "Weiß nicht / Keine Angabe" } }
- ]
- }
- },
- {
- "id": 5,
- "label": {
- "de": "Glauben Sie, dass andere durch den RS 8 häufiger aufs Auto verzichten würden?"
- },
- "component": "singleResponse",
- "props": {
- "responses": [
- { "id": 1, "text": { "de": "Ja" } },
- { "id": 2, "text": { "de": "Nein" } },
- { "id": 3, "text": { "de": "Weiß nicht / Keine Angabe" } }
- ]
- }
- }
- ],
- "buttons": [
- { "label": { "de": "Weiter" }, "color": "pink", "onClick": { "action": "nextPage" } },
- { "label": { "de": "Zurück" }, "color": "white", "onClick": { "action": "previousPage" } }
- ]
- },
- {
- "id": 3,
- "title": { "de": "Ausstattung" },
- "description": {
- "de": "Wie wichtig sind Ihnen folgende Ausstattungsmerkmale bei Radschnellwegen?"
- },
- "questions": [
- {
- "id": 6,
- "label": { "de": "Wie wichtig ist Ihnen die Beleuchtung des RS 8?" },
- "component": "singleResponse",
- "props": {
- "responses": [
- { "id": 1, "text": { "de": "Eher wichtig" } },
- { "id": 2, "text": { "de": "Weniger wichtig" } },
- { "id": 3, "text": { "de": "Weiß nicht" } }
- ]
- }
- },
- {
- "id": 7,
- "label": { "de": "Wie wichtig sind Ihnen Rastmöglichkeiten entlang der Strecke?" },
- "component": "singleResponse",
- "props": {
- "responses": [
- { "id": 1, "text": { "de": "Eher wichtig" } },
- { "id": 2, "text": { "de": "Weniger wichtig" } },
- { "id": 3, "text": { "de": "Weiß nicht" } }
- ]
- }
- },
- {
- "id": 8,
- "label": {
- "de": "Wie wichtig sind Ihnen Reparatursäulen (Luftpumpe, Werkzeug) entlang der Strecke?"
- },
- "component": "singleResponse",
- "props": {
- "responses": [
- { "id": 1, "text": { "de": "Eher wichtig" } },
- { "id": 2, "text": { "de": "Weniger wichtig" } },
- { "id": 3, "text": { "de": "Weiß nicht" } }
- ]
- }
- }
- ],
- "buttons": [
- { "label": { "de": "Weiter" }, "color": "pink", "onClick": { "action": "nextPage" } },
- { "label": { "de": "Zurück" }, "color": "white", "onClick": { "action": "previousPage" } }
- ]
- },
- {
- "id": 4,
- "title": { "de": "Gemeinsame Wegeführung" },
- "description": {
- "de": "Leider wird es nicht überall möglich sein, Wege zu bauen, die ausschließlich dem Radverkehr vorbehalten sind. Wir möchten gerne von Ihnen wissen, welche Folgen das für Ihre Nutzung des RS 8 hätte."
- },
- "questions": [
- {
- "id": 9,
- "label": {
- "de": "Einen Weg, auf dem auch Fußverkehr zugelassen ist, würde ich …"
- },
- "component": "singleResponse",
- "props": {
- "responses": [
- { "id": 1, "text": { "de": "ohne Einschränkung mit dem Rad nutzen." } },
- { "id": 2, "text": { "de": "eher selten mit dem Rad nutzen." } },
- { "id": 3, "text": { "de": "nie mit dem Rad nutzen." } },
- { "id": 4, "text": { "de": "Weiß ich nicht." } }
- ]
- }
- },
- {
- "id": 10,
- "label": {
- "de": "Eine Fahrradstraße, die auch von Kfz befahren werden darf, würde ich …"
- },
- "component": "singleResponse",
- "props": {
- "responses": [
- { "id": 1, "text": { "de": "ohne Einschränkung mit dem Rad nutzen." } },
- { "id": 2, "text": { "de": "eher selten mit dem Rad nutzen." } },
- { "id": 3, "text": { "de": "nie mit dem Rad nutzen." } },
- { "id": 4, "text": { "de": "Weiß ich nicht." } }
- ]
- }
- },
- {
- "id": 11,
- "label": {
- "de": "Einen Radweg, der auch von landwirtschaftlichen Fahrzeugen befahren werden darf, würde ich …"
- },
- "component": "singleResponse",
- "props": {
- "responses": [
- { "id": 1, "text": { "de": "ohne Einschränkung mit dem Rad nutzen." } },
- { "id": 2, "text": { "de": "eher selten mit dem Rad nutzen." } },
- { "id": 3, "text": { "de": "nie mit dem Rad nutzen." } },
- { "id": 4, "text": { "de": "Weiß ich nicht." } }
- ]
- }
- },
- {
- "id": 12,
- "label": {
- "de": "Einen Radweg, der auch von Bussen befahren werden darf, würde ich …"
- },
- "component": "singleResponse",
- "props": {
- "responses": [
- { "id": 1, "text": { "de": "ohne Einschränkung mit dem Rad nutzen." } },
- { "id": 2, "text": { "de": "eher selten mit dem Rad nutzen." } },
- { "id": 3, "text": { "de": "nie mit dem Rad nutzen." } },
- { "id": 4, "text": { "de": "Weiß ich nicht." } }
- ]
- }
- }
- ],
- "buttons": [
- { "label": { "de": "Absenden" }, "color": "pink", "onClick": { "action": "submit" } },
- { "label": { "de": "Zurück" }, "color": "white", "onClick": { "action": "previousPage" } }
- ]
- }
- ]
-}
diff --git a/src/participation/data/survey.ts b/src/participation/data/survey.ts
new file mode 100644
index 000000000..e56bc7fb7
--- /dev/null
+++ b/src/participation/data/survey.ts
@@ -0,0 +1,237 @@
+import { TSurvey } from "./types"
+
+export const surveyDefinition: TSurvey = {
+ id: 1,
+ version: 1,
+ logoUrl: "https://radschnellweg8-lb-wn.de/logo.png",
+ canonicalUrl: "https://radschnellweg8-lb-wn.de/beteiligung/",
+ pages: [
+ {
+ id: 1,
+ title: { de: "Ihre Meinung ist gefragt" },
+ description: {
+ de: "Auf dem Weg zur Schule, Sportstätte und Arbeitsplatz, beim Wocheneinkauf oder dem Familienausflug – unser Ziel ist, dass der Radschnellweg von vielen Menschen angenommen wird.\n\nDeshalb interessieren uns die Ideen, Anmerkungen und Hinweise von Alltagsexpertinnen und -experten. Sie kennen sich vor Ort aus. Unterstützen Sie das Planungsteam dabei, den RS 8 zum Erfolgsprojekt zu machen!\n\nDie Bürgerbeteiligung läuft noch bis zum 20.08.2023. Die Beantwortung dauert ca. 5-10 Minuten.",
+ },
+ buttons: [
+ {
+ label: { de: "Beteiligung starten" },
+ color: "pink",
+ onClick: { action: "nextPage" },
+ },
+ ],
+ },
+ {
+ id: 2,
+ title: { de: "Nutzung" },
+ description: {
+ de: "Zuerst möchten wir Ihnen einige Fragen zur Nutzung des RS 8 Ludwigsburg–Waiblingen stellen.",
+ },
+ questions: [
+ {
+ id: 1,
+ label: { de: "Würden Sie den RS 8 nutzen?" },
+ component: "singleResponse",
+ props: {
+ responses: [
+ { id: 1, text: { de: "Ja" } },
+ {
+ id: 2,
+ text: { de: "Nein" },
+ help: {
+ de: "Warum nicht? Wir freuen uns, wenn Sie das Freifeldtext im späteren Teil „Weiteres Feedback“ nutzen, um uns Ihre Gründe zu nennen. Besten Dank!",
+ },
+ },
+ {
+ id: 3,
+ text: {
+ de: "Ich bin ohnehin nicht zwischen Ludwigsburg und Waiblingen unterwegs.",
+ },
+ },
+ ],
+ },
+ },
+ {
+ id: 2,
+ label: { de: "Wie häufig würden Sie den RS 8 nutzen?" },
+ component: "singleResponse",
+ props: {
+ responses: [
+ { id: 1, text: { de: "Täglich" } },
+ { id: 2, text: { de: "Mehrmals pro Woche" } },
+ { id: 3, text: { de: "Mehrmals im Monat" } },
+ { id: 4, text: { de: "Seltener oder Nie" } },
+ ],
+ },
+ },
+ {
+ id: 3,
+ label: { de: "Für welche Zwecke würden Sie den RS 8 nutzen?" },
+ component: "multipleResponse",
+ props: {
+ responses: [
+ { id: 1, text: { de: "Einkaufen" } },
+ { id: 2, text: { de: "Zur Arbeit/Schule pendeln" } },
+ { id: 3, text: { de: "Sport/Freizeit" } },
+ { id: 4, text: { de: "Anderes" } },
+ ],
+ },
+ },
+ {
+ id: 4,
+ label: { de: "Würden Sie durch den RS 8 häufiger aufs Auto verzichten?" },
+ component: "singleResponse",
+ props: {
+ responses: [
+ { id: 1, text: { de: "Ja" } },
+ { id: 2, text: { de: "Nein" } },
+ { id: 3, text: { de: "Ich verzichte bereits aufs Auto." } },
+ { id: 4, text: { de: "Weiß nicht / Keine Angabe" } },
+ ],
+ },
+ },
+ {
+ id: 5,
+ label: {
+ de: "Glauben Sie, dass andere durch den RS 8 häufiger aufs Auto verzichten würden?",
+ },
+ component: "singleResponse",
+ props: {
+ responses: [
+ { id: 1, text: { de: "Ja" } },
+ { id: 2, text: { de: "Nein" } },
+ { id: 3, text: { de: "Weiß nicht / Keine Angabe" } },
+ ],
+ },
+ },
+ ],
+ buttons: [
+ { label: { de: "Weiter" }, color: "pink", onClick: { action: "nextPage" } },
+ { label: { de: "Zurück" }, color: "white", onClick: { action: "previousPage" } },
+ ],
+ },
+ {
+ id: 3,
+ title: { de: "Ausstattung" },
+ description: {
+ de: "Wie wichtig sind Ihnen folgende Ausstattungsmerkmale bei Radschnellwegen?",
+ },
+ questions: [
+ {
+ id: 6,
+ label: { de: "Wie wichtig ist Ihnen die Beleuchtung des RS 8?" },
+ component: "singleResponse",
+ props: {
+ responses: [
+ { id: 1, text: { de: "Eher wichtig" } },
+ { id: 2, text: { de: "Weniger wichtig" } },
+ { id: 3, text: { de: "Weiß nicht" } },
+ ],
+ },
+ },
+ {
+ id: 7,
+ label: { de: "Wie wichtig sind Ihnen Rastmöglichkeiten entlang der Strecke?" },
+ component: "singleResponse",
+ props: {
+ responses: [
+ { id: 1, text: { de: "Eher wichtig" } },
+ { id: 2, text: { de: "Weniger wichtig" } },
+ { id: 3, text: { de: "Weiß nicht" } },
+ ],
+ },
+ },
+ {
+ id: 8,
+ label: {
+ de: "Wie wichtig sind Ihnen Reparatursäulen (Luftpumpe, Werkzeug) entlang der Strecke?",
+ },
+ component: "singleResponse",
+ props: {
+ responses: [
+ { id: 1, text: { de: "Eher wichtig" } },
+ { id: 2, text: { de: "Weniger wichtig" } },
+ { id: 3, text: { de: "Weiß nicht" } },
+ ],
+ },
+ },
+ ],
+ buttons: [
+ { label: { de: "Weiter" }, color: "pink", onClick: { action: "nextPage" } },
+ { label: { de: "Zurück" }, color: "white", onClick: { action: "previousPage" } },
+ ],
+ },
+ {
+ id: 4,
+ title: { de: "Gemeinsame Wegeführung" },
+ description: {
+ de: "Leider wird es nicht überall möglich sein, Wege zu bauen, die ausschließlich dem Radverkehr vorbehalten sind. Wir möchten gerne von Ihnen wissen, welche Folgen das für Ihre Nutzung des RS 8 hätte.",
+ },
+ questions: [
+ {
+ id: 9,
+ label: {
+ de: "Einen Weg, auf dem auch Fußverkehr zugelassen ist, würde ich …",
+ },
+ component: "singleResponse",
+ props: {
+ responses: [
+ { id: 1, text: { de: "ohne Einschränkung mit dem Rad nutzen." } },
+ { id: 2, text: { de: "eher selten mit dem Rad nutzen." } },
+ { id: 3, text: { de: "nie mit dem Rad nutzen." } },
+ { id: 4, text: { de: "Weiß ich nicht." } },
+ ],
+ },
+ },
+ {
+ id: 10,
+ label: {
+ de: "Eine Fahrradstraße, die auch von Kfz befahren werden darf, würde ich …",
+ },
+ component: "singleResponse",
+ props: {
+ responses: [
+ { id: 1, text: { de: "ohne Einschränkung mit dem Rad nutzen." } },
+ { id: 2, text: { de: "eher selten mit dem Rad nutzen." } },
+ { id: 3, text: { de: "nie mit dem Rad nutzen." } },
+ { id: 4, text: { de: "Weiß ich nicht." } },
+ ],
+ },
+ },
+ {
+ id: 11,
+ label: {
+ de: "Einen Radweg, der auch von landwirtschaftlichen Fahrzeugen befahren werden darf, würde ich …",
+ },
+ component: "singleResponse",
+ props: {
+ responses: [
+ { id: 1, text: { de: "ohne Einschränkung mit dem Rad nutzen." } },
+ { id: 2, text: { de: "eher selten mit dem Rad nutzen." } },
+ { id: 3, text: { de: "nie mit dem Rad nutzen." } },
+ { id: 4, text: { de: "Weiß ich nicht." } },
+ ],
+ },
+ },
+ {
+ id: 12,
+ label: {
+ de: "Einen Radweg, der auch von Bussen befahren werden darf, würde ich …",
+ },
+ component: "singleResponse",
+ props: {
+ responses: [
+ { id: 1, text: { de: "ohne Einschränkung mit dem Rad nutzen." } },
+ { id: 2, text: { de: "eher selten mit dem Rad nutzen." } },
+ { id: 3, text: { de: "nie mit dem Rad nutzen." } },
+ { id: 4, text: { de: "Weiß ich nicht." } },
+ ],
+ },
+ },
+ ],
+ buttons: [
+ { label: { de: "Absenden" }, color: "pink", onClick: { action: "submit" } },
+ { label: { de: "Zurück" }, color: "white", onClick: { action: "previousPage" } },
+ ],
+ },
+ ],
+}
diff --git a/src/participation/data/types.ts b/src/participation/data/types.ts
index edb0d327c..571873be4 100644
--- a/src/participation/data/types.ts
+++ b/src/participation/data/types.ts
@@ -1,50 +1,57 @@
-/* eslint-disable */
-/**
- * This file was automatically generated by json-schema-to-typescript.
- * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
- * and run json-schema-to-typescript to regenerate this file.
- */
-
-export interface Survey {
+export type TSurvey = {
id: number
- title: TranslatableText
- version: 1
- createdAt: string
- pages: Page[]
+ version: number
+ logoUrl: string
+ canonicalUrl: string
+ pages: TPage[]
}
-export interface Page {
+export type TPage = {
id: number
- title: TranslatableText
- description: TranslatableText
- questions?: Question[]
- buttons: Button[]
+ title: TTranslatableText
+ description: TTranslatableText
+ questions?: TQuestion[]
+ buttons: TButton[]
}
-export interface Question {
+
+export type TQuestion = {
id: number
- component: "singleResponse" | "multipleResponse" | "text"
- label: TranslatableText
- "//* props.oneOf is here for generating typescript"?: "*//"
- props: SingleOrMultiResponseProps | TextResponseProps
+ component: "singleResponse" | "multipleResponse"
+ label: TTranslatableText
+ props: TSingleOrMultiResponseProps
}
-export interface Button {
- label: TranslatableText
- color: "white" | "pink"
- onClick: {
+export type TButton = {
+ label: TTranslatableText
+ color: "white" | "pink" | "blue"
+ onClick?: {
action: "nextPage" | "previousPage" | "submit"
- arguments?: unknown[]
}
}
-export interface TranslatableText {
+
+export type TTranslatableText = {
de: string
}
-export interface SingleOrMultiResponseProps {
- responses: Response[]
+export type TSingleOrMultiResponseProps = {
+ responses: TResponse[]
}
-export interface Response {
+export type TResponse = {
id: number
- text: TranslatableText
- help?: TranslatableText
+ text: TTranslatableText
+ help?: TTranslatableText
+}
+
+export type TEmail = {
+ title: TTranslatableText
+ questionText: TTranslatableText
+ description: TTranslatableText
+ mailjetWidgetUrl: string
+ button: TButton[]
+}
+
+export type TMore = {
+ title: TTranslatableText
+ description: TTranslatableText
+ questionText: TTranslatableText
+ buttons: TButton[]
}
-export interface TextResponseProps {}
diff --git a/src/survey-responses/queries/getGroupedSurveyResponses.ts b/src/survey-responses/queries/getGroupedSurveyResponses.ts
index 1ca3716ff..0e65d4ee7 100644
--- a/src/survey-responses/queries/getGroupedSurveyResponses.ts
+++ b/src/survey-responses/queries/getGroupedSurveyResponses.ts
@@ -45,14 +45,14 @@ export default resolver.pipe(
// Reminder: `response.surveyId` is NOT a relation field
// the field here just represents first or second part of the survey json
- // src/participation/data/survey.json
+ // src/participation/data/survey
const surveyResponsesFirstPart = surveySessions
.map((session) => session.responses)
.flat()
.filter((response) => response.surveyPart === 1)
.sort((a, b) => b.id - a.id)
- // src/participation/data/feedback.json
+ // src/participation/data/feedback
const surveyResponsesFeedbackPart = surveySessions
.map((session) => session.responses)
.flat()
From a9bedb478214eda548faf0acd58aeacb71714917 Mon Sep 17 00:00:00 2001
From: JohannaPeanut <76495099+JohannaPeanut@users.noreply.github.com>
Date: Tue, 28 Nov 2023 16:24:48 +0100
Subject: [PATCH 009/101] Survey: update rename id-->part, update types, clean
up
---
.../surveys/[surveyId]/index.tsx | 4 +-
src/pages/api/survey/[surveyId]/questions.ts | 4 +-
src/pages/api/survey/[surveyId]/responses.ts | 4 +-
src/pages/api/survey/[surveyId]/results.ts | 6 +-
src/pages/survey-sessions/index.tsx | 138 +--
src/participation-frm7/components/Survey.tsx | 2 +-
.../components/frm7-inactive.tsx | 2 +-
src/participation-frm7/components/frm7.tsx | 6 +-
src/participation-frm7/data/feedback.json | 219 -----
src/participation-frm7/data/feedback.ts | 216 +++++
src/participation-frm7/data/survey.ts | 2 +-
src/participation/components/Survey.tsx | 2 +-
.../components/core/Question.tsx | 6 +-
.../buttons/ParticipationButtonWithAction.tsx | 4 +-
src/participation/components/rs8-inactive.tsx | 2 +-
src/participation/components/rs8.tsx | 8 +-
.../data/{feedback.json => feedback.ts} | 811 +++++++++---------
src/participation/data/survey.ts | 2 +-
src/participation/data/types.ts | 64 +-
.../EditableSurveyResponseListItem.tsx | 2 +-
.../utils/getSurveyResponseCategoryById.ts | 3 +-
21 files changed, 778 insertions(+), 729 deletions(-)
delete mode 100644 src/participation-frm7/data/feedback.json
create mode 100644 src/participation-frm7/data/feedback.ts
rename src/participation/data/{feedback.json => feedback.ts} (55%)
diff --git a/src/pages/[projectSlug]/surveys/[surveyId]/index.tsx b/src/pages/[projectSlug]/surveys/[surveyId]/index.tsx
index bd12670a7..db064145d 100644
--- a/src/pages/[projectSlug]/surveys/[surveyId]/index.tsx
+++ b/src/pages/[projectSlug]/surveys/[surveyId]/index.tsx
@@ -10,8 +10,8 @@ import { PageHeader } from "src/core/components/pages/PageHeader"
import { H2 } from "src/core/components/text"
import { useSlugs } from "src/core/hooks"
import { LayoutRs, MetaTags } from "src/core/layouts"
-import surveyDefinition from "src/participation/data/survey"
-import { TSurvey as TSurvey } from "src/participation/data/types"
+import { surveyDefinition } from "src/participation/data/survey"
+import { TSurvey } from "src/participation/data/types"
import { GroupedSurveyResponseItem } from "src/survey-responses/components/analysis/GroupedSurveyResponseItem"
import getGroupedSurveyResponses from "src/survey-responses/queries/getGroupedSurveyResponses"
import { getFormatDistanceInDays } from "src/survey-responses/utils/getFormatDistanceInDays"
diff --git a/src/pages/api/survey/[surveyId]/questions.ts b/src/pages/api/survey/[surveyId]/questions.ts
index c594cc391..311ed252f 100644
--- a/src/pages/api/survey/[surveyId]/questions.ts
+++ b/src/pages/api/survey/[surveyId]/questions.ts
@@ -1,6 +1,6 @@
import { NextApiRequest, NextApiResponse } from "next"
-import surveyDefinition from "src/participation/data/survey"
-import feedbackDefinition from "src/participation/data/feedback.json"
+import { surveyDefinition } from "src/participation/data/survey"
+import { feedbackDefinition } from "src/participation/data/feedback"
import { TSurvey } from "src/participation/data/types"
import { getSurvey, sendCsv } from "./_shared"
diff --git a/src/pages/api/survey/[surveyId]/responses.ts b/src/pages/api/survey/[surveyId]/responses.ts
index f09e9e078..fdefad4cc 100644
--- a/src/pages/api/survey/[surveyId]/responses.ts
+++ b/src/pages/api/survey/[surveyId]/responses.ts
@@ -1,6 +1,6 @@
import { NextApiRequest, NextApiResponse } from "next"
-import surveyDefinition from "src/participation/data/survey"
-import feedbackDefinition from "src/participation/data/feedback.json"
+import { surveyDefinition } from "src/participation/data/survey"
+import { feedbackDefinition } from "src/participation/data/feedback"
import { TSurvey } from "src/participation/data/types"
import { getSurvey, sendCsv } from "./_shared"
diff --git a/src/pages/api/survey/[surveyId]/results.ts b/src/pages/api/survey/[surveyId]/results.ts
index 339114712..826da5faa 100644
--- a/src/pages/api/survey/[surveyId]/results.ts
+++ b/src/pages/api/survey/[surveyId]/results.ts
@@ -1,10 +1,10 @@
import { NextApiRequest, NextApiResponse } from "next"
import db from "db"
-import surveyDefinition from "src/participation/data/survey"
-import feedbackDefinition from "src/participation/data/feedback.json"
+import { surveyDefinition } from "src/participation/data/survey"
+import { feedbackDefinition } from "src/participation/data/feedback"
import { getSurvey, sendCsv } from "./_shared"
-const surveys = Object.fromEntries([surveyDefinition, feedbackDefinition].map((o) => [o.id, o]))
+const surveys = Object.fromEntries([surveyDefinition, feedbackDefinition].map((o) => [o.part, o]))
const questions = {}
Object.values(surveys).forEach((survey) => {
survey.pages.forEach((page) => {
diff --git a/src/pages/survey-sessions/index.tsx b/src/pages/survey-sessions/index.tsx
index fbd24fde1..613b00af8 100644
--- a/src/pages/survey-sessions/index.tsx
+++ b/src/pages/survey-sessions/index.tsx
@@ -8,11 +8,11 @@ import { Pagination } from "src/core/components/Pagination"
import { Spinner } from "src/core/components/Spinner"
import { Link } from "src/core/components/links"
import { LayoutArticle, MetaTags } from "src/core/layouts"
-import feedbackDefinition from "src/participation/data/feedback.json"
-import surveyDefinition from "src/participation/data/survey"
+import { feedbackDefinition } from "src/participation/data/feedback"
+import { surveyDefinition } from "src/participation/data/survey"
import getSurveySessionsWithResponses from "src/survey-sessions/queries/getSurveySessionsWithResponses"
-const surveys = Object.fromEntries([surveyDefinition, feedbackDefinition].map((o) => [o.id, o]))
+const surveys = Object.fromEntries([surveyDefinition, feedbackDefinition].map((o) => [o.part, o]))
const questions = {}
Object.values(surveys).forEach((survey) => {
survey.pages.forEach((page) => {
@@ -47,69 +47,77 @@ export const SurveySessionsList = () => {
SurveySessions {count}
- {surveySessions.map((surveySession) => {
- const { id, createdAt, responses } = surveySession
- return (
- -
-
-
- SurveySession {id} - {createdAt.toISOString()}
-
-
+ {surveySessions
+ // TODO remove filter to show all sessions
+ // iterate through all surveys - does not work with this code as questions differ in feedback and surveydefinition
+ .filter((session) => session.surveyId === 1)
+ .map((surveySession) => {
+ const { id, createdAt, responses } = surveySession
+ return (
+ -
+
+
+ SurveySession {id} - {createdAt.toISOString()}
+
+
-
- {responses.map(({ id, surveyPart, data }: SurveyResponse) => {
- const survey = surveys[surveyPart]
- data = JSON.parse(data) as any // TODO are there types somewhere for {[questionId]: responseData} ?
- return (
-
-
- {survey!.title.de}
- {Object.entries(data).map(([questionId, responseData]) => {
- // @ts-ignore
- const question = questions[questionId]
- return (
-
-
- [{question.id}] {question.label.de}
- {" "}
- =
- {(() => {
- if (question.component === "singleResponse") {
- // @ts-ignore
- const responseId = responseData as number | null
- return responseId === null
- ? "null"
- : `[${responseId}] ${question.responses[responseId].text.de}`
- }
- if (question.component === "multipleResponse") {
- // @ts-ignore
- const responseIds = responseData as number[]
- return responseIds
- .map(
- (responseId) =>
- `[${responseId}] ${question.responses[responseId].text.de}`,
- )
- .join(", ")
- }
- if (question.component === "text") {
- // @ts-ignore
- const responseText = responseData as string | null
- return JSON.stringify(responseText)
- }
- return JSON.stringify(responseData)
- })()}
-
- )
- })}
-
-
- )
- })}
-
-
- )
- })}
+
+
+ {responses.map(({ id, surveyPart, data }: SurveyResponse) => {
+ const survey = surveys[surveyPart]
+
+ data = JSON.parse(data) as any // TODO are there types somewhere for {[questionId]: responseData} ?
+ return (
+
+
+ {Object.entries(data).map(([questionId, responseData]) => {
+ // @ts-ignore
+ const question = questions[questionId]
+ console.log(questions)
+
+ return (
+
+
+ [{question.id}] {question.label.de}
+ {" "}
+ =
+ {(() => {
+ if (question.component === "singleResponse") {
+ // @ts-ignore
+ const responseId = responseData as number | null
+ return responseId === null
+ ? "null"
+ : `[${responseId}] ${question.responses[responseId].text.de}`
+ }
+ if (question.component === "multipleResponse") {
+ // @ts-ignore
+ const responseIds = responseData as number[]
+ return responseIds
+ .map(
+ (responseId) =>
+ `[${responseId}] ${question.responses[responseId].text.de}`,
+ )
+ .join(", ")
+ }
+ if (question.component === "text") {
+ // @ts-ignore
+ const responseText = responseData as string | null
+ return JSON.stringify(responseText)
+ }
+ return JSON.stringify(responseData)
+ })()}
+
+ )
+ })}
+
+
+ )
+ })}
+
+
+
+ )
+ })}
{
const surveySessionId_ = await getOrCreateSurveySessionId()
await createSurveyResponseMutation({
surveySessionId: surveySessionId_,
- surveyPart: surveyDefinition.id,
+ surveyPart: surveyDefinition.part,
data: JSON.stringify(surveyResponses),
})
})()
@@ -90,7 +90,7 @@ const ParticipationFrm7MainPage: BlitzPage = () => {
const surveySessionId_ = await getOrCreateSurveySessionId()
await createSurveyResponseMutation({
surveySessionId: surveySessionId_,
- surveyPart: feedbackDefinition.id,
+ surveyPart: feedbackDefinition.part,
data: JSON.stringify(feedbackResponses),
})
})()
diff --git a/src/participation-frm7/data/feedback.json b/src/participation-frm7/data/feedback.json
deleted file mode 100644
index 79570c306..000000000
--- a/src/participation-frm7/data/feedback.json
+++ /dev/null
@@ -1,219 +0,0 @@
-{
- "id": 2,
- "title": { "de": "Feedback" },
- "createdAt": "2023-03-22T12:19:59.648Z",
- "version": 1,
- "pages": [
- {
- "id": 1,
- "title": { "de": "Wir sind gespannt auf Ihre Anmerkungen." },
- "description": {
- "de": "Hier können Sie dem Planungsteam konkrete Ideen, Anregungen und Hinweise zum RS 8 mit auf den Weg geben. Sie können mehrere Anmerkungen abgeben, bitte geben Sie diese einzeln ab."
- },
- "questions": [
- {
- "id": 21,
- "label": { "de": "Zu welchem Thema passt Ihr Feedback?" },
- "component": "singleResponse",
- "props": {
- "responses": [
- { "id": 1, "text": { "de": "Nutzung" } },
- { "id": 2, "text": { "de": "Streckenführung" } },
- { "id": 3, "text": { "de": "Zubringer" } },
- { "id": 4, "text": { "de": "Mögliche Konflikte" } },
- { "id": 5, "text": { "de": "Umwelt- und Naturschutz" } },
- { "id": 6, "text": { "de": "Sonstiges" } }
- ]
- }
- },
- {
- "id": 22,
- "label": {
- "de": "Bezieht sich Ihr Feedback auf eine konkrete Stelle entlang der Route?"
- },
- "component": "singleResponse",
- "props": {
- "responses": [
- { "id": 1, "text": { "de": "Ja" } },
- { "id": 2, "text": { "de": "Nein" } }
- ]
- }
- },
- {
- "id": 23,
- "label": { "de": "Markieren Sie die Stelle, zu der Sie etwas sagen möchten." },
- "component": "map",
- "props": {
- "marker": {
- "lat": 50.131816894372264,
- "lng": 8.695815249074684
- },
- "layerStyles": [
- {
- "id": "RS8--allsections-luecke-copy",
- "type": "line",
-
- "layout": { "visibility": "visible" },
- "paint": {
- "line-color": "#2C62A9",
- "line-width": 3,
- "line-dasharray": [2, 2]
- },
- "filter": ["all", ["==", "planungsabschnitt", "2A"]]
- },
- {
- "id": "RS8--allsections",
- "type": "line",
-
- "layout": { "visibility": "visible" },
- "paint": { "line-color": "#2C62A9", "line-width": 3 },
- "filter": ["all", ["!=", "planungsabschnitt", "2A"]]
- },
- {
- "id": "RS8--section4",
- "type": "line",
-
- "layout": { "visibility": "none" },
- "paint": {
- "line-color": "#2C62A9",
- "line-width": 7,
- "line-opacity": 1
- },
- "filter": ["all", ["==", "teilstrecke", 4]]
- },
- {
- "id": "RS8--section3",
- "type": "line",
-
- "layout": { "visibility": "none" },
- "paint": { "line-color": "#2C62A9", "line-width": 5 },
- "filter": ["all", ["==", "teilstrecke", 3]]
- },
- {
- "id": "RS8--section1",
- "type": "line",
-
- "layout": { "visibility": "none" },
- "paint": { "line-color": "#2C62A9", "line-width": 5 },
- "filter": ["any", ["==", "teilstrecke", 1], ["==", "planungsabschnitt", "2B"]]
- },
- {
- "id": "RS8--section1-luecke",
- "type": "line",
-
- "layout": { "visibility": "none" },
- "paint": {
- "line-color": "#2c62a9",
- "line-width": 7,
- "line-dasharray": [2, 2]
- },
- "filter": ["all", ["==", "planungsabschnitt", "2A"]]
- },
- {
- "id": "RS8--section2",
- "type": "line",
-
- "layout": { "visibility": "none" },
- "paint": { "line-color": "#2c62a9", "line-width": 5 },
- "filter": ["all", ["==", "teilstrecke", 2], ["!=", "planungsabschnitt", "2A"]]
- }
- ],
- "projectGeometry": {
- "type": "FeatureCollection",
- "features": [
- {
- "type": "Feature",
- "properties": {},
- "geometry": {
- "coordinates": [
- [
- [8.624785639994087, 50.087541366888246],
- [8.650674936761675, 50.09307804646028],
- [8.668598296062441, 50.100743162180805],
- [8.686521655363123, 50.106704071063945],
- [8.695815249074684, 50.131816894372264],
- [8.703117358419235, 50.14458107476918],
- [8.726351342697654, 50.14543189904731],
- [8.71440243649775, 50.15478996722965],
- [8.73099813955389, 50.16372096043952],
- [8.742947045754647, 50.15946831461474]
- ]
- ],
- "type": "MultiLineString"
- }
- }
- ]
- },
- "config": {
- "zoom": 2,
- "bounds": [
- 8.576990015191768, 50.18115285304344, 8.791982825789262, 50.084578531515405
- ],
- "longitude": 8.695815249074684,
- "latitude": 50.131816894372264,
- "boundsPadding": 20
- }
- }
- }
- ],
- "buttons": [
- { "label": { "de": "Weiter" }, "color": "pink", "onClick": { "action": "nextPage" } },
- { "label": { "de": "Zurück" }, "color": "white", "onClick": { "action": "previousPage" } }
- ]
- },
- {
- "id": 2,
- "title": { "de": "Ihr Hinweis" },
- "description": {
- "de": "Formulieren Sie hier Ihre Gedanken, Ideen, Anregungen oder Wünsche"
- },
- "questions": [
- {
- "id": 31,
- "label": { "de": "Kategorie" },
- "component": "custom"
- },
- {
- "id": 32,
- "label": { "de": "Ausgewählte Stelle" },
- "component": "custom"
- },
- {
- "id": 33,
- "label": { "de": "Wählen Sie die Stelle für Ihr Feedback" },
- "component": "custom"
- },
- {
- "id": 34,
- "label": { "de": "Was gefällt Ihnen hier besonders?" },
- "component": "text",
- "props": {
- "placeholder": { "de": "Beantworten Sie hier..." },
- "caption": { "de": "Max. 2000 Zeichen" }
- }
- },
- {
- "id": 35,
- "label": { "de": "Was wünschen Sie sich?" },
- "component": "text",
- "props": {
- "placeholder": { "de": "Beantworten Sie hier..." },
- "caption": { "de": "Max. 2000 Zeichen" }
- }
- }
- ],
- "buttons": [
- {
- "label": { "de": "Absenden & Beteiligung abschließen" },
- "color": "pink",
- "onClick": { "action": "submit" }
- },
- {
- "label": { "de": "Absenden & weiteren Hinweis geben" },
- "color": "white",
- "onClick": { "action": "submit" }
- }
- ]
- }
- ]
-}
diff --git a/src/participation-frm7/data/feedback.ts b/src/participation-frm7/data/feedback.ts
new file mode 100644
index 000000000..d05765a0e
--- /dev/null
+++ b/src/participation-frm7/data/feedback.ts
@@ -0,0 +1,216 @@
+import { TFeedback } from "src/participation/data/types"
+
+export const feedbackDefinition: TFeedback = {
+ part: 2,
+ pages: [
+ {
+ id: 1,
+ title: { de: "Wir sind gespannt auf Ihre Anmerkungen." },
+ description: {
+ de: "Hier können Sie dem Planungsteam konkrete Ideen, Anregungen und Hinweise zum RS 8 mit auf den Weg geben. Sie können mehrere Anmerkungen abgeben, bitte geben Sie diese einzeln ab.",
+ },
+ questions: [
+ {
+ id: 21,
+ label: { de: "Zu welchem Thema passt Ihr Feedback?" },
+ component: "singleResponse",
+ props: {
+ responses: [
+ { id: 1, text: { de: "Nutzung" } },
+ { id: 2, text: { de: "Streckenführung" } },
+ { id: 3, text: { de: "Zubringer" } },
+ { id: 4, text: { de: "Mögliche Konflikte" } },
+ { id: 5, text: { de: "Umwelt- und Naturschutz" } },
+ { id: 6, text: { de: "Sonstiges" } },
+ ],
+ },
+ },
+ {
+ id: 22,
+ label: {
+ de: "Bezieht sich Ihr Feedback auf eine konkrete Stelle entlang der Route?",
+ },
+ component: "singleResponse",
+ props: {
+ responses: [
+ { id: 1, text: { de: "Ja" } },
+ { id: 2, text: { de: "Nein" } },
+ ],
+ },
+ },
+ {
+ id: 23,
+ label: { de: "Markieren Sie die Stelle, zu der Sie etwas sagen möchten." },
+ component: "map",
+ props: {
+ marker: {
+ lat: 50.131816894372264,
+ lng: 8.695815249074684,
+ },
+ layerStyles: [
+ {
+ id: "RS8--allsections-luecke-copy",
+ type: "line",
+
+ layout: { visibility: "visible" },
+ paint: {
+ "line-color": "#2C62A9",
+ "line-width": 3,
+ "line-dasharray": [2, 2],
+ },
+ filter: ["all", ["==", "planungsabschnitt", "2A"]],
+ },
+ {
+ id: "RS8--allsections",
+ type: "line",
+
+ layout: { visibility: "visible" },
+ paint: { "line-color": "#2C62A9", "line-width": 3 },
+ filter: ["all", ["!=", "planungsabschnitt", "2A"]],
+ },
+ {
+ id: "RS8--section4",
+ type: "line",
+
+ layout: { visibility: "none" },
+ paint: {
+ "line-color": "#2C62A9",
+ "line-width": 7,
+ "line-opacity": 1,
+ },
+ filter: ["all", ["==", "teilstrecke", 4]],
+ },
+ {
+ id: "RS8--section3",
+ type: "line",
+
+ layout: { visibility: "none" },
+ paint: { "line-color": "#2C62A9", "line-width": 5 },
+ filter: ["all", ["==", "teilstrecke", 3]],
+ },
+ {
+ id: "RS8--section1",
+ type: "line",
+
+ layout: { visibility: "none" },
+ paint: { "line-color": "#2C62A9", "line-width": 5 },
+ filter: ["any", ["==", "teilstrecke", 1], ["==", "planungsabschnitt", "2B"]],
+ },
+ {
+ id: "RS8--section1-luecke",
+ type: "line",
+
+ layout: { visibility: "none" },
+ paint: {
+ "line-color": "#2c62a9",
+ "line-width": 7,
+ "line-dasharray": [2, 2],
+ },
+ filter: ["all", ["==", "planungsabschnitt", "2A"]],
+ },
+ {
+ id: "RS8--section2",
+ type: "line",
+
+ layout: { visibility: "none" },
+ paint: { "line-color": "#2c62a9", "line-width": 5 },
+ filter: ["all", ["==", "teilstrecke", 2], ["!=", "planungsabschnitt", "2A"]],
+ },
+ ],
+ projectGeometry: {
+ type: "FeatureCollection",
+ features: [
+ {
+ type: "Feature",
+ properties: {},
+ geometry: {
+ coordinates: [
+ [
+ [8.624785639994087, 50.087541366888246],
+ [8.650674936761675, 50.09307804646028],
+ [8.668598296062441, 50.100743162180805],
+ [8.686521655363123, 50.106704071063945],
+ [8.695815249074684, 50.131816894372264],
+ [8.703117358419235, 50.14458107476918],
+ [8.726351342697654, 50.14543189904731],
+ [8.71440243649775, 50.15478996722965],
+ [8.73099813955389, 50.16372096043952],
+ [8.742947045754647, 50.15946831461474],
+ ],
+ ],
+ type: "MultiLineString",
+ },
+ },
+ ],
+ },
+ config: {
+ zoom: 2,
+ bounds: [8.576990015191768, 50.18115285304344, 8.791982825789262, 50.084578531515405],
+ longitude: 8.695815249074684,
+ latitude: 50.131816894372264,
+ boundsPadding: 20,
+ },
+ },
+ },
+ ],
+ buttons: [
+ { label: { de: "Weiter" }, color: "pink", onClick: { action: "nextPage" } },
+ { label: { de: "Zurück" }, color: "white", onClick: { action: "previousPage" } },
+ ],
+ },
+ {
+ id: 2,
+ title: { de: "Ihr Hinweis" },
+ description: {
+ de: "Formulieren Sie hier Ihre Gedanken, Ideen, Anregungen oder Wünsche",
+ },
+ questions: [
+ {
+ id: 31,
+ label: { de: "Kategorie" },
+ component: "custom",
+ },
+ {
+ id: 32,
+ label: { de: "Ausgewählte Stelle" },
+ component: "custom",
+ },
+ {
+ id: 33,
+ label: { de: "Wählen Sie die Stelle für Ihr Feedback" },
+ component: "custom",
+ },
+ {
+ id: 34,
+ label: { de: "Was gefällt Ihnen hier besonders?" },
+ component: "text",
+ props: {
+ placeholder: { de: "Beantworten Sie hier..." },
+ caption: { de: "Max. 2000 Zeichen" },
+ },
+ },
+ {
+ id: 35,
+ label: { de: "Was wünschen Sie sich?" },
+ component: "text",
+ props: {
+ placeholder: { de: "Beantworten Sie hier..." },
+ caption: { de: "Max. 2000 Zeichen" },
+ },
+ },
+ ],
+ buttons: [
+ {
+ label: { de: "Absenden & Beteiligung abschließen" },
+ color: "pink",
+ onClick: { action: "submit" },
+ },
+ {
+ label: { de: "Absenden & weiteren Hinweis geben" },
+ color: "white",
+ onClick: { action: "submit" },
+ },
+ ],
+ },
+ ],
+}
diff --git a/src/participation-frm7/data/survey.ts b/src/participation-frm7/data/survey.ts
index 1a5bb024f..ffd0346bd 100644
--- a/src/participation-frm7/data/survey.ts
+++ b/src/participation-frm7/data/survey.ts
@@ -1,7 +1,7 @@
import { TSurvey } from "src/participation/data/types"
export const surveyDefinition: TSurvey = {
- id: 1,
+ part: 1,
version: 1,
logoUrl: "https://radschnellweg8-lb-wn.de/logo.png",
canonicalUrl: "https://radschnellweg8-lb-wn.de/beteiligung/",
diff --git a/src/participation/components/Survey.tsx b/src/participation/components/Survey.tsx
index 39a1bb73d..4dce6c44e 100644
--- a/src/participation/components/Survey.tsx
+++ b/src/participation/components/Survey.tsx
@@ -5,7 +5,7 @@ export { FORM_ERROR } from "src/core/components/forms"
import { stageProgressDefinition } from "src/participation/components/rs8"
import { ProgressContext } from "src/participation/context/contexts"
-import { TSurvey as TSurvey } from "src/participation/data/types"
+import { TSurvey } from "src/participation/data/types"
import { Debug } from "./core/Debug"
import { Page } from "./core/Page"
import { scrollToTopWithDelay } from "src/participation/utils/scrollToTopWithDelay"
diff --git a/src/participation/components/core/Question.tsx b/src/participation/components/core/Question.tsx
index fdd37797a..52026a8c6 100644
--- a/src/participation/components/core/Question.tsx
+++ b/src/participation/components/core/Question.tsx
@@ -1,5 +1,4 @@
-import { TSingleOrMultiResponseProps, TextResponseProps } from "src/participation/data/types"
-import { TQuestion as TQuestion } from "src/participation/data/types"
+import { TQuestion, TSingleOrMultiResponseProps } from "src/participation/data/types"
import { ParticipationH2 } from "./Text"
import { ParticipationLabeledCheckboxGroup } from "./form/ParticipationLabeledCheckboxGroup"
import { ParticipationLabeledRadiobuttonGroup } from "./form/ParticipationLabeledRadiobuttonGroup"
@@ -41,14 +40,13 @@ const MultipleResponseComponent: React.FC
type TTextResponseComponentProps = {
id: number
-} & TextResponseProps
+}
const TextResponseComponent: React.FC = ({ id }) => (
<>
>
)
-
// TODO type
const CustomComponent = (props: any) => (
diff --git a/src/participation/components/core/buttons/ParticipationButtonWithAction.tsx b/src/participation/components/core/buttons/ParticipationButtonWithAction.tsx
index 3530b13cd..d0be603d4 100644
--- a/src/participation/components/core/buttons/ParticipationButtonWithAction.tsx
+++ b/src/participation/components/core/buttons/ParticipationButtonWithAction.tsx
@@ -1,9 +1,9 @@
-import { TButton } from "src/participation/data/types"
+import { TButtonWithAction } from "src/participation/data/types"
import { ParticipationButton } from "./ParticipationButton"
export { FORM_ERROR } from "src/core/components/forms"
type Props = {
- button: TButton
+ button: TButtonWithAction
buttonActions: { next: () => void; back: () => void }
disabled?: boolean
}
diff --git a/src/participation/components/rs8-inactive.tsx b/src/participation/components/rs8-inactive.tsx
index 7da20067c..30975a510 100644
--- a/src/participation/components/rs8-inactive.tsx
+++ b/src/participation/components/rs8-inactive.tsx
@@ -1,6 +1,6 @@
import { BlitzPage } from "@blitzjs/next"
import { LayoutParticipation } from "src/participation/components/core/layout/LayoutParticipation"
-import surveyDefinition from "src/participation/data/survey"
+import { surveyDefinition } from "src/participation/data/survey"
import { ScreenHeaderParticipation } from "./core/layout/ScreenHeaderParticipation"
import { ParticipationLink } from "./core/links/ParticipationLink"
diff --git a/src/participation/components/rs8.tsx b/src/participation/components/rs8.tsx
index c7c9f45ba..27d6acf10 100644
--- a/src/participation/components/rs8.tsx
+++ b/src/participation/components/rs8.tsx
@@ -12,7 +12,7 @@ import { LayoutParticipation } from "src/participation/components/core/layout/La
import { Feedback } from "src/participation/components/feedback/Feedback"
import { ProgressContext } from "src/participation/context/contexts"
import { emailDefinition } from "src/participation/data/email"
-import feedbackDefinition from "src/participation/data/feedback.json"
+import { feedbackDefinition } from "src/participation/data/feedback"
import { moreDefinition } from "src/participation/data/more"
import { surveyDefinition } from "src/participation/data/survey"
import { scrollToTopWithDelay } from "src/participation/utils/scrollToTopWithDelay"
@@ -45,7 +45,7 @@ const ParticipationMainPage: BlitzPage = () => {
if (surveySessionId) {
return surveySessionId
} else {
- const surveySession = await createSurveySessionMutation({ surveyId: surveyDefinition.id })
+ const surveySession = await createSurveySessionMutation({ surveyId: surveyDefinition.part })
setSurveySessionId(surveySession.id)
return surveySession.id
}
@@ -59,7 +59,7 @@ const ParticipationMainPage: BlitzPage = () => {
const surveySessionId_ = await getOrCreateSurveySessionId()
await createSurveyResponseMutation({
surveySessionId: surveySessionId_,
- surveyPart: surveyDefinition.id,
+ surveyPart: surveyDefinition.part,
data: JSON.stringify(surveyResponses),
})
})()
@@ -83,7 +83,7 @@ const ParticipationMainPage: BlitzPage = () => {
const surveySessionId_ = await getOrCreateSurveySessionId()
await createSurveyResponseMutation({
surveySessionId: surveySessionId_,
- surveyPart: feedbackDefinition.id,
+ surveyPart: feedbackDefinition.part,
data: JSON.stringify(feedbackResponses),
})
})()
diff --git a/src/participation/data/feedback.json b/src/participation/data/feedback.ts
similarity index 55%
rename from src/participation/data/feedback.json
rename to src/participation/data/feedback.ts
index fedc3aa6f..3d4a52d4a 100644
--- a/src/participation/data/feedback.json
+++ b/src/participation/data/feedback.ts
@@ -1,131 +1,130 @@
-{
- "id": 2,
- "title": { "de": "Feedback" },
- "createdAt": "2023-03-22T12:19:59.648Z",
- "version": 1,
- "pages": [
+import { TFeedback } from "./types"
+
+export const feedbackDefinition: TFeedback = {
+ part: 2,
+ pages: [
{
- "id": 1,
- "title": { "de": "Wir sind gespannt auf Ihre Anmerkungen." },
- "description": {
- "de": "Hier können Sie dem Planungsteam konkrete Ideen, Anregungen und Hinweise zum RS 8 mit auf den Weg geben. Sie können mehrere Anmerkungen abgeben, bitte geben Sie diese einzeln ab."
+ id: 1,
+ title: { de: "Wir sind gespannt auf Ihre Anmerkungen." },
+ description: {
+ de: "Hier können Sie dem Planungsteam konkrete Ideen, Anregungen und Hinweise zum RS 8 mit auf den Weg geben. Sie können mehrere Anmerkungen abgeben, bitte geben Sie diese einzeln ab.",
},
- "questions": [
+ questions: [
{
- "id": 21,
- "label": { "de": "Zu welchem Thema passt Ihr Feedback?" },
- "component": "singleResponse",
- "props": {
- "responses": [
- { "id": 1, "text": { "de": "Nutzung" } },
- { "id": 2, "text": { "de": "Streckenführung" } },
- { "id": 3, "text": { "de": "Zubringer" } },
- { "id": 4, "text": { "de": "Mögliche Konflikte" } },
- { "id": 5, "text": { "de": "Umwelt- und Naturschutz" } },
- { "id": 6, "text": { "de": "Sonstiges" } }
- ]
- }
+ id: 21,
+ label: { de: "Zu welchem Thema passt Ihr Feedback?" },
+ component: "singleResponse",
+ props: {
+ responses: [
+ { id: 1, text: { de: "Nutzung" } },
+ { id: 2, text: { de: "Streckenführung" } },
+ { id: 3, text: { de: "Zubringer" } },
+ { id: 4, text: { de: "Mögliche Konflikte" } },
+ { id: 5, text: { de: "Umwelt- und Naturschutz" } },
+ { id: 6, text: { de: "Sonstiges" } },
+ ],
+ },
},
{
- "id": 22,
- "label": {
- "de": "Bezieht sich Ihr Feedback auf eine konkrete Stelle entlang der Route?"
+ id: 22,
+ label: {
+ de: "Bezieht sich Ihr Feedback auf eine konkrete Stelle entlang der Route?",
+ },
+ component: "singleResponse",
+ props: {
+ responses: [
+ { id: 1, text: { de: "Ja" } },
+ { id: 2, text: { de: "Nein" } },
+ ],
},
- "component": "singleResponse",
- "props": {
- "responses": [
- { "id": 1, "text": { "de": "Ja" } },
- { "id": 2, "text": { "de": "Nein" } }
- ]
- }
},
{
- "id": 23,
- "label": { "de": "Markieren Sie die Stelle, zu der Sie etwas sagen möchten." },
- "component": "map",
- "props": {
- "marker": {
- "lat": 48.87405710508672,
- "lng": 9.271044583540359
+ id: 23,
+ label: { de: "Markieren Sie die Stelle, zu der Sie etwas sagen möchten." },
+ component: "map",
+ props: {
+ marker: {
+ lat: 48.87405710508672,
+ lng: 9.271044583540359,
},
- "layerStyles": [
+ layerStyles: [
{
- "id": "RS8--allsections-luecke-copy",
- "type": "line",
+ id: "RS8--allsections-luecke-copy",
+ type: "line",
- "layout": { "visibility": "visible" },
- "paint": {
+ layout: { visibility: "visible" },
+ paint: {
"line-color": "#2C62A9",
"line-width": 3,
- "line-dasharray": [2, 2]
+ "line-dasharray": [2, 2],
},
- "filter": ["all", ["==", "planungsabschnitt", "2A"]]
+ filter: ["all", ["==", "planungsabschnitt", "2A"]],
},
{
- "id": "RS8--allsections",
- "type": "line",
+ id: "RS8--allsections",
+ type: "line",
- "layout": { "visibility": "visible" },
- "paint": { "line-color": "#2C62A9", "line-width": 3 },
- "filter": ["all", ["!=", "planungsabschnitt", "2A"]]
+ layout: { visibility: "visible" },
+ paint: { "line-color": "#2C62A9", "line-width": 3 },
+ filter: ["all", ["!=", "planungsabschnitt", "2A"]],
},
{
- "id": "RS8--section4",
- "type": "line",
+ id: "RS8--section4",
+ type: "line",
- "layout": { "visibility": "none" },
- "paint": {
+ layout: { visibility: "none" },
+ paint: {
"line-color": "#2C62A9",
"line-width": 7,
- "line-opacity": 1
+ "line-opacity": 1,
},
- "filter": ["all", ["==", "teilstrecke", 4]]
+ filter: ["all", ["==", "teilstrecke", 4]],
},
{
- "id": "RS8--section3",
- "type": "line",
+ id: "RS8--section3",
+ type: "line",
- "layout": { "visibility": "none" },
- "paint": { "line-color": "#2C62A9", "line-width": 5 },
- "filter": ["all", ["==", "teilstrecke", 3]]
+ layout: { visibility: "none" },
+ paint: { "line-color": "#2C62A9", "line-width": 5 },
+ filter: ["all", ["==", "teilstrecke", 3]],
},
{
- "id": "RS8--section1",
- "type": "line",
+ id: "RS8--section1",
+ type: "line",
- "layout": { "visibility": "none" },
- "paint": { "line-color": "#2C62A9", "line-width": 5 },
- "filter": ["any", ["==", "teilstrecke", 1], ["==", "planungsabschnitt", "2B"]]
+ layout: { visibility: "none" },
+ paint: { "line-color": "#2C62A9", "line-width": 5 },
+ filter: ["any", ["==", "teilstrecke", 1], ["==", "planungsabschnitt", "2B"]],
},
{
- "id": "RS8--section1-luecke",
- "type": "line",
+ id: "RS8--section1-luecke",
+ type: "line",
- "layout": { "visibility": "none" },
- "paint": {
+ layout: { visibility: "none" },
+ paint: {
"line-color": "#2c62a9",
"line-width": 7,
- "line-dasharray": [2, 2]
+ "line-dasharray": [2, 2],
},
- "filter": ["all", ["==", "planungsabschnitt", "2A"]]
+ filter: ["all", ["==", "planungsabschnitt", "2A"]],
},
{
- "id": "RS8--section2",
- "type": "line",
+ id: "RS8--section2",
+ type: "line",
- "layout": { "visibility": "none" },
- "paint": { "line-color": "#2c62a9", "line-width": 5 },
- "filter": ["all", ["==", "teilstrecke", 2], ["!=", "planungsabschnitt", "2A"]]
- }
+ layout: { visibility: "none" },
+ paint: { "line-color": "#2c62a9", "line-width": 5 },
+ filter: ["all", ["==", "teilstrecke", 2], ["!=", "planungsabschnitt", "2A"]],
+ },
],
- "projectGeometry": {
- "type": "FeatureCollection",
- "features": [
+ projectGeometry: {
+ type: "FeatureCollection",
+ features: [
{
- "type": "Feature",
- "geometry": {
- "type": "MultiLineString",
- "coordinates": [
+ type: "Feature",
+ geometry: {
+ type: "MultiLineString",
+ coordinates: [
[
[9.194367, 48.893241],
[9.204387, 48.893397],
@@ -139,25 +138,25 @@
[9.214959, 48.891126],
[9.215124, 48.891105],
[9.215157, 48.891101],
- [9.215175, 48.891098]
- ]
- ]
- },
- "id": "b52d5fa5-56ee-40de-b854-575f66edcd93",
- "properties": {
- "stroke": "#C93535",
- "gemeinde": "(1:Ludwigsburg)",
- "variante": "Trasse 2",
- "teilstrecke": 1,
- "baulasttraeger": "Stadt Ludwigsburg",
- "planungsabschnitt": "1B"
- }
+ [9.215175, 48.891098],
+ ],
+ ],
+ },
+ id: "b52d5fa5-56ee-40de-b854-575f66edcd93",
+ properties: {
+ stroke: "#C93535",
+ gemeinde: "(1:Ludwigsburg)",
+ variante: "Trasse 2",
+ teilstrecke: 1,
+ baulasttraeger: "Stadt Ludwigsburg",
+ planungsabschnitt: "1B",
+ },
},
{
- "type": "Feature",
- "geometry": {
- "type": "LineString",
- "coordinates": [
+ type: "Feature",
+ geometry: {
+ type: "LineString",
+ coordinates: [
[9.240035, 48.887679],
[9.240504, 48.887561],
[9.243368, 48.886582],
@@ -231,24 +230,24 @@
[9.246872, 48.885593],
[9.246904, 48.885578],
[9.246938, 48.885564],
- [9.246941, 48.885563]
- ]
- },
- "id": "99b232e7-3c50-44ba-90ac-0f755c5b1836",
- "properties": {
- "stroke": "#C93535",
- "gemeinde": "(1:Remseck am Neckar)",
- "variante": "Trasse 2",
- "teilstrecke": 2,
- "baulasttraeger": "Kreis Ludwigsburg",
- "planungsabschnitt": "2C"
- }
+ [9.246941, 48.885563],
+ ],
+ },
+ id: "99b232e7-3c50-44ba-90ac-0f755c5b1836",
+ properties: {
+ stroke: "#C93535",
+ gemeinde: "(1:Remseck am Neckar)",
+ variante: "Trasse 2",
+ teilstrecke: 2,
+ baulasttraeger: "Kreis Ludwigsburg",
+ planungsabschnitt: "2C",
+ },
},
{
- "type": "Feature",
- "geometry": {
- "type": "LineString",
- "coordinates": [
+ type: "Feature",
+ geometry: {
+ type: "LineString",
+ coordinates: [
[9.305, 48.838441],
[9.304997, 48.838436],
[9.304601, 48.838093],
@@ -273,24 +272,24 @@
[9.305058, 48.837724],
[9.305307, 48.837136],
[9.304794, 48.835689],
- [9.304766, 48.835575]
- ]
- },
- "id": "695f87f5-80b6-498f-8de1-f9c86c62533f",
- "properties": {
- "stroke": "#C93535",
- "gemeinde": "(2:Fellbach,Waiblingen)",
- "variante": "Trasse 2",
- "teilstrecke": 3,
- "baulasttraeger": "Rems-Murr-Kreis",
- "planungsabschnitt": "3E"
- }
+ [9.304766, 48.835575],
+ ],
+ },
+ id: "695f87f5-80b6-498f-8de1-f9c86c62533f",
+ properties: {
+ stroke: "#C93535",
+ gemeinde: "(2:Fellbach,Waiblingen)",
+ variante: "Trasse 2",
+ teilstrecke: 3,
+ baulasttraeger: "Rems-Murr-Kreis",
+ planungsabschnitt: "3E",
+ },
},
{
- "type": "Feature",
- "geometry": {
- "type": "LineString",
- "coordinates": [
+ type: "Feature",
+ geometry: {
+ type: "LineString",
+ coordinates: [
[9.267748, 48.878676],
[9.267825, 48.878569],
[9.268451, 48.877303],
@@ -316,24 +315,24 @@
[9.271077, 48.874053],
[9.271311, 48.873734],
[9.271428, 48.873611],
- [9.271868, 48.873704]
- ]
- },
- "id": "3cfc8c2d-e6ee-43f2-ac1d-e22e8833c9b0",
- "properties": {
- "stroke": "#C93535",
- "gemeinde": "(1:Remseck am Neckar)",
- "variante": "Trasse 2",
- "teilstrecke": 2,
- "baulasttraeger": "Kreis Ludwigsburg",
- "planungsabschnitt": "2E"
- }
+ [9.271868, 48.873704],
+ ],
+ },
+ id: "3cfc8c2d-e6ee-43f2-ac1d-e22e8833c9b0",
+ properties: {
+ stroke: "#C93535",
+ gemeinde: "(1:Remseck am Neckar)",
+ variante: "Trasse 2",
+ teilstrecke: 2,
+ baulasttraeger: "Kreis Ludwigsburg",
+ planungsabschnitt: "2E",
+ },
},
{
- "type": "Feature",
- "geometry": {
- "type": "MultiLineString",
- "coordinates": [
+ type: "Feature",
+ geometry: {
+ type: "MultiLineString",
+ coordinates: [
[
[9.29207, 48.858252],
[9.292078, 48.858219],
@@ -366,69 +365,69 @@
[9.291977, 48.854032],
[9.292263, 48.853953],
[9.291678, 48.853146],
- [9.291121, 48.85261]
- ]
- ]
- },
- "id": "075e7bea-cf2e-4f36-aa30-8ea2a4ea1949",
- "properties": {
- "stroke": "#C93535",
- "gemeinde": "(2:Fellbach,Waiblingen)",
- "variante": "Trasse 2",
- "teilstrecke": 3,
- "baulasttraeger": "Rems-Murr-Kreis",
- "planungsabschnitt": "3B"
- }
+ [9.291121, 48.85261],
+ ],
+ ],
+ },
+ id: "075e7bea-cf2e-4f36-aa30-8ea2a4ea1949",
+ properties: {
+ stroke: "#C93535",
+ gemeinde: "(2:Fellbach,Waiblingen)",
+ variante: "Trasse 2",
+ teilstrecke: 3,
+ baulasttraeger: "Rems-Murr-Kreis",
+ planungsabschnitt: "3B",
+ },
},
{
- "type": "Feature",
- "geometry": {
- "type": "MultiLineString",
- "coordinates": [
+ type: "Feature",
+ geometry: {
+ type: "MultiLineString",
+ coordinates: [
[
[9.215175, 48.891098],
[9.237414, 48.889564],
- [9.237415, 48.889563]
- ]
- ]
- },
- "id": "89b36de1-a801-467c-adfb-221a444ffe1c",
- "properties": {
- "stroke": "#E8B500",
- "gemeinde": "(1:Ludwigsburg)",
- "variante": "Trasse 2",
- "teilstrecke": "1",
- "baulasttraeger": "Kreis Ludwigsburg",
- "planungsabschnitt": "2A"
- }
+ [9.237415, 48.889563],
+ ],
+ ],
+ },
+ id: "89b36de1-a801-467c-adfb-221a444ffe1c",
+ properties: {
+ stroke: "#E8B500",
+ gemeinde: "(1:Ludwigsburg)",
+ variante: "Trasse 2",
+ teilstrecke: "1",
+ baulasttraeger: "Kreis Ludwigsburg",
+ planungsabschnitt: "2A",
+ },
},
{
- "type": "Feature",
- "geometry": {
- "type": "LineString",
- "coordinates": [
+ type: "Feature",
+ geometry: {
+ type: "LineString",
+ coordinates: [
[9.291121, 48.85261],
[9.293172, 48.851867],
[9.294817, 48.851281],
[9.298633, 48.850979],
- [9.298644, 48.850966]
- ]
- },
- "id": "9e8a0353-84db-475c-a7ad-06c5d0f72ddd",
- "properties": {
- "stroke": "#C93535",
- "gemeinde": "(2:Fellbach,Waiblingen)",
- "variante": "Trasse 2",
- "teilstrecke": 3,
- "baulasttraeger": "Rems-Murr-Kreis",
- "planungsabschnitt": "3C"
- }
+ [9.298644, 48.850966],
+ ],
+ },
+ id: "9e8a0353-84db-475c-a7ad-06c5d0f72ddd",
+ properties: {
+ stroke: "#C93535",
+ gemeinde: "(2:Fellbach,Waiblingen)",
+ variante: "Trasse 2",
+ teilstrecke: 3,
+ baulasttraeger: "Rems-Murr-Kreis",
+ planungsabschnitt: "3C",
+ },
},
{
- "type": "Feature",
- "geometry": {
- "type": "MultiLineString",
- "coordinates": [
+ type: "Feature",
+ geometry: {
+ type: "MultiLineString",
+ coordinates: [
[
[9.274665, 48.869429],
[9.274703, 48.86932],
@@ -483,25 +482,25 @@
[9.284165, 48.863988],
[9.284668, 48.863783],
[9.285767, 48.863323],
- [9.285943, 48.863261]
- ]
- ]
- },
- "id": "cc9ad2e2-d826-4e6a-a0ac-e4470efa0946",
- "properties": {
- "stroke": "#C93535",
- "gemeinde": "(1:Remseck am Neckar)",
- "variante": "Trasse 2",
- "teilstrecke": 2,
- "baulasttraeger": "Kreis Ludwigsburg",
- "planungsabschnitt": "2G"
- }
+ [9.285943, 48.863261],
+ ],
+ ],
+ },
+ id: "cc9ad2e2-d826-4e6a-a0ac-e4470efa0946",
+ properties: {
+ stroke: "#C93535",
+ gemeinde: "(1:Remseck am Neckar)",
+ variante: "Trasse 2",
+ teilstrecke: 2,
+ baulasttraeger: "Kreis Ludwigsburg",
+ planungsabschnitt: "2G",
+ },
},
{
- "type": "Feature",
- "geometry": {
- "type": "MultiLineString",
- "coordinates": [
+ type: "Feature",
+ geometry: {
+ type: "MultiLineString",
+ coordinates: [
[
[9.285943, 48.863261],
[9.286104, 48.863205],
@@ -521,25 +520,25 @@
[9.291541, 48.859801],
[9.29174, 48.859372],
[9.291896, 48.858934],
- [9.29207, 48.858252]
- ]
- ]
- },
- "id": "8a1fdd42-4c5a-4499-a5ce-974913f69b60",
- "properties": {
- "stroke": "#C93535",
- "gemeinde": "(2:Fellbach,Waiblingen)",
- "variante": "Trasse 2",
- "teilstrecke": 3,
- "baulasttraeger": "Rems-Murr-Kreis",
- "planungsabschnitt": "3A"
- }
+ [9.29207, 48.858252],
+ ],
+ ],
+ },
+ id: "8a1fdd42-4c5a-4499-a5ce-974913f69b60",
+ properties: {
+ stroke: "#C93535",
+ gemeinde: "(2:Fellbach,Waiblingen)",
+ variante: "Trasse 2",
+ teilstrecke: 3,
+ baulasttraeger: "Rems-Murr-Kreis",
+ planungsabschnitt: "3A",
+ },
},
{
- "type": "Feature",
- "geometry": {
- "type": "MultiLineString",
- "coordinates": [
+ type: "Feature",
+ geometry: {
+ type: "MultiLineString",
+ coordinates: [
[
[9.304766, 48.835575],
[9.304411, 48.834146],
@@ -566,25 +565,25 @@
[9.302774, 48.829705],
[9.302795, 48.829694],
[9.302817, 48.829685],
- [9.302877, 48.829676]
- ]
- ]
- },
- "id": "54c7093b-189d-4f11-b85d-3fc46575040c",
- "properties": {
- "stroke": "#C93535",
- "gemeinde": "(2:,Waiblingen)",
- "variante": "Trasse 2",
- "teilstrecke": 4,
- "baulasttraeger": "Stadt Waiblingen",
- "planungsabschnitt": "4A"
- }
+ [9.302877, 48.829676],
+ ],
+ ],
+ },
+ id: "54c7093b-189d-4f11-b85d-3fc46575040c",
+ properties: {
+ stroke: "#C93535",
+ gemeinde: "(2:,Waiblingen)",
+ variante: "Trasse 2",
+ teilstrecke: 4,
+ baulasttraeger: "Stadt Waiblingen",
+ planungsabschnitt: "4A",
+ },
},
{
- "type": "Feature",
- "geometry": {
- "type": "LineString",
- "coordinates": [
+ type: "Feature",
+ geometry: {
+ type: "LineString",
+ coordinates: [
[9.302877, 48.829676],
[9.303212, 48.829625],
[9.303391, 48.829587],
@@ -603,24 +602,24 @@
[9.30173, 48.826878],
[9.301643, 48.826861],
[9.301558, 48.826841],
- [9.301474, 48.826817]
- ]
- },
- "id": "82bf2e20-18d2-49eb-a5c9-efa633d8ea32",
- "properties": {
- "stroke": "#C93535",
- "gemeinde": "(2:,Waiblingen)",
- "variante": "Trasse 2",
- "teilstrecke": 4,
- "baulasttraeger": "Stadt Waiblingen",
- "planungsabschnitt": "4B"
- }
+ [9.301474, 48.826817],
+ ],
+ },
+ id: "82bf2e20-18d2-49eb-a5c9-efa633d8ea32",
+ properties: {
+ stroke: "#C93535",
+ gemeinde: "(2:,Waiblingen)",
+ variante: "Trasse 2",
+ teilstrecke: 4,
+ baulasttraeger: "Stadt Waiblingen",
+ planungsabschnitt: "4B",
+ },
},
{
- "type": "Feature",
- "geometry": {
- "type": "MultiLineString",
- "coordinates": [
+ type: "Feature",
+ geometry: {
+ type: "MultiLineString",
+ coordinates: [
[
[9.298644, 48.850966],
[9.29891, 48.85067],
@@ -662,25 +661,25 @@
[9.305165, 48.839757],
[9.305141, 48.83916],
[9.305064, 48.83856],
- [9.305, 48.838441]
- ]
- ]
- },
- "id": "af5c5de7-20aa-4fbd-9bd9-39aeba3b2720",
- "properties": {
- "stroke": "#C93535",
- "gemeinde": "(2:Fellbach,Waiblingen)",
- "variante": "Trasse 2",
- "teilstrecke": 3,
- "baulasttraeger": "Rems-Murr-Kreis",
- "planungsabschnitt": "3D"
- }
+ [9.305, 48.838441],
+ ],
+ ],
+ },
+ id: "af5c5de7-20aa-4fbd-9bd9-39aeba3b2720",
+ properties: {
+ stroke: "#C93535",
+ gemeinde: "(2:Fellbach,Waiblingen)",
+ variante: "Trasse 2",
+ teilstrecke: 3,
+ baulasttraeger: "Rems-Murr-Kreis",
+ planungsabschnitt: "3D",
+ },
},
{
- "type": "Feature",
- "geometry": {
- "type": "MultiLineString",
- "coordinates": [
+ type: "Feature",
+ geometry: {
+ type: "MultiLineString",
+ coordinates: [
[
[9.271868, 48.873704],
[9.271879, 48.873707],
@@ -704,25 +703,25 @@
[9.274517, 48.869772],
[9.27462, 48.869535],
[9.27465, 48.869474],
- [9.274665, 48.869429]
- ]
- ]
- },
- "id": "696da69b-f626-4837-8aa0-cc247e1c73c6",
- "properties": {
- "stroke": "#C93535",
- "gemeinde": "(1:Remseck am Neckar)",
- "variante": "Trasse 2",
- "teilstrecke": 2,
- "baulasttraeger": "Kreis Ludwigsburg",
- "planungsabschnitt": "2F"
- }
+ [9.274665, 48.869429],
+ ],
+ ],
+ },
+ id: "696da69b-f626-4837-8aa0-cc247e1c73c6",
+ properties: {
+ stroke: "#C93535",
+ gemeinde: "(1:Remseck am Neckar)",
+ variante: "Trasse 2",
+ teilstrecke: 2,
+ baulasttraeger: "Kreis Ludwigsburg",
+ planungsabschnitt: "2F",
+ },
},
{
- "type": "Feature",
- "geometry": {
- "type": "MultiLineString",
- "coordinates": [
+ type: "Feature",
+ geometry: {
+ type: "MultiLineString",
+ coordinates: [
[
[9.237415, 48.889563],
[9.237619, 48.889472],
@@ -736,25 +735,25 @@
[9.239682, 48.888117],
[9.239889, 48.8879],
[9.240031, 48.88768],
- [9.240035, 48.887679]
- ]
- ]
- },
- "id": "6b895f43-e6cb-4aa2-a9c0-288dab27bd4c",
- "properties": {
- "stroke": "#C93535",
- "gemeinde": "(1:Ludwigsburg)",
- "variante": "Trasse 2",
- "teilstrecke": "1",
- "baulasttraeger": "Kreis Ludwigsburg",
- "planungsabschnitt": "2B"
- }
+ [9.240035, 48.887679],
+ ],
+ ],
+ },
+ id: "6b895f43-e6cb-4aa2-a9c0-288dab27bd4c",
+ properties: {
+ stroke: "#C93535",
+ gemeinde: "(1:Ludwigsburg)",
+ variante: "Trasse 2",
+ teilstrecke: "1",
+ baulasttraeger: "Kreis Ludwigsburg",
+ planungsabschnitt: "2B",
+ },
},
{
- "type": "Feature",
- "geometry": {
- "type": "MultiLineString",
- "coordinates": [
+ type: "Feature",
+ geometry: {
+ type: "MultiLineString",
+ coordinates: [
[
[9.246941, 48.885563],
[9.250006, 48.884619],
@@ -773,112 +772,110 @@
[9.263889, 48.878882],
[9.264032, 48.87873],
[9.267549, 48.878743],
- [9.267748, 48.878676]
- ]
- ]
- },
- "id": "10689c70-20f2-492b-879d-5ff6c80376d0",
- "properties": {
- "stroke": "#C93535",
- "gemeinde": "(1:Remseck am Neckar)",
- "variante": "Trasse 2",
- "teilstrecke": 2,
- "baulasttraeger": "Kreis Ludwigsburg",
- "planungsabschnitt": "2D"
- }
+ [9.267748, 48.878676],
+ ],
+ ],
+ },
+ id: "10689c70-20f2-492b-879d-5ff6c80376d0",
+ properties: {
+ stroke: "#C93535",
+ gemeinde: "(1:Remseck am Neckar)",
+ variante: "Trasse 2",
+ teilstrecke: 2,
+ baulasttraeger: "Kreis Ludwigsburg",
+ planungsabschnitt: "2D",
+ },
},
{
- "type": "Feature",
- "geometry": {
- "type": "LineString",
- "coordinates": [
+ type: "Feature",
+ geometry: {
+ type: "LineString",
+ coordinates: [
[9.185953, 48.892557],
[9.186506, 48.893118],
- [9.194367, 48.893241]
- ]
- },
- "id": "adc65867-7da3-4015-aab3-af60a859e963",
- "properties": {
- "stroke": "#C93535",
- "gemeinde": "(1:Ludwigsburg)",
- "variante": "Trasse 2",
- "teilstrecke": 1,
- "baulasttraeger": "Stadt Ludwigsburg",
- "planungsabschnitt": "1A"
- }
- }
- ]
- },
- "config": {
- "zoom": 2,
- "bounds": [
- 9.387312714501604, 48.90390202531458, 9.103949029818097, 48.81629635563661
+ [9.194367, 48.893241],
+ ],
+ },
+ id: "adc65867-7da3-4015-aab3-af60a859e963",
+ properties: {
+ stroke: "#C93535",
+ gemeinde: "(1:Ludwigsburg)",
+ variante: "Trasse 2",
+ teilstrecke: 1,
+ baulasttraeger: "Stadt Ludwigsburg",
+ planungsabschnitt: "1A",
+ },
+ },
],
- "longitude": 13.5,
- "latitude": 52.5,
- "boundsPadding": 20
- }
- }
- }
+ },
+ config: {
+ zoom: 2,
+ bounds: [9.387312714501604, 48.90390202531458, 9.103949029818097, 48.81629635563661],
+ longitude: 13.5,
+ latitude: 52.5,
+ boundsPadding: 20,
+ },
+ },
+ },
+ ],
+ buttons: [
+ { label: { de: "Weiter" }, color: "pink", onClick: { action: "nextPage" } },
+ { label: { de: "Zurück" }, color: "white", onClick: { action: "previousPage" } },
],
- "buttons": [
- { "label": { "de": "Weiter" }, "color": "pink", "onClick": { "action": "nextPage" } },
- { "label": { "de": "Zurück" }, "color": "white", "onClick": { "action": "previousPage" } }
- ]
},
{
- "id": 2,
- "title": { "de": "Ihr Hinweis" },
- "description": {
- "de": "Formulieren Sie hier Ihre Gedanken, Ideen, Anregungen oder Wünsche"
+ id: 2,
+ title: { de: "Ihr Hinweis" },
+ description: {
+ de: "Formulieren Sie hier Ihre Gedanken, Ideen, Anregungen oder Wünsche",
},
- "questions": [
+ questions: [
{
- "id": 31,
- "label": { "de": "Kategorie" },
- "component": "custom"
+ id: 31,
+ label: { de: "Kategorie" },
+ component: "custom",
},
{
- "id": 32,
- "label": { "de": "Ausgewählte Stelle" },
- "component": "custom"
+ id: 32,
+ label: { de: "Ausgewählte Stelle" },
+ component: "custom",
},
{
- "id": 33,
- "label": { "de": "Wählen Sie die Stelle für Ihr Feedback" },
- "component": "custom"
+ id: 33,
+ label: { de: "Wählen Sie die Stelle für Ihr Feedback" },
+ component: "custom",
},
{
- "id": 34,
- "label": { "de": "Was gefällt Ihnen hier besonders?" },
- "component": "text",
- "props": {
- "placeholder": { "de": "Beantworten Sie hier..." },
- "caption": { "de": "Max. 2000 Zeichen" }
- }
+ id: 34,
+ label: { de: "Was gefällt Ihnen hier besonders?" },
+ component: "text",
+ props: {
+ placeholder: { de: "Beantworten Sie hier..." },
+ caption: { de: "Max. 2000 Zeichen" },
+ },
},
{
- "id": 35,
- "label": { "de": "Was wünschen Sie sich?" },
- "component": "text",
- "props": {
- "placeholder": { "de": "Beantworten Sie hier..." },
- "caption": { "de": "Max. 2000 Zeichen" }
- }
- }
+ id: 35,
+ label: { de: "Was wünschen Sie sich?" },
+ component: "text",
+ props: {
+ placeholder: { de: "Beantworten Sie hier..." },
+ caption: { de: "Max. 2000 Zeichen" },
+ },
+ },
],
- "buttons": [
+ buttons: [
{
- "label": { "de": "Absenden & Beteiligung abschließen" },
- "color": "pink",
- "onClick": { "action": "submit" }
+ label: { de: "Absenden & Beteiligung abschließen" },
+ color: "pink",
+ onClick: { action: "submit" },
},
{
- "label": { "de": "Absenden & weiteren Hinweis geben" },
- "color": "white",
- "onClick": { "action": "submit" }
- }
- ]
- }
- ]
+ label: { de: "Absenden & weiteren Hinweis geben" },
+ color: "white",
+ onClick: { action: "submit" },
+ },
+ ],
+ },
+ ],
}
diff --git a/src/participation/data/survey.ts b/src/participation/data/survey.ts
index e56bc7fb7..51d6e2d38 100644
--- a/src/participation/data/survey.ts
+++ b/src/participation/data/survey.ts
@@ -1,7 +1,7 @@
import { TSurvey } from "./types"
export const surveyDefinition: TSurvey = {
- id: 1,
+ part: 1,
version: 1,
logoUrl: "https://radschnellweg8-lb-wn.de/logo.png",
canonicalUrl: "https://radschnellweg8-lb-wn.de/beteiligung/",
diff --git a/src/participation/data/types.ts b/src/participation/data/types.ts
index 571873be4..7fe831d7a 100644
--- a/src/participation/data/types.ts
+++ b/src/participation/data/types.ts
@@ -1,5 +1,5 @@
export type TSurvey = {
- id: number
+ part: number
version: number
logoUrl: string
canonicalUrl: string
@@ -11,7 +11,7 @@ export type TPage = {
title: TTranslatableText
description: TTranslatableText
questions?: TQuestion[]
- buttons: TButton[]
+ buttons: TButtonWithAction[]
}
export type TQuestion = {
@@ -21,20 +21,29 @@ export type TQuestion = {
props: TSingleOrMultiResponseProps
}
-export type TButton = {
+export type TButtonWithAction = {
label: TTranslatableText
- color: "white" | "pink" | "blue"
- onClick?: {
+ color: TColor
+ onClick: {
action: "nextPage" | "previousPage" | "submit"
}
}
-export type TTranslatableText = {
+type TButton = {
+ label: TTranslatableText
+ color: TColor
+}
+
+type TColor = "white" | "pink" | "blue"
+
+type TTranslatableText = {
de: string
}
+
export type TSingleOrMultiResponseProps = {
responses: TResponse[]
}
+
export type TResponse = {
id: number
text: TTranslatableText
@@ -46,12 +55,51 @@ export type TEmail = {
questionText: TTranslatableText
description: TTranslatableText
mailjetWidgetUrl: string
- button: TButton[]
+ button: TButton
}
export type TMore = {
title: TTranslatableText
description: TTranslatableText
questionText: TTranslatableText
- buttons: TButton[]
+ buttons: TButtonWithAction[]
+}
+
+type TMapProps = {
+ marker?: {
+ lat: number
+ lng: number
+ }
+ layerStyles?: Record[]
+ projectGeometry?: {
+ type: "FeatureCollection"
+ features: {
+ id?: string
+ type: "Feature"
+ properties: {}
+ geometry: {
+ coordinates: any[]
+ type: "MultiLineString" | "LineString"
+ }
+ }[]
+ }
+ config?: Record
+ placeholder?: TTranslatableText
+ caption?: TTranslatableText
+}
+
+export type TFeedback = {
+ part: number
+ pages: {
+ id: number
+ title: TTranslatableText
+ description: TTranslatableText
+ questions: {
+ id: number
+ label: TTranslatableText
+ component: "singleResponse" | "multipleResponse" | "text" | "map" | "custom"
+ props?: TSingleOrMultiResponseProps | TMapProps
+ }[]
+ buttons: TButtonWithAction[]
+ }[]
}
diff --git a/src/survey-responses/components/feedback/EditableSurveyResponseListItem.tsx b/src/survey-responses/components/feedback/EditableSurveyResponseListItem.tsx
index 9edfa1706..9eb3795d4 100644
--- a/src/survey-responses/components/feedback/EditableSurveyResponseListItem.tsx
+++ b/src/survey-responses/components/feedback/EditableSurveyResponseListItem.tsx
@@ -11,7 +11,7 @@ import getSurveyResponseTopicsByProject from "src/survey-response-topics/queries
import getFeedbackSurveyResponses from "src/survey-responses/queries/getFeedbackSurveyResponses"
import { getSurveyResponseCategoryById } from "src/survey-responses/utils/getSurveyResponseCategoryById"
import { EditableSurveyResponseForm } from "./EditableSurveyResponseForm"
-import feedbackDefinition from "src/participation/data/feedback.json"
+import { feedbackDefinition } from "src/participation/data/feedback"
export type EditableSurveyResponseListItemProps = {
response: Prettify>[number]>
diff --git a/src/survey-responses/utils/getSurveyResponseCategoryById.ts b/src/survey-responses/utils/getSurveyResponseCategoryById.ts
index 62e8caa8c..fe00b4527 100644
--- a/src/survey-responses/utils/getSurveyResponseCategoryById.ts
+++ b/src/survey-responses/utils/getSurveyResponseCategoryById.ts
@@ -1,6 +1,7 @@
-import feedbackDefinition from "src/participation/data/feedback.json"
+import { feedbackDefinition } from "src/participation/data/feedback"
export const getSurveyResponseCategoryById = (id: number) =>
+ // @ts-ignore
feedbackDefinition.pages[0]?.questions
// @ts-ignore
.find((e) => e.id === 21)
From 706fcc6ec840af05116713d501619f57b478eefc Mon Sep 17 00:00:00 2001
From: JohannaPeanut <76495099+JohannaPeanut@users.noreply.github.com>
Date: Tue, 28 Nov 2023 17:39:34 +0100
Subject: [PATCH 010/101] Survey/SurveyResponses: dynamically get survey
questions and response data
---
src/participation-frm7/data/feedback.ts | 12 +---
src/participation/data/feedback.ts | 4 ++
src/participation/data/types.ts | 15 +++--
.../EditableSurveyResponseListItem.tsx | 61 ++++++++++---------
.../EditableSurveyResponseUserText.tsx | 42 +++++++++++++
.../utils/getSurveyResponseCategoryById.ts | 14 ++---
6 files changed, 96 insertions(+), 52 deletions(-)
create mode 100644 src/survey-responses/components/feedback/EditableSurveyResponseUserText.tsx
diff --git a/src/participation-frm7/data/feedback.ts b/src/participation-frm7/data/feedback.ts
index d05765a0e..adb903693 100644
--- a/src/participation-frm7/data/feedback.ts
+++ b/src/participation-frm7/data/feedback.ts
@@ -13,6 +13,7 @@ export const feedbackDefinition: TFeedback = {
{
id: 21,
label: { de: "Zu welchem Thema passt Ihr Feedback?" },
+ evaluationRef: "feedback-category",
component: "singleResponse",
props: {
responses: [
@@ -31,6 +32,7 @@ export const feedbackDefinition: TFeedback = {
de: "Bezieht sich Ihr Feedback auf eine konkrete Stelle entlang der Route?",
},
component: "singleResponse",
+ evaluationRef: "feedback-location",
props: {
responses: [
{ id: 1, text: { de: "Ja" } },
@@ -183,15 +185,7 @@ export const feedbackDefinition: TFeedback = {
{
id: 34,
label: { de: "Was gefällt Ihnen hier besonders?" },
- component: "text",
- props: {
- placeholder: { de: "Beantworten Sie hier..." },
- caption: { de: "Max. 2000 Zeichen" },
- },
- },
- {
- id: 35,
- label: { de: "Was wünschen Sie sich?" },
+ evaluationRef: "feedback-userText",
component: "text",
props: {
placeholder: { de: "Beantworten Sie hier..." },
diff --git a/src/participation/data/feedback.ts b/src/participation/data/feedback.ts
index 3d4a52d4a..a65ec6b23 100644
--- a/src/participation/data/feedback.ts
+++ b/src/participation/data/feedback.ts
@@ -13,6 +13,7 @@ export const feedbackDefinition: TFeedback = {
{
id: 21,
label: { de: "Zu welchem Thema passt Ihr Feedback?" },
+ evaluationRef: "feedback-category",
component: "singleResponse",
props: {
responses: [
@@ -31,6 +32,7 @@ export const feedbackDefinition: TFeedback = {
de: "Bezieht sich Ihr Feedback auf eine konkrete Stelle entlang der Route?",
},
component: "singleResponse",
+ evaluationRef: "feedback-location",
props: {
responses: [
{ id: 1, text: { de: "Ja" } },
@@ -849,6 +851,7 @@ export const feedbackDefinition: TFeedback = {
id: 34,
label: { de: "Was gefällt Ihnen hier besonders?" },
component: "text",
+ evaluationRef: "feedback-userText",
props: {
placeholder: { de: "Beantworten Sie hier..." },
caption: { de: "Max. 2000 Zeichen" },
@@ -858,6 +861,7 @@ export const feedbackDefinition: TFeedback = {
id: 35,
label: { de: "Was wünschen Sie sich?" },
component: "text",
+ evaluationRef: "feedback-userText",
props: {
placeholder: { de: "Beantworten Sie hier..." },
caption: { de: "Max. 2000 Zeichen" },
diff --git a/src/participation/data/types.ts b/src/participation/data/types.ts
index 7fe831d7a..a4b7162e5 100644
--- a/src/participation/data/types.ts
+++ b/src/participation/data/types.ts
@@ -88,18 +88,21 @@ type TMapProps = {
caption?: TTranslatableText
}
+export type TFeedbackQuestion = {
+ evaluationRef?: string
+ id: number
+ label: TTranslatableText
+ component: "singleResponse" | "multipleResponse" | "text" | "map" | "custom"
+ props?: TSingleOrMultiResponseProps | TMapProps
+}
+
export type TFeedback = {
part: number
pages: {
id: number
title: TTranslatableText
description: TTranslatableText
- questions: {
- id: number
- label: TTranslatableText
- component: "singleResponse" | "multipleResponse" | "text" | "map" | "custom"
- props?: TSingleOrMultiResponseProps | TMapProps
- }[]
+ questions: TFeedbackQuestion[]
buttons: TButtonWithAction[]
}[]
}
diff --git a/src/survey-responses/components/feedback/EditableSurveyResponseListItem.tsx b/src/survey-responses/components/feedback/EditableSurveyResponseListItem.tsx
index 9eb3795d4..fb1eb03e6 100644
--- a/src/survey-responses/components/feedback/EditableSurveyResponseListItem.tsx
+++ b/src/survey-responses/components/feedback/EditableSurveyResponseListItem.tsx
@@ -11,6 +11,7 @@ import getSurveyResponseTopicsByProject from "src/survey-response-topics/queries
import getFeedbackSurveyResponses from "src/survey-responses/queries/getFeedbackSurveyResponses"
import { getSurveyResponseCategoryById } from "src/survey-responses/utils/getSurveyResponseCategoryById"
import { EditableSurveyResponseForm } from "./EditableSurveyResponseForm"
+import EditableSurveyResponseUserText from "./EditableSurveyResponseUserText"
import { feedbackDefinition } from "src/participation/data/feedback"
export type EditableSurveyResponseListItemProps = {
@@ -44,17 +45,32 @@ const EditableSurveyResponseListItem: React.FC question.evaluationRef === "feedback-userText")
+ .map((question) => question.id)
+
+ // @ts-expect-error `data` is of type unkown
+ const userTextPreview = response.data[Boolean(userTextIndices.length) && userTextIndices[0]]
+
+ const feedbackUserCategoryQuestion = feedbackQuestions.find(
+ (question) => question.evaluationRef === "feedback-category",
+ )
+
+ const feedbackUserCategory =
// @ts-expect-error `data` is of type unkown
- response.data["21"] && getSurveyResponseCategoryById(Number(response.data["21"]))
+ response.data[feedbackUserCategoryQuestion.id] &&
+ feedbackUserCategoryQuestion?.id &&
+ getSurveyResponseCategoryById(
+ // @ts-expect-error `data` is of type unkown
+ Number(response.data[feedbackUserCategoryQuestion.id]),
+ feedbackUserCategoryQuestion,
+ )
return (
@@ -77,7 +93,7 @@ const EditableSurveyResponseListItem: React.FC{operatorSlugWitFallback}
-
+
{open ? (
@@ -90,28 +106,15 @@ const EditableSurveyResponseListItem: React.FC
-
-
-
- {/* @ts-expect-error `data` is of type unkown */}
- {response.data["34"]
- ? "Was gefällt Ihnen hier besonders?"
- : "Was wünschen Sie sich?"}
-
-
-
- {userAdditionalText && (
-
- Was wünschen Sie sich?
-
-
- )}
- {`Bürgerbeitrag vom: ${response.surveySession.createdAt.toLocaleDateString()} um ${response.surveySession.createdAt.toLocaleTimeString()}`}
-
+
Kategorie
- {userCategory}
+ {feedbackUserCategory}
diff --git a/src/survey-responses/components/feedback/EditableSurveyResponseUserText.tsx b/src/survey-responses/components/feedback/EditableSurveyResponseUserText.tsx
new file mode 100644
index 000000000..c80876316
--- /dev/null
+++ b/src/survey-responses/components/feedback/EditableSurveyResponseUserText.tsx
@@ -0,0 +1,42 @@
+import clsx from "clsx"
+import { Markdown } from "src/core/components/Markdown/Markdown"
+import { Prettify } from "src/core/types"
+import { TFeedback, TFeedbackQuestion } from "src/participation/data/types"
+
+import getFeedbackSurveyResponses from "src/survey-responses/queries/getFeedbackSurveyResponses"
+
+export type EditableSurveyResponseUserTextProps = {
+ feedbackQuestions: TFeedbackQuestion[]
+ response: Prettify>[number]>
+ userTextIndices: Array
+}
+
+const EditableSurveyResponseUserText: React.FC = ({
+ response,
+ feedbackQuestions,
+ userTextIndices,
+}) => {
+ return (
+
+ {userTextIndices.map((userTextIndex) => {
+ /* @ts-expect-error `data` is of type unkown */
+ if (!response.data[userTextIndex]) return null
+ return (
+
+
+ {feedbackQuestions.find((q) => q.id === userTextIndex)?.label.de}
+
+ {/* @ts-expect-error `data` is of type unkown */}
+
+
+ )
+ })}
+ {`Bürgerbeitrag vom: ${response.surveySession.createdAt.toLocaleDateString()} um ${response.surveySession.createdAt.toLocaleTimeString()}`}
+
+ )
+}
+
+export default EditableSurveyResponseUserText
diff --git a/src/survey-responses/utils/getSurveyResponseCategoryById.ts b/src/survey-responses/utils/getSurveyResponseCategoryById.ts
index fe00b4527..c76da70a9 100644
--- a/src/survey-responses/utils/getSurveyResponseCategoryById.ts
+++ b/src/survey-responses/utils/getSurveyResponseCategoryById.ts
@@ -1,9 +1,7 @@
-import { feedbackDefinition } from "src/participation/data/feedback"
+import { TFeedbackQuestion, TResponse } from "src/participation/data/types"
-export const getSurveyResponseCategoryById = (id: number) =>
- // @ts-ignore
- feedbackDefinition.pages[0]?.questions
- // @ts-ignore
- .find((e) => e.id === 21)
- // @ts-ignore
- .props.responses.find((r) => r.id === id).text.de
+export const getSurveyResponseCategoryById = (
+ id: number,
+ feedbackUserCategoryQuestion: TFeedbackQuestion,
+ // @ts-expect-error
+) => feedbackUserCategoryQuestion?.props?.responses.find((r: TResponse) => r.id === id).text.de
From f3d7bfda7f72754414aadc2dd62c18b1277f7c78 Mon Sep 17 00:00:00 2001
From: JohannaPeanut <76495099+JohannaPeanut@users.noreply.github.com>
Date: Wed, 29 Nov 2023 11:55:57 +0100
Subject: [PATCH 011/101] Survey: reorder, rename folders and files
participation-->survey, clean up
---
src/core/layouts/Layout.tsx | 5 +-
.../surveys/[surveyId]/index.tsx | 4 +-
src/pages/api/survey/[surveyId]/questions.ts | 6 +-
src/pages/api/survey/[surveyId]/responses.ts | 6 +-
src/pages/api/survey/[surveyId]/results.ts | 4 +-
src/pages/beteiligung/[surveySlug]/index.tsx | 31 +++++---
src/pages/survey-sessions/index.tsx | 4 +-
src/participation-frm7/components/Done.tsx | 22 ------
.../feedback/FeedbackSecondPage.tsx | 72 -------------------
.../components/frm7-inactive.tsx | 24 -------
src/participation-frm7/data/README.md | 23 ------
src/participation/components/Done.tsx | 21 ------
src/participation/components/core/More.tsx | 31 --------
.../form/ParticipationLabeledCheckbox.tsx | 69 ------------------
.../ParticipationLabeledCheckboxGroup.tsx | 21 ------
.../form/ParticipationLabeledRadiobutton.tsx | 70 ------------------
.../ParticipationLabeledRadiobuttonGroup.tsx | 21 ------
.../feedback/FeedbackSecondPage.tsx | 66 -----------------
src/participation/components/rs8-inactive.tsx | 23 ------
src/participation/data/README.md | 23 ------
src/survey-public/components/Done.tsx | 16 +++++
.../components}/Email.tsx | 16 ++---
src/survey-public/components/More.tsx | 31 ++++++++
.../components}/Page.tsx | 16 ++---
.../components}/Question.tsx | 18 ++---
.../components/SurveyFRM7.tsx} | 57 ++++++---------
.../components/SurveyInactivePage.tsx | 22 ++++++
.../components/SurveyMainPage.tsx | 42 +++++++++++
.../components/SurveyRS8.tsx} | 56 ++++++---------
.../components}/context/contexts.ts | 0
.../components/core/Debug.tsx | 0
.../components/core/Text.tsx | 8 +--
.../components/core/buttons/SurveyButton.tsx} | 11 +--
.../core/buttons/SurveyButtonWithAction.tsx} | 23 ++----
.../core/buttons/SurveyButtonWrapper.tsx} | 2 +-
.../core/form/PublicSurveyForm.tsx} | 4 +-
.../core/form/SurveyLabeledCheckbox.tsx | 67 +++++++++++++++++
.../core/form/SurveyLabeledCheckboxGroup.tsx | 18 +++++
.../core/form/SurveyLabeledRadiobutton.tsx | 69 ++++++++++++++++++
.../form/SurveyLabeledRadiobuttonGroup.tsx | 18 +++++
.../core/form/SurveyLabeledTextField.tsx} | 2 +-
.../core/form/SurveyLabeledTextareaField.tsx} | 6 +-
.../components/core/layout/ProgressBar.tsx | 2 +-
.../core/layout/SurveyContainer.tsx} | 2 +-
.../components/core/layout/SurveyFooter.tsx} | 2 +-
.../components/core/layout/SurveyHeader.tsx} | 10 +--
.../components/core/layout/SurveyLayout.tsx} | 14 ++--
.../core/layout/SurveyScreenHeader.tsx} | 8 +--
.../core/layout/SurveySpinnerLayover.tsx} | 2 +-
.../components/core/links/SurveyLink.tsx} | 55 +++++++-------
.../components/core/links/styles.ts | 11 ++-
.../maps/SurveyBackgroundSwitcher.tsx} | 6 +-
.../components/maps/SurveyMap.tsx} | 18 ++---
.../components/maps/SurveyMapBanner.tsx} | 2 +-
.../components/maps/SurveyPin.tsx} | 4 +-
.../components/maps/SurveyStaticMap.tsx} | 6 +-
.../components/maps/SurveyStaticPin.tsx} | 4 +-
.../components}/types.ts | 2 +
.../components}/utils/scrollToTopWithDelay.ts | 0
src/survey-public/frm7/components/Done.tsx | 19 +++++
.../frm7}/components/Survey.tsx | 19 +++--
.../frm7}/components/feedback/Feedback.tsx | 17 ++---
.../components/feedback/FeedbackFirstPage.tsx | 22 +++---
.../feedback/FeedbackSecondPage.tsx | 68 ++++++++++++++++++
.../frm7}/data/email.ts | 2 +-
.../frm7}/data/feedback.ts | 2 +-
.../frm7}/data/feedback_legacy.json | 0
.../frm7}/data/more.ts | 2 +-
src/survey-public/frm7/data/progress.ts | 11 +++
.../frm7}/data/survey.ts | 2 +-
.../rs8}/components/Survey.tsx | 18 ++---
.../rs8}/components/feedback/Feedback.tsx | 13 ++--
.../components/feedback/FeedbackFirstPage.tsx | 22 +++---
.../feedback/FeedbackSecondPage.tsx | 67 +++++++++++++++++
.../rs8}/data/email.ts | 2 +-
.../rs8}/data/feedback.ts | 2 +-
.../rs8}/data/more.ts | 2 +-
src/survey-public/rs8/data/progress.ts | 11 +++
.../rs8}/data/survey.ts | 2 +-
.../EditableSurveyResponseListItem.tsx | 2 +-
.../EditableSurveyResponseUserText.tsx | 2 +-
.../utils/getSurveyResponseCategoryById.ts | 2 +-
82 files changed, 722 insertions(+), 783 deletions(-)
delete mode 100644 src/participation-frm7/components/Done.tsx
delete mode 100644 src/participation-frm7/components/feedback/FeedbackSecondPage.tsx
delete mode 100644 src/participation-frm7/components/frm7-inactive.tsx
delete mode 100644 src/participation-frm7/data/README.md
delete mode 100644 src/participation/components/Done.tsx
delete mode 100644 src/participation/components/core/More.tsx
delete mode 100644 src/participation/components/core/form/ParticipationLabeledCheckbox.tsx
delete mode 100644 src/participation/components/core/form/ParticipationLabeledCheckboxGroup.tsx
delete mode 100644 src/participation/components/core/form/ParticipationLabeledRadiobutton.tsx
delete mode 100644 src/participation/components/core/form/ParticipationLabeledRadiobuttonGroup.tsx
delete mode 100644 src/participation/components/feedback/FeedbackSecondPage.tsx
delete mode 100644 src/participation/components/rs8-inactive.tsx
delete mode 100644 src/participation/data/README.md
create mode 100644 src/survey-public/components/Done.tsx
rename src/{participation/components/core => survey-public/components}/Email.tsx (66%)
create mode 100644 src/survey-public/components/More.tsx
rename src/{participation/components/core => survey-public/components}/Page.tsx (64%)
rename src/{participation/components/core => survey-public/components}/Question.tsx (72%)
rename src/{participation-frm7/components/frm7.tsx => survey-public/components/SurveyFRM7.tsx} (75%)
create mode 100644 src/survey-public/components/SurveyInactivePage.tsx
create mode 100644 src/survey-public/components/SurveyMainPage.tsx
rename src/{participation/components/rs8.tsx => survey-public/components/SurveyRS8.tsx} (74%)
rename src/{participation => survey-public/components}/context/contexts.ts (100%)
rename src/{participation => survey-public}/components/core/Debug.tsx (100%)
rename src/{participation => survey-public}/components/core/Text.tsx (68%)
rename src/{participation/components/core/buttons/ParticipationButton.tsx => survey-public/components/core/buttons/SurveyButton.tsx} (57%)
rename src/{participation/components/core/buttons/ParticipationButtonWithAction.tsx => survey-public/components/core/buttons/SurveyButtonWithAction.tsx} (52%)
rename src/{participation/components/core/buttons/ParticipationButtonWrapper.tsx => survey-public/components/core/buttons/SurveyButtonWrapper.tsx} (73%)
rename src/{participation/components/core/form/SurveyForm.tsx => survey-public/components/core/form/PublicSurveyForm.tsx} (94%)
create mode 100644 src/survey-public/components/core/form/SurveyLabeledCheckbox.tsx
create mode 100644 src/survey-public/components/core/form/SurveyLabeledCheckboxGroup.tsx
create mode 100644 src/survey-public/components/core/form/SurveyLabeledRadiobutton.tsx
create mode 100644 src/survey-public/components/core/form/SurveyLabeledRadiobuttonGroup.tsx
rename src/{participation/components/core/form/ParticipationLabeledTextField.tsx => survey-public/components/core/form/SurveyLabeledTextField.tsx} (96%)
rename src/{participation/components/core/form/ParticipationLabeledTextareaField.tsx => survey-public/components/core/form/SurveyLabeledTextareaField.tsx} (92%)
rename src/{participation => survey-public}/components/core/layout/ProgressBar.tsx (86%)
rename src/{participation/components/core/layout/ContainerParticipation.tsx => survey-public/components/core/layout/SurveyContainer.tsx} (68%)
rename src/{participation/components/core/layout/FooterParticipation.tsx => survey-public/components/core/layout/SurveyFooter.tsx} (89%)
rename src/{participation/components/core/layout/HeaderParticipation.tsx => survey-public/components/core/layout/SurveyHeader.tsx} (70%)
rename src/{participation/components/core/layout/LayoutParticipation.tsx => survey-public/components/core/layout/SurveyLayout.tsx} (67%)
rename src/{participation/components/core/layout/ScreenHeaderParticipation.tsx => survey-public/components/core/layout/SurveyScreenHeader.tsx} (57%)
rename src/{participation/components/core/ParticipationSpinnerLayover.tsx => survey-public/components/core/layout/SurveySpinnerLayover.tsx} (96%)
rename src/{participation/components/core/links/ParticipationLink.tsx => survey-public/components/core/links/SurveyLink.tsx} (50%)
rename src/{participation => survey-public}/components/core/links/styles.ts (88%)
rename src/{participation/components/maps/ParticipationBackgroundSwitcher.tsx => survey-public/components/maps/SurveyBackgroundSwitcher.tsx} (96%)
rename src/{participation/components/maps/ParticipationMap.tsx => survey-public/components/maps/SurveyMap.tsx} (90%)
rename src/{participation/components/maps/MapBanner.tsx => survey-public/components/maps/SurveyMapBanner.tsx} (89%)
rename src/{participation/components/maps/Pin.tsx => survey-public/components/maps/SurveyPin.tsx} (92%)
rename src/{participation/components/maps/ParticipationStaticMap.tsx => survey-public/components/maps/SurveyStaticMap.tsx} (92%)
rename src/{participation/components/maps/StaticPin.tsx => survey-public/components/maps/SurveyStaticPin.tsx} (91%)
rename src/{participation/data => survey-public/components}/types.ts (95%)
rename src/{participation => survey-public/components}/utils/scrollToTopWithDelay.ts (100%)
create mode 100644 src/survey-public/frm7/components/Done.tsx
rename src/{participation-frm7 => survey-public/frm7}/components/Survey.tsx (83%)
rename src/{participation-frm7 => survey-public/frm7}/components/feedback/Feedback.tsx (89%)
rename src/{participation-frm7 => survey-public/frm7}/components/feedback/FeedbackFirstPage.tsx (57%)
create mode 100644 src/survey-public/frm7/components/feedback/FeedbackSecondPage.tsx
rename src/{participation-frm7 => survey-public/frm7}/data/email.ts (92%)
rename src/{participation-frm7 => survey-public/frm7}/data/feedback.ts (99%)
rename src/{participation-frm7 => survey-public/frm7}/data/feedback_legacy.json (100%)
rename src/{participation-frm7 => survey-public/frm7}/data/more.ts (92%)
create mode 100644 src/survey-public/frm7/data/progress.ts
rename src/{participation-frm7 => survey-public/frm7}/data/survey.ts (98%)
rename src/{participation => survey-public/rs8}/components/Survey.tsx (84%)
rename src/{participation => survey-public/rs8}/components/feedback/Feedback.tsx (91%)
rename src/{participation => survey-public/rs8}/components/feedback/FeedbackFirstPage.tsx (62%)
create mode 100644 src/survey-public/rs8/components/feedback/FeedbackSecondPage.tsx
rename src/{participation => survey-public/rs8}/data/email.ts (93%)
rename src/{participation => survey-public/rs8}/data/feedback.ts (99%)
rename src/{participation => survey-public/rs8}/data/more.ts (94%)
create mode 100644 src/survey-public/rs8/data/progress.ts
rename src/{participation => survey-public/rs8}/data/survey.ts (99%)
diff --git a/src/core/layouts/Layout.tsx b/src/core/layouts/Layout.tsx
index 3bcafa274..23402d179 100644
--- a/src/core/layouts/Layout.tsx
+++ b/src/core/layouts/Layout.tsx
@@ -7,9 +7,8 @@ import { NavigationGeneral, NavigationProject } from "./Navigation"
import { TailwindResponsiveHelper } from "./TailwindResponsiveHelper/TailwindResponsiveHelper"
type Props = {
- navigation: "general" | "project" | "none" | "participation"
- footer: "general" | "project" | "minimal" | "participation"
- fullWidth?: boolean
+ navigation: "general" | "project" | "none"
+ footer: "general" | "project" | "minimal"
children?: React.ReactNode
}
diff --git a/src/pages/[projectSlug]/surveys/[surveyId]/index.tsx b/src/pages/[projectSlug]/surveys/[surveyId]/index.tsx
index db064145d..b544a469d 100644
--- a/src/pages/[projectSlug]/surveys/[surveyId]/index.tsx
+++ b/src/pages/[projectSlug]/surveys/[surveyId]/index.tsx
@@ -10,8 +10,8 @@ import { PageHeader } from "src/core/components/pages/PageHeader"
import { H2 } from "src/core/components/text"
import { useSlugs } from "src/core/hooks"
import { LayoutRs, MetaTags } from "src/core/layouts"
-import { surveyDefinition } from "src/participation/data/survey"
-import { TSurvey } from "src/participation/data/types"
+import { surveyDefinition } from "src/survey-public/rs8/data/survey"
+import { TSurvey } from "src/survey-public/components/types"
import { GroupedSurveyResponseItem } from "src/survey-responses/components/analysis/GroupedSurveyResponseItem"
import getGroupedSurveyResponses from "src/survey-responses/queries/getGroupedSurveyResponses"
import { getFormatDistanceInDays } from "src/survey-responses/utils/getFormatDistanceInDays"
diff --git a/src/pages/api/survey/[surveyId]/questions.ts b/src/pages/api/survey/[surveyId]/questions.ts
index 311ed252f..3f8194b06 100644
--- a/src/pages/api/survey/[surveyId]/questions.ts
+++ b/src/pages/api/survey/[surveyId]/questions.ts
@@ -1,7 +1,7 @@
import { NextApiRequest, NextApiResponse } from "next"
-import { surveyDefinition } from "src/participation/data/survey"
-import { feedbackDefinition } from "src/participation/data/feedback"
-import { TSurvey } from "src/participation/data/types"
+import { surveyDefinition } from "src/survey-public/rs8/data/survey"
+import { feedbackDefinition } from "src/survey-public/rs8/data/feedback"
+import { TSurvey } from "src/survey-public/components/types"
import { getSurvey, sendCsv } from "./_shared"
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
diff --git a/src/pages/api/survey/[surveyId]/responses.ts b/src/pages/api/survey/[surveyId]/responses.ts
index fdefad4cc..60b84759f 100644
--- a/src/pages/api/survey/[surveyId]/responses.ts
+++ b/src/pages/api/survey/[surveyId]/responses.ts
@@ -1,7 +1,7 @@
import { NextApiRequest, NextApiResponse } from "next"
-import { surveyDefinition } from "src/participation/data/survey"
-import { feedbackDefinition } from "src/participation/data/feedback"
-import { TSurvey } from "src/participation/data/types"
+import { surveyDefinition } from "src/survey-public/rs8/data/survey"
+import { feedbackDefinition } from "src/survey-public/rs8/data/feedback"
+import { TSurvey } from "src/survey-public/components/types"
import { getSurvey, sendCsv } from "./_shared"
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
diff --git a/src/pages/api/survey/[surveyId]/results.ts b/src/pages/api/survey/[surveyId]/results.ts
index 826da5faa..b49585cc9 100644
--- a/src/pages/api/survey/[surveyId]/results.ts
+++ b/src/pages/api/survey/[surveyId]/results.ts
@@ -1,7 +1,7 @@
import { NextApiRequest, NextApiResponse } from "next"
import db from "db"
-import { surveyDefinition } from "src/participation/data/survey"
-import { feedbackDefinition } from "src/participation/data/feedback"
+import { surveyDefinition } from "src/survey-public/rs8/data/survey"
+import { feedbackDefinition } from "src/survey-public/rs8/data/feedback"
import { getSurvey, sendCsv } from "./_shared"
const surveys = Object.fromEntries([surveyDefinition, feedbackDefinition].map((o) => [o.part, o]))
diff --git a/src/pages/beteiligung/[surveySlug]/index.tsx b/src/pages/beteiligung/[surveySlug]/index.tsx
index a560d99a5..735a0c011 100644
--- a/src/pages/beteiligung/[surveySlug]/index.tsx
+++ b/src/pages/beteiligung/[surveySlug]/index.tsx
@@ -1,29 +1,40 @@
+import { BlitzPage } from "@blitzjs/auth"
import { useParam } from "@blitzjs/next"
import { useQuery } from "@blitzjs/rpc"
import { Suspense } from "react"
import { Spinner } from "src/core/components/Spinner"
+import SurveyFRM7 from "src/survey-public/components/SurveyFRM7"
+
+import { surveyDefinition as surveyDefinitionRS8 } from "src/survey-public/rs8/data/survey"
+import { surveyDefinition as surveyDefinitionFRM7 } from "src/survey-public/frm7/data/survey"
+
+import SurveyInactivePage from "src/survey-public/components/SurveyInactivePage"
+import { SurveyRS8 } from "src/survey-public/components/SurveyRS8"
import getPublicSurveyBySlug from "src/surveys/queries/getPublicSurveyBySlug"
-import ParticipationMainPage from "src/participation/components/rs8"
-import ParticipationInactivePage from "src/participation/components/rs8-inactive"
-import ParticipationFrm7MainPage from "src/participation-frm7/components/frm7"
-import ParticipationFrm7InactivePage from "src/participation-frm7/components/frm7-inactive"
-export const Survey = () => {
+const PublicSurveyPageWithQuery = () => {
const surveySlug = useParam("surveySlug", "string")
const [survey] = useQuery(getPublicSurveyBySlug, { slug: surveySlug! })
// only returns something if there is a 'Survey' in the DB with the slug (url params) and the slug is either rs8 or frm7
if (!survey) return null
if (surveySlug === "rs8")
- return survey.active ? :
+ return survey.active ? (
+
+ ) : (
+
+ )
if (surveySlug === "frm7")
- return survey.active ? :
+ return survey.active ? (
+
+ ) : (
+
+ )
return null
}
-
-const PublicSurveyPage = () => {
+const PublicSurveyPage: BlitzPage = () => {
return (
}>
-
+
)
}
diff --git a/src/pages/survey-sessions/index.tsx b/src/pages/survey-sessions/index.tsx
index 613b00af8..5b2ca5f4f 100644
--- a/src/pages/survey-sessions/index.tsx
+++ b/src/pages/survey-sessions/index.tsx
@@ -8,8 +8,8 @@ import { Pagination } from "src/core/components/Pagination"
import { Spinner } from "src/core/components/Spinner"
import { Link } from "src/core/components/links"
import { LayoutArticle, MetaTags } from "src/core/layouts"
-import { feedbackDefinition } from "src/participation/data/feedback"
-import { surveyDefinition } from "src/participation/data/survey"
+import { feedbackDefinition } from "src/survey-public/rs8/data/feedback"
+import { surveyDefinition } from "src/survey-public/rs8/data/survey"
import getSurveySessionsWithResponses from "src/survey-sessions/queries/getSurveySessionsWithResponses"
const surveys = Object.fromEntries([surveyDefinition, feedbackDefinition].map((o) => [o.part, o]))
diff --git a/src/participation-frm7/components/Done.tsx b/src/participation-frm7/components/Done.tsx
deleted file mode 100644
index 6c919e77c..000000000
--- a/src/participation-frm7/components/Done.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-export { FORM_ERROR } from "src/core/components/forms"
-
-import { ParticipationLink } from "src/participation/components/core/links/ParticipationLink"
-import { ScreenHeaderParticipation } from "src/participation/components/core/layout/ScreenHeaderParticipation"
-
-export const Done = () => {
- return (
-
-
-
- Zurück Startseite
-
-
- )
-}
diff --git a/src/participation-frm7/components/feedback/FeedbackSecondPage.tsx b/src/participation-frm7/components/feedback/FeedbackSecondPage.tsx
deleted file mode 100644
index 7cbbbf78b..000000000
--- a/src/participation-frm7/components/feedback/FeedbackSecondPage.tsx
+++ /dev/null
@@ -1,72 +0,0 @@
-import { useContext } from "react"
-
-import { MultiLineString } from "@turf/helpers"
-
-import {
- ParticipationH2,
- ParticipationH3,
- ParticipationP,
-} from "src/participation/components/core/Text"
-import { ParticipationButton } from "src/participation/components/core/buttons/ParticipationButton"
-import { ParticipationButtonWrapper } from "src/participation/components/core/buttons/ParticipationButtonWrapper"
-import { PinContext } from "src/participation/context/contexts"
-import { ScreenHeaderParticipation } from "src/participation/components/core/layout/ScreenHeaderParticipation"
-import { ParticipationStaticMap } from "src/participation/components/maps/ParticipationStaticMap"
-import { Question } from "src/participation/components/core/Question"
-
-export { FORM_ERROR } from "src/core/components/forms"
-
-type Props = {
- page: any // TODO
- onButtonClick: any // TODO
- staticMapProps: {
- projectGeometry: MultiLineString
- layerStyles: Record
- }
- feedbackCategory: string
- isCompleted: boolean
-}
-
-export const FeedbackSecondPage: React.FC = ({
- page,
- isCompleted,
- onButtonClick,
- staticMapProps,
- feedbackCategory,
-}) => {
- const { pinPosition } = useContext(PinContext)
- const { title, description, questions, buttons } = page
-
- const textAreaQuestions = questions.filter((q: Record) => q.component === "text")
-
- return (
- <>
-
- {questions[0].label.de}
- {feedbackCategory}
-
- {pinPosition && (
- <>
- {questions[1].label.de}
-
- >
- )}
-
-
-
-
-
-
-
- {buttons[0].label.de}
-
-
- {buttons[1].label.de}
-
-
-
- Zurück
-
- >
- )
-}
diff --git a/src/participation-frm7/components/frm7-inactive.tsx b/src/participation-frm7/components/frm7-inactive.tsx
deleted file mode 100644
index 470d46c3b..000000000
--- a/src/participation-frm7/components/frm7-inactive.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import { BlitzPage } from "@blitzjs/next"
-import { LayoutParticipation } from "src/participation/components/core/layout/LayoutParticipation"
-import { surveyDefinition } from "src/participation-frm7/data/survey"
-
-import { ParticipationLink } from "src/participation/components/core/links/ParticipationLink"
-import { ScreenHeaderParticipation } from "src/participation/components/core/layout/ScreenHeaderParticipation"
-
-const ParticipationFrm7InactivePage: BlitzPage = () => {
- return (
-
-
-
-
- Zur Projektwebseite
-
-
-
- )
-}
-
-export default ParticipationFrm7InactivePage
diff --git a/src/participation-frm7/data/README.md b/src/participation-frm7/data/README.md
deleted file mode 100644
index 928bad13d..000000000
--- a/src/participation-frm7/data/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-## How to generate type definitions from the json schema
-
-1. Install [jq](https://stedolan.github.io/jq/)
- - Linux:
-
- curl https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 -o ~/bin/jq
- chmod u+x ~/bin/jq
-
- - OS X with Homebrew:
-
- brew install jq
-
-2. Install [json2ts](https://github.com/bcherny/json-schema-to-typescript)
-
- npm install -global json-schema-to-typescript
-
-3. Generate type definitions
-
- DIR=src/participation/data
- cat $DIR/schema.json |
- jq 'delpaths([["properties", "pages", "items", "properties", "questions", "items", "allOf"]])' |
- json2ts > $DIR/types.ts
- npx prettier $DIR/types.ts --write
diff --git a/src/participation/components/Done.tsx b/src/participation/components/Done.tsx
deleted file mode 100644
index 6567e52c2..000000000
--- a/src/participation/components/Done.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-export { FORM_ERROR } from "src/core/components/forms"
-import { ParticipationLink } from "./core/links/ParticipationLink"
-import { ScreenHeaderParticipation } from "./core/layout/ScreenHeaderParticipation"
-
-export const Done = () => {
- return (
-
-
-
- Zurück Startseite
-
-
- )
-}
diff --git a/src/participation/components/core/More.tsx b/src/participation/components/core/More.tsx
deleted file mode 100644
index deddc3e53..000000000
--- a/src/participation/components/core/More.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { ParticipationH2 } from "./Text"
-import { ParticipationButton } from "./buttons/ParticipationButton"
-import { ParticipationButtonWrapper } from "./buttons/ParticipationButtonWrapper"
-import { ScreenHeaderParticipation } from "./layout/ScreenHeaderParticipation"
-
-export { FORM_ERROR } from "src/core/components/forms"
-
-type Props = {
- onClickMore: any
- onClickFinish: any
- more: any // TODO
-}
-
-export const More: React.FC = ({ more, onClickMore, onClickFinish }) => {
- const { title, description, questionText, buttons } = more
-
- return (
- <>
-
- {questionText.de}
-
-
- {buttons[0].label.de}
-
-
- {buttons[1].label.de}
-
-
- >
- )
-}
diff --git a/src/participation/components/core/form/ParticipationLabeledCheckbox.tsx b/src/participation/components/core/form/ParticipationLabeledCheckbox.tsx
deleted file mode 100644
index 4f236a3f3..000000000
--- a/src/participation/components/core/form/ParticipationLabeledCheckbox.tsx
+++ /dev/null
@@ -1,69 +0,0 @@
-import { ErrorMessage } from "@hookform/error-message"
-import clsx from "clsx"
-import { ComponentPropsWithoutRef, forwardRef, PropsWithoutRef, ReactNode } from "react"
-import { useFormContext } from "react-hook-form"
-
-export interface TParticipationLabeledCheckbox
- extends PropsWithoutRef {
- /** Field name. */
- name: string
- /** Field label. */
- label: string | ReactNode
- /** Help text below field label. */
- help?: string
- outerProps?: PropsWithoutRef
- labelProps?: ComponentPropsWithoutRef<"label">
-}
-
-export const ParticipationLabeledCheckbox = forwardRef<
- HTMLInputElement,
- TParticipationLabeledCheckbox
->(({ name, label, help, outerProps, labelProps, ...props }, ref) => {
- const {
- register,
- formState: { isSubmitting, errors },
- } = useFormContext()
-
- const hasError = Boolean(errors[name])
-
- return (
-
-
-
-
-
-
- )
-})
diff --git a/src/participation/components/core/form/ParticipationLabeledCheckboxGroup.tsx b/src/participation/components/core/form/ParticipationLabeledCheckboxGroup.tsx
deleted file mode 100644
index f0de88cf9..000000000
--- a/src/participation/components/core/form/ParticipationLabeledCheckboxGroup.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import clsx from "clsx"
-import React from "react"
-import {
- ParticipationLabeledCheckbox,
- TParticipationLabeledCheckbox,
-} from "./ParticipationLabeledCheckbox"
-
-type Props = {
- items: TParticipationLabeledCheckbox[]
- className?: string
-}
-
-export const ParticipationLabeledCheckboxGroup: React.FC = ({ items, className }) => {
- return (
-
- {items.map((item, index) => {
- return
- })}
-
- )
-}
diff --git a/src/participation/components/core/form/ParticipationLabeledRadiobutton.tsx b/src/participation/components/core/form/ParticipationLabeledRadiobutton.tsx
deleted file mode 100644
index b06677204..000000000
--- a/src/participation/components/core/form/ParticipationLabeledRadiobutton.tsx
+++ /dev/null
@@ -1,70 +0,0 @@
-import { ErrorMessage } from "@hookform/error-message"
-import clsx from "clsx"
-import { ComponentPropsWithoutRef, forwardRef, PropsWithoutRef } from "react"
-import { useFormContext } from "react-hook-form"
-
-export interface ParticipationLabeledRadiobuttonProps
- extends PropsWithoutRef {
- /** Radiobutton scope. */
- scope: string
- /** Field name. */
- name: string
- /** Field label. */
- label: string
- /** Field value. */
- value: string
- /** Help text below field label. */
- help?: string
- outerProps?: PropsWithoutRef
- labelProps?: ComponentPropsWithoutRef<"label">
-}
-
-export const ParticipationLabeledRadiobutton = forwardRef<
- HTMLInputElement,
- ParticipationLabeledRadiobuttonProps
->(({ scope, name, label, value, help, outerProps, labelProps, ...props }, ref) => {
- const {
- register,
- formState: { isSubmitting, errors },
- } = useFormContext()
-
- const hasError = Boolean(errors[name])
-
- return (
-
-
-
-
-
-
- )
-})
diff --git a/src/participation/components/core/form/ParticipationLabeledRadiobuttonGroup.tsx b/src/participation/components/core/form/ParticipationLabeledRadiobuttonGroup.tsx
deleted file mode 100644
index b5074f0ff..000000000
--- a/src/participation/components/core/form/ParticipationLabeledRadiobuttonGroup.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import clsx from "clsx"
-import React from "react"
-import {
- ParticipationLabeledRadiobutton,
- ParticipationLabeledRadiobuttonProps,
-} from "./ParticipationLabeledRadiobutton"
-
-type Props = {
- items: ParticipationLabeledRadiobuttonProps[]
- className?: string
-}
-
-export const ParticipationLabeledRadiobuttonGroup: React.FC = ({ items, className }) => {
- return (
-
- {items.map((item) => {
- return
- })}
-
- )
-}
diff --git a/src/participation/components/feedback/FeedbackSecondPage.tsx b/src/participation/components/feedback/FeedbackSecondPage.tsx
deleted file mode 100644
index 2aba4ddcc..000000000
--- a/src/participation/components/feedback/FeedbackSecondPage.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-import { useContext } from "react"
-import { PinContext } from "src/participation/context/contexts"
-import { ParticipationButton } from "../core/buttons/ParticipationButton"
-import { ParticipationButtonWrapper } from "../core/buttons/ParticipationButtonWrapper"
-import { ScreenHeaderParticipation } from "../core/layout/ScreenHeaderParticipation"
-import { ParticipationH2, ParticipationH3, ParticipationP } from "../core/Text"
-import { ParticipationStaticMap } from "../maps/ParticipationStaticMap"
-import { Question } from "../core/Question"
-import { MultiLineString } from "@turf/helpers"
-
-export { FORM_ERROR } from "src/core/components/forms"
-
-type Props = {
- page: any // TODO
- onButtonClick: any // TODO
- staticMapProps: {
- projectGeometry: MultiLineString
- layerStyles: Record
- }
- feedbackCategory: string
- isCompleted: boolean
-}
-
-export const FeedbackSecondPage: React.FC = ({
- page,
- isCompleted,
- onButtonClick,
- staticMapProps,
- feedbackCategory,
-}) => {
- const { pinPosition } = useContext(PinContext)
- const { title, description, questions, buttons } = page
-
- const textAreaQuestions = questions.filter((q: Record) => q.component === "text")
-
- return (
- <>
-
- {questions[0].label.de}
- {feedbackCategory}
-
- {pinPosition && (
- <>
- {questions[1].label.de}
-
- >
- )}
-
-
-
-
-
-
-
- {buttons[0].label.de}
-
-
- {buttons[1].label.de}
-
-
-
- Zurück
-
- >
- )
-}
diff --git a/src/participation/components/rs8-inactive.tsx b/src/participation/components/rs8-inactive.tsx
deleted file mode 100644
index 30975a510..000000000
--- a/src/participation/components/rs8-inactive.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import { BlitzPage } from "@blitzjs/next"
-import { LayoutParticipation } from "src/participation/components/core/layout/LayoutParticipation"
-import { surveyDefinition } from "src/participation/data/survey"
-import { ScreenHeaderParticipation } from "./core/layout/ScreenHeaderParticipation"
-import { ParticipationLink } from "./core/links/ParticipationLink"
-
-const ParticipationInactivePage: BlitzPage = () => {
- return (
-
-
-
-
- Zur Projektwebseite
-
-
-
- )
-}
-
-export default ParticipationInactivePage
diff --git a/src/participation/data/README.md b/src/participation/data/README.md
deleted file mode 100644
index 928bad13d..000000000
--- a/src/participation/data/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-## How to generate type definitions from the json schema
-
-1. Install [jq](https://stedolan.github.io/jq/)
- - Linux:
-
- curl https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 -o ~/bin/jq
- chmod u+x ~/bin/jq
-
- - OS X with Homebrew:
-
- brew install jq
-
-2. Install [json2ts](https://github.com/bcherny/json-schema-to-typescript)
-
- npm install -global json-schema-to-typescript
-
-3. Generate type definitions
-
- DIR=src/participation/data
- cat $DIR/schema.json |
- jq 'delpaths([["properties", "pages", "items", "properties", "questions", "items", "allOf"]])' |
- json2ts > $DIR/types.ts
- npx prettier $DIR/types.ts --write
diff --git a/src/survey-public/components/Done.tsx b/src/survey-public/components/Done.tsx
new file mode 100644
index 000000000..37de22616
--- /dev/null
+++ b/src/survey-public/components/Done.tsx
@@ -0,0 +1,16 @@
+export { FORM_ERROR } from "src/core/components/forms"
+import { SurveyLink } from "./core/links/SurveyLink"
+import { SurveyScreenHeader } from "./core/layout/SurveyScreenHeader"
+type Props = {
+ homeUrl: string
+}
+export const Done: React.FC = ({ homeUrl }) => {
+ return (
+
+
+
+ Zurück Startseite
+
+
+ )
+}
diff --git a/src/participation/components/core/Email.tsx b/src/survey-public/components/Email.tsx
similarity index 66%
rename from src/participation/components/core/Email.tsx
rename to src/survey-public/components/Email.tsx
index f84ecee57..909ccb3e0 100644
--- a/src/participation/components/core/Email.tsx
+++ b/src/survey-public/components/Email.tsx
@@ -1,8 +1,8 @@
import { iframeResizer } from "iframe-resizer"
import { useEffect } from "react"
-import { ParticipationH2, ParticipationP } from "./Text"
-import { ScreenHeaderParticipation } from "./layout/ScreenHeaderParticipation"
-import { ParticipationLink } from "./links/ParticipationLink"
+import { SurveyH2, SurveyP } from "./core/Text"
+import { SurveyScreenHeader } from "./core/layout/SurveyScreenHeader"
+import { SurveyLink } from "./core/links/SurveyLink"
export { FORM_ERROR } from "src/core/components/forms"
@@ -21,9 +21,9 @@ export const Email: React.FC = ({ onSubmit, email, homeUrl }) => {
return (
-
- {questionText.de}
- {description.de}
+
+ {questionText.de}
+ {description.de}
= ({ onSubmit, email, homeUrl }) => {
/>
-
+
{button.label.de}
-
+
)
diff --git a/src/survey-public/components/More.tsx b/src/survey-public/components/More.tsx
new file mode 100644
index 000000000..82ba8175a
--- /dev/null
+++ b/src/survey-public/components/More.tsx
@@ -0,0 +1,31 @@
+import { SurveyH2 } from "./core/Text"
+import { SurveyButton } from "./core/buttons/SurveyButton"
+import { SurveyButtonWrapper } from "./core/buttons/SurveyButtonWrapper"
+import { SurveyScreenHeader } from "./core/layout/SurveyScreenHeader"
+
+export { FORM_ERROR } from "src/core/components/forms"
+
+type Props = {
+ onClickMore: any
+ onClickFinish: any
+ more: any // TODO
+}
+
+export const More: React.FC = ({ more, onClickMore, onClickFinish }) => {
+ const { title, description, questionText, buttons } = more
+
+ return (
+ <>
+
+ {questionText.de}
+
+
+ {buttons[0].label.de}
+
+
+ {buttons[1].label.de}
+
+
+ >
+ )
+}
diff --git a/src/participation/components/core/Page.tsx b/src/survey-public/components/Page.tsx
similarity index 64%
rename from src/participation/components/core/Page.tsx
rename to src/survey-public/components/Page.tsx
index ac1b4e410..b8dafe54c 100644
--- a/src/participation/components/core/Page.tsx
+++ b/src/survey-public/components/Page.tsx
@@ -1,7 +1,7 @@
-import { ScreenHeaderParticipation } from "src/participation/components/core/layout/ScreenHeaderParticipation"
-import { ParticipationButtonWithAction } from "./buttons/ParticipationButtonWithAction"
-import { ParticipationButtonWrapper } from "./buttons/ParticipationButtonWrapper"
-import type { TPage as TPage } from "src/participation/data/types"
+import { SurveyScreenHeader } from "src/survey-public/components/core/layout/SurveyScreenHeader"
+import { SurveyButtonWithAction } from "./core/buttons/SurveyButtonWithAction"
+import { SurveyButtonWrapper } from "./core/buttons/SurveyButtonWrapper"
+import type { TPage as TPage } from "src/survey-public/components/types"
import { Question } from "./Question"
export { FORM_ERROR } from "src/core/components/forms"
@@ -17,20 +17,20 @@ export const Page: React.FC = ({ page, buttonActions, completed }) => {
return (
-
+
{questions &&
questions.length &&
questions.map((question) => (
))}
-
+
{buttons?.map((button) => {
let disabled = false
if (["nextPage", "submit"].includes(button.onClick.action)) {
disabled = !completed
}
return (
- = ({ page, buttonActions, completed }) => {
/>
)
})}
-
+
)
}
diff --git a/src/participation/components/core/Question.tsx b/src/survey-public/components/Question.tsx
similarity index 72%
rename from src/participation/components/core/Question.tsx
rename to src/survey-public/components/Question.tsx
index 52026a8c6..3f7baa5fd 100644
--- a/src/participation/components/core/Question.tsx
+++ b/src/survey-public/components/Question.tsx
@@ -1,8 +1,8 @@
-import { TQuestion, TSingleOrMultiResponseProps } from "src/participation/data/types"
-import { ParticipationH2 } from "./Text"
-import { ParticipationLabeledCheckboxGroup } from "./form/ParticipationLabeledCheckboxGroup"
-import { ParticipationLabeledRadiobuttonGroup } from "./form/ParticipationLabeledRadiobuttonGroup"
-import { ParticipationLabeledTextareaField } from "./form/ParticipationLabeledTextareaField"
+import { TQuestion, TSingleOrMultiResponseProps } from "src/survey-public/components/types"
+import { SurveyH2 } from "./core/Text"
+import { SurveyLabeledCheckboxGroup } from "./core/form/SurveyLabeledCheckboxGroup"
+import { SurveyLabeledRadiobuttonGroup } from "./core/form/SurveyLabeledRadiobuttonGroup"
+import { SurveyLabeledTextareaField } from "./core/form/SurveyLabeledTextareaField"
export { FORM_ERROR } from "src/core/components/forms"
type TSingleOrMultuResponseComponentProps = {
@@ -13,7 +13,7 @@ const SingleResponseComponent: React.FC =
id,
responses,
}) => (
- ({
scope: `single-${id}`,
name: `${id}-${item.id}`,
@@ -28,7 +28,7 @@ const MultipleResponseComponent: React.FC
id,
responses,
}) => (
- ({
name: `multi-${id}-${item.id}`,
@@ -44,7 +44,7 @@ type TTextResponseComponentProps = {
const TextResponseComponent: React.FC = ({ id }) => (
<>
-
+
>
)
// TODO type
@@ -70,7 +70,7 @@ export const Question: React.FC = ({ question, className }) => {
const Component = components[component] || null
return (
- {label.de}
+ {label.de}
{/* @ts-ignore */}
{Component && }
diff --git a/src/participation-frm7/components/frm7.tsx b/src/survey-public/components/SurveyFRM7.tsx
similarity index 75%
rename from src/participation-frm7/components/frm7.tsx
rename to src/survey-public/components/SurveyFRM7.tsx
index a7420b814..98ddbf24b 100644
--- a/src/participation-frm7/components/frm7.tsx
+++ b/src/survey-public/components/SurveyFRM7.tsx
@@ -2,39 +2,29 @@ import { createContext, useState } from "react"
import { BlitzPage, useParam } from "@blitzjs/next"
import { useMutation, useQuery } from "@blitzjs/rpc"
-import { Done } from "src/participation-frm7/components/Done"
-
-import { Feedback } from "src/participation-frm7/components/feedback/Feedback"
-
-import { Survey } from "src/participation-frm7/components/Survey"
-import { moreDefinition } from "src/participation-frm7/data/more"
-import { surveyDefinition } from "src/participation-frm7/data/survey"
-import { feedbackDefinition } from "src/participation-frm7/data/feedback"
-import { emailDefinition } from "src/participation-frm7/data/email"
+import { Survey } from "../frm7/components/Survey"
+import { Feedback } from "src/survey-public/frm7/components/feedback/Feedback"
import createSurveySession from "src/survey-sessions/mutations/createSurveySession"
import updateSurveySession from "src/survey-sessions/mutations/updateSurveySession"
import createSurveyResponse from "src/survey-responses/mutations/createSurveyResponse"
import getPublicSurveyBySlug from "src/surveys/queries/getPublicSurveyBySlug"
-import { Debug } from "src/participation/components/core/Debug"
-import { ProgressContext } from "src/participation/context/contexts"
-import { LayoutParticipation } from "src/participation/components/core/layout/LayoutParticipation"
-import { ParticipationSpinnerLayover } from "src/participation/components/core/ParticipationSpinnerLayover"
-import { scrollToTopWithDelay } from "src/participation/utils/scrollToTopWithDelay"
-import { More } from "src/participation/components/core/More"
-import { Email } from "src/participation/components/core/Email"
-
-// For Progressbar: stage and associated arbitrarily set status of the progressbar
-export const stageProgressDefinition = {
- SURVEY: 1,
- MORE: 5,
- FEEDBACK: 6,
- EMAIL: 8,
- DONE: 8,
-}
-
-const ParticipationFrm7MainPage: BlitzPage = () => {
+import { Debug } from "src/survey-public/components/core/Debug"
+import { ProgressContext } from "src/survey-public/components/context/contexts"
+import { SurveyLayout } from "src/survey-public/components/core/layout/SurveyLayout"
+import { SurveySpinnerLayover } from "src/survey-public/components/core/layout/SurveySpinnerLayover"
+import { scrollToTopWithDelay } from "src/survey-public/components/utils/scrollToTopWithDelay"
+import { More } from "src/survey-public/components/More"
+import { Email } from "src/survey-public/components/Email"
+import { Done } from "src/survey-public/components/Done"
+import { surveyDefinition } from "../frm7/data/survey"
+import { stageProgressDefinition } from "../frm7/data/progress"
+import { feedbackDefinition } from "../frm7/data/feedback"
+import { moreDefinition } from "../frm7/data/more"
+import { emailDefinition } from "../frm7/data/email"
+
+const SurveyFRM7: BlitzPage = () => {
const [stage, setStage] = useState<"SURVEY" | "MORE" | "FEEDBACK" | "EMAIL" | "DONE">("SURVEY")
const [progress, setProgress] = useState(1)
const [isSpinner, setIsSpinner] = useState(false)
@@ -156,16 +146,13 @@ const ParticipationFrm7MainPage: BlitzPage = () => {
)
break
case "DONE":
- component =
-
+
stage: {stage}
@@ -174,10 +161,10 @@ const ParticipationFrm7MainPage: BlitzPage = () => {
email: {emailState}
{component}
- {isSpinner && }
-
+ {isSpinner && }
+
)
}
-export default ParticipationFrm7MainPage
+export default SurveyFRM7
diff --git a/src/survey-public/components/SurveyInactivePage.tsx b/src/survey-public/components/SurveyInactivePage.tsx
new file mode 100644
index 000000000..96abc5277
--- /dev/null
+++ b/src/survey-public/components/SurveyInactivePage.tsx
@@ -0,0 +1,22 @@
+import { BlitzPage } from "@blitzjs/next"
+import { SurveyLayout } from "src/survey-public/components/core/layout/SurveyLayout"
+import { TSurvey } from "./types"
+import { SurveyScreenHeader } from "./core/layout/SurveyScreenHeader"
+import { SurveyLink } from "./core/links/SurveyLink"
+type Props = {
+ surveyDefinition: TSurvey
+}
+const SurveyInactivePage: BlitzPage = ({ surveyDefinition }) => {
+ return (
+
+
+
+
+ Zur Projektwebseite
+
+
+
+ )
+}
+
+export default SurveyInactivePage
diff --git a/src/survey-public/components/SurveyMainPage.tsx b/src/survey-public/components/SurveyMainPage.tsx
new file mode 100644
index 000000000..4b1e2dd88
--- /dev/null
+++ b/src/survey-public/components/SurveyMainPage.tsx
@@ -0,0 +1,42 @@
+import { BlitzPage } from "@blitzjs/auth"
+import { useParam } from "@blitzjs/next"
+import { useQuery } from "@blitzjs/rpc"
+import { Suspense } from "react"
+import { Spinner } from "src/core/components/Spinner"
+
+import SurveyInactivePage from "src/survey-public/components/SurveyInactivePage"
+import getPublicSurveyBySlug from "src/surveys/queries/getPublicSurveyBySlug"
+import { SurveyRS8 } from "./SurveyRS8"
+import { surveyDefinition as surveyDefinitionRS8 } from "../rs8/data/survey"
+import { surveyDefinition as surveyDefinitionFRM7 } from "../frm7/data/survey"
+import SurveyFRM7 from "./SurveyFRM7"
+
+const SurveyMainPageWithQuery = () => {
+ const surveySlug = useParam("surveySlug", "string")
+ const [survey] = useQuery(getPublicSurveyBySlug, { slug: surveySlug! })
+ // only returns something if there is a 'Survey' in the DB with the slug (url params) and the slug is either rs8 or frm7
+ if (!survey) return null
+ if (surveySlug === "rs8")
+ return survey.active ? (
+
+ ) : (
+
+ )
+ if (surveySlug === "frm7")
+ return survey.active ? (
+
+ ) : (
+
+ )
+ return null
+}
+
+const SurveyMainPage: BlitzPage = () => {
+ return (
+ }>
+
+
+ )
+}
+
+export default SurveyMainPage
diff --git a/src/participation/components/rs8.tsx b/src/survey-public/components/SurveyRS8.tsx
similarity index 74%
rename from src/participation/components/rs8.tsx
rename to src/survey-public/components/SurveyRS8.tsx
index 27d6acf10..fc1b20519 100644
--- a/src/participation/components/rs8.tsx
+++ b/src/survey-public/components/SurveyRS8.tsx
@@ -1,35 +1,28 @@
-import { BlitzPage } from "@blitzjs/next"
import { useMutation } from "@blitzjs/rpc"
import { useState } from "react"
-import { Done } from "src/participation/components/Done"
-import { Survey } from "src/participation/components/Survey"
-import { Debug } from "src/participation/components/core/Debug"
-import { Email } from "src/participation/components/core/Email"
-import { More } from "src/participation/components/core/More"
-import { ParticipationSpinnerLayover } from "src/participation/components/core/ParticipationSpinnerLayover"
-import { LayoutParticipation } from "src/participation/components/core/layout/LayoutParticipation"
-import { Feedback } from "src/participation/components/feedback/Feedback"
-import { ProgressContext } from "src/participation/context/contexts"
-import { emailDefinition } from "src/participation/data/email"
-import { feedbackDefinition } from "src/participation/data/feedback"
-import { moreDefinition } from "src/participation/data/more"
-import { surveyDefinition } from "src/participation/data/survey"
-import { scrollToTopWithDelay } from "src/participation/utils/scrollToTopWithDelay"
+import { Survey } from "src/survey-public/rs8/components/Survey"
+import { Feedback } from "src/survey-public/rs8/components/feedback/Feedback"
+
+import { Done } from "src/survey-public/components/Done"
+import { Email } from "src/survey-public/components/Email"
+import { More } from "src/survey-public/components/More"
+import { ProgressContext } from "src/survey-public/components/context/contexts"
+import { Debug } from "src/survey-public/components/core/Debug"
+import { SurveyLayout } from "src/survey-public/components/core/layout/SurveyLayout"
+import { SurveySpinnerLayover } from "src/survey-public/components/core/layout/SurveySpinnerLayover"
+import { scrollToTopWithDelay } from "src/survey-public/components/utils/scrollToTopWithDelay"
+
import createSurveyResponse from "src/survey-responses/mutations/createSurveyResponse"
import createSurveySession from "src/survey-sessions/mutations/createSurveySession"
import updateSurveySession from "src/survey-sessions/mutations/updateSurveySession"
+import { emailDefinition } from "../rs8/data/email"
+import { feedbackDefinition } from "../rs8/data/feedback"
+import { moreDefinition } from "../rs8/data/more"
+import { stageProgressDefinition } from "../rs8/data/progress"
+import { surveyDefinition } from "../rs8/data/survey"
-// For Progressbar: stage and associated arbitrarily set status of the progressbar
-export const stageProgressDefinition = {
- SURVEY: 1,
- MORE: 5,
- FEEDBACK: 6,
- EMAIL: 8,
- DONE: 8,
-}
-
-const ParticipationMainPage: BlitzPage = () => {
+export const SurveyRS8: React.FC = () => {
const [stage, setStage] = useState<"SURVEY" | "MORE" | "FEEDBACK" | "EMAIL" | "DONE">("SURVEY")
const [progress, setProgress] = useState(1)
const [isSpinner, setIsSpinner] = useState(false)
@@ -149,16 +142,13 @@ const ParticipationMainPage: BlitzPage = () => {
)
break
case "DONE":
- component =
-
+
stage: {stage}
@@ -167,10 +157,8 @@ const ParticipationMainPage: BlitzPage = () => {
email: {emailState}
{component}
- {isSpinner && }
-
+ {isSpinner && }
+
)
}
-
-export default ParticipationMainPage
diff --git a/src/participation/context/contexts.ts b/src/survey-public/components/context/contexts.ts
similarity index 100%
rename from src/participation/context/contexts.ts
rename to src/survey-public/components/context/contexts.ts
diff --git a/src/participation/components/core/Debug.tsx b/src/survey-public/components/core/Debug.tsx
similarity index 100%
rename from src/participation/components/core/Debug.tsx
rename to src/survey-public/components/core/Debug.tsx
diff --git a/src/participation/components/core/Text.tsx b/src/survey-public/components/core/Text.tsx
similarity index 68%
rename from src/participation/components/core/Text.tsx
rename to src/survey-public/components/core/Text.tsx
index 5ce3eae78..4a349b380 100644
--- a/src/participation/components/core/Text.tsx
+++ b/src/survey-public/components/core/Text.tsx
@@ -6,7 +6,7 @@ type Props = {
className?: string
}
-export const ParticipationH1: React.FC = ({ className, children }) => {
+export const SurveyH1: React.FC = ({ className, children }) => {
return (
= ({ className, children }) => {
)
}
-export const ParticipationH2: React.FC = ({ className, children }) => {
+export const SurveyH2: React.FC = ({ className, children }) => {
return (
{children}
@@ -27,7 +27,7 @@ export const ParticipationH2: React.FC = ({ className, children }) => {
)
}
-export const ParticipationH3: React.FC = ({ className, children }) => {
+export const SurveyH3: React.FC = ({ className, children }) => {
return (
{children}
@@ -35,6 +35,6 @@ export const ParticipationH3: React.FC = ({ className, children }) => {
)
}
-export const ParticipationP: React.FC = ({ className, children }) => {
+export const SurveyP: React.FC = ({ className, children }) => {
return {children}
}
diff --git a/src/participation/components/core/buttons/ParticipationButton.tsx b/src/survey-public/components/core/buttons/SurveyButton.tsx
similarity index 57%
rename from src/participation/components/core/buttons/ParticipationButton.tsx
rename to src/survey-public/components/core/buttons/SurveyButton.tsx
index c38f062c1..f4d605f53 100644
--- a/src/participation/components/core/buttons/ParticipationButton.tsx
+++ b/src/survey-public/components/core/buttons/SurveyButton.tsx
@@ -1,6 +1,6 @@
import clsx from "clsx"
import { ReactNode } from "react"
-import { participationPinkButtonStyles, participationWhiteButtonStyles } from "../links/styles"
+import { surveyPinkButtonStyles, surveyWhiteButtonStyles } from "../links/styles"
export { FORM_ERROR } from "src/core/components/forms"
type Props = {
@@ -9,15 +9,10 @@ type Props = {
children: string | ReactNode
} & React.ButtonHTMLAttributes
-export const ParticipationButton: React.FC = ({
- disabled,
- color = "pink",
- children,
- ...props
-}) => {
+export const SurveyButton: React.FC = ({ disabled, color = "pink", children, ...props }) => {
const buttonStyles = clsx(
"px-12",
- color === "white" ? participationWhiteButtonStyles : participationPinkButtonStyles,
+ color === "white" ? surveyWhiteButtonStyles : surveyPinkButtonStyles,
)
return (
diff --git a/src/participation/components/core/buttons/ParticipationButtonWithAction.tsx b/src/survey-public/components/core/buttons/SurveyButtonWithAction.tsx
similarity index 52%
rename from src/participation/components/core/buttons/ParticipationButtonWithAction.tsx
rename to src/survey-public/components/core/buttons/SurveyButtonWithAction.tsx
index d0be603d4..caf1ed9af 100644
--- a/src/participation/components/core/buttons/ParticipationButtonWithAction.tsx
+++ b/src/survey-public/components/core/buttons/SurveyButtonWithAction.tsx
@@ -1,5 +1,5 @@
-import { TButtonWithAction } from "src/participation/data/types"
-import { ParticipationButton } from "./ParticipationButton"
+import { TButtonWithAction } from "src/survey-public/components/types"
+import { SurveyButton } from "./SurveyButton"
export { FORM_ERROR } from "src/core/components/forms"
type Props = {
@@ -8,18 +8,14 @@ type Props = {
disabled?: boolean
}
-export const ParticipationButtonWithAction: React.FC = ({
- disabled,
- button,
- buttonActions,
-}) => {
+export const SurveyButtonWithAction: React.FC = ({ disabled, button, buttonActions }) => {
const { label, color, onClick } = button
if (onClick.action === "submit")
return (
-
+
{label.de}
-
+
)
let buttonActionSelect: any
@@ -33,13 +29,8 @@ export const ParticipationButtonWithAction: React.FC = ({
}
return (
-
+
{label.de}
-
+
)
}
diff --git a/src/participation/components/core/buttons/ParticipationButtonWrapper.tsx b/src/survey-public/components/core/buttons/SurveyButtonWrapper.tsx
similarity index 73%
rename from src/participation/components/core/buttons/ParticipationButtonWrapper.tsx
rename to src/survey-public/components/core/buttons/SurveyButtonWrapper.tsx
index c496acd54..c5447210e 100644
--- a/src/participation/components/core/buttons/ParticipationButtonWrapper.tsx
+++ b/src/survey-public/components/core/buttons/SurveyButtonWrapper.tsx
@@ -4,7 +4,7 @@ type Props = {
children: ReactNode
}
-export const ParticipationButtonWrapper: React.FC = ({ children }) => {
+export const SurveyButtonWrapper: React.FC = ({ children }) => {
return (
{children}
diff --git a/src/participation/components/core/form/SurveyForm.tsx b/src/survey-public/components/core/form/PublicSurveyForm.tsx
similarity index 94%
rename from src/participation/components/core/form/SurveyForm.tsx
rename to src/survey-public/components/core/form/PublicSurveyForm.tsx
index b694935bf..336ea68a1 100644
--- a/src/participation/components/core/form/SurveyForm.tsx
+++ b/src/survey-public/components/core/form/PublicSurveyForm.tsx
@@ -15,7 +15,7 @@ export interface FormProps>
export const FORM_ERROR = "FORM_ERROR"
-export function SurveyForm>({
+export function PublicSurveyForm>({
children,
schema,
initialValues,
@@ -55,4 +55,4 @@ export function SurveyForm>({
)
}
-export default SurveyForm
+export default PublicSurveyForm
diff --git a/src/survey-public/components/core/form/SurveyLabeledCheckbox.tsx b/src/survey-public/components/core/form/SurveyLabeledCheckbox.tsx
new file mode 100644
index 000000000..92a2ee160
--- /dev/null
+++ b/src/survey-public/components/core/form/SurveyLabeledCheckbox.tsx
@@ -0,0 +1,67 @@
+import { ErrorMessage } from "@hookform/error-message"
+import clsx from "clsx"
+import { ComponentPropsWithoutRef, forwardRef, PropsWithoutRef, ReactNode } from "react"
+import { useFormContext } from "react-hook-form"
+
+export interface TSurveyLabeledCheckbox extends PropsWithoutRef {
+ /** Field name. */
+ name: string
+ /** Field label. */
+ label: string | ReactNode
+ /** Help text below field label. */
+ help?: string
+ outerProps?: PropsWithoutRef
+ labelProps?: ComponentPropsWithoutRef<"label">
+}
+
+export const SurveyLabeledCheckbox = forwardRef(
+ ({ name, label, help, outerProps, labelProps, ...props }, ref) => {
+ const {
+ register,
+ formState: { isSubmitting, errors },
+ } = useFormContext()
+
+ const hasError = Boolean(errors[name])
+
+ return (
+
+
+
+
+
+
+ )
+ },
+)
diff --git a/src/survey-public/components/core/form/SurveyLabeledCheckboxGroup.tsx b/src/survey-public/components/core/form/SurveyLabeledCheckboxGroup.tsx
new file mode 100644
index 000000000..4e7433df4
--- /dev/null
+++ b/src/survey-public/components/core/form/SurveyLabeledCheckboxGroup.tsx
@@ -0,0 +1,18 @@
+import clsx from "clsx"
+import React from "react"
+import { SurveyLabeledCheckbox, TSurveyLabeledCheckbox } from "./SurveyLabeledCheckbox"
+
+type Props = {
+ items: TSurveyLabeledCheckbox[]
+ className?: string
+}
+
+export const SurveyLabeledCheckboxGroup: React.FC = ({ items, className }) => {
+ return (
+
+ {items.map((item, index) => {
+ return
+ })}
+
+ )
+}
diff --git a/src/survey-public/components/core/form/SurveyLabeledRadiobutton.tsx b/src/survey-public/components/core/form/SurveyLabeledRadiobutton.tsx
new file mode 100644
index 000000000..0df32bda6
--- /dev/null
+++ b/src/survey-public/components/core/form/SurveyLabeledRadiobutton.tsx
@@ -0,0 +1,69 @@
+import { ErrorMessage } from "@hookform/error-message"
+import clsx from "clsx"
+import { ComponentPropsWithoutRef, forwardRef, PropsWithoutRef } from "react"
+import { useFormContext } from "react-hook-form"
+
+export interface SurveyLabeledRadiobuttonProps
+ extends PropsWithoutRef {
+ /** Radiobutton scope. */
+ scope: string
+ /** Field name. */
+ name: string
+ /** Field label. */
+ label: string
+ /** Field value. */
+ value: string
+ /** Help text below field label. */
+ help?: string
+ outerProps?: PropsWithoutRef
+ labelProps?: ComponentPropsWithoutRef<"label">
+}
+
+export const SurveyLabeledRadiobutton = forwardRef(
+ ({ scope, name, label, value, help, outerProps, labelProps, ...props }, ref) => {
+ const {
+ register,
+ formState: { isSubmitting, errors },
+ } = useFormContext()
+
+ const hasError = Boolean(errors[name])
+
+ return (
+
+
+
+
+
+
+ )
+ },
+)
diff --git a/src/survey-public/components/core/form/SurveyLabeledRadiobuttonGroup.tsx b/src/survey-public/components/core/form/SurveyLabeledRadiobuttonGroup.tsx
new file mode 100644
index 000000000..6ed4e3d2e
--- /dev/null
+++ b/src/survey-public/components/core/form/SurveyLabeledRadiobuttonGroup.tsx
@@ -0,0 +1,18 @@
+import clsx from "clsx"
+import React from "react"
+import { SurveyLabeledRadiobutton, SurveyLabeledRadiobuttonProps } from "./SurveyLabeledRadiobutton"
+
+type Props = {
+ items: SurveyLabeledRadiobuttonProps[]
+ className?: string
+}
+
+export const SurveyLabeledRadiobuttonGroup: React.FC = ({ items, className }) => {
+ return (
+
+ {items.map((item) => {
+ return
+ })}
+
+ )
+}
diff --git a/src/participation/components/core/form/ParticipationLabeledTextField.tsx b/src/survey-public/components/core/form/SurveyLabeledTextField.tsx
similarity index 96%
rename from src/participation/components/core/form/ParticipationLabeledTextField.tsx
rename to src/survey-public/components/core/form/SurveyLabeledTextField.tsx
index eb435e395..32a1a4bb9 100644
--- a/src/participation/components/core/form/ParticipationLabeledTextField.tsx
+++ b/src/survey-public/components/core/form/SurveyLabeledTextField.tsx
@@ -25,7 +25,7 @@ export interface LabeledTextFieldProps extends PropsWithoutRef(
+export const SurveyLabeledTextField = forwardRef(
({ name, label, help, outerProps, labelProps, optional, ...props }, ref) => {
const {
register,
diff --git a/src/participation/components/core/form/ParticipationLabeledTextareaField.tsx b/src/survey-public/components/core/form/SurveyLabeledTextareaField.tsx
similarity index 92%
rename from src/participation/components/core/form/ParticipationLabeledTextareaField.tsx
rename to src/survey-public/components/core/form/SurveyLabeledTextareaField.tsx
index 7ee0a5bb3..517fcff97 100644
--- a/src/participation/components/core/form/ParticipationLabeledTextareaField.tsx
+++ b/src/survey-public/components/core/form/SurveyLabeledTextareaField.tsx
@@ -3,7 +3,7 @@ import clsx from "clsx"
import { ComponentPropsWithoutRef, forwardRef, PropsWithoutRef } from "react"
import { useFormContext } from "react-hook-form"
-export interface ParticipationLabeledTextareaProps
+export interface SurveyLabeledTextareaProps
extends PropsWithoutRef {
/** Field name. */
name: string
@@ -15,9 +15,9 @@ export interface ParticipationLabeledTextareaProps
optional?: boolean
}
-export const ParticipationLabeledTextareaField = forwardRef<
+export const SurveyLabeledTextareaField = forwardRef<
HTMLTextAreaElement,
- ParticipationLabeledTextareaProps
+ SurveyLabeledTextareaProps
>(
(
{ name, label, help, outerProps, labelProps, optional, className: textareaClasName, ...props },
diff --git a/src/participation/components/core/layout/ProgressBar.tsx b/src/survey-public/components/core/layout/ProgressBar.tsx
similarity index 86%
rename from src/participation/components/core/layout/ProgressBar.tsx
rename to src/survey-public/components/core/layout/ProgressBar.tsx
index 2365a0854..fe9873153 100644
--- a/src/participation/components/core/layout/ProgressBar.tsx
+++ b/src/survey-public/components/core/layout/ProgressBar.tsx
@@ -1,5 +1,5 @@
import { useContext } from "react"
-import { ProgressContext } from "src/participation/context/contexts"
+import { ProgressContext } from "src/survey-public/components/context/contexts"
export { FORM_ERROR } from "src/core/components/forms"
diff --git a/src/participation/components/core/layout/ContainerParticipation.tsx b/src/survey-public/components/core/layout/SurveyContainer.tsx
similarity index 68%
rename from src/participation/components/core/layout/ContainerParticipation.tsx
rename to src/survey-public/components/core/layout/SurveyContainer.tsx
index c9dcdba5e..6c2d96e81 100644
--- a/src/participation/components/core/layout/ContainerParticipation.tsx
+++ b/src/survey-public/components/core/layout/SurveyContainer.tsx
@@ -4,6 +4,6 @@ type Props = {
children?: React.ReactNode
}
-export const ContainerParticipation: BlitzLayout = ({ children }) => {
+export const SurveyContainer: BlitzLayout = ({ children }) => {
return {children}
}
diff --git a/src/participation/components/core/layout/FooterParticipation.tsx b/src/survey-public/components/core/layout/SurveyFooter.tsx
similarity index 89%
rename from src/participation/components/core/layout/FooterParticipation.tsx
rename to src/survey-public/components/core/layout/SurveyFooter.tsx
index 0a6effd0b..a24bdf394 100644
--- a/src/participation/components/core/layout/FooterParticipation.tsx
+++ b/src/survey-public/components/core/layout/SurveyFooter.tsx
@@ -2,7 +2,7 @@ import React from "react"
import { FooterLinkList } from "../../../../core/layouts/Footer/FooterLinkList"
import { links } from "../../../../core/layouts/Footer/links.const"
-export const FooterParticipation: React.FC = () => {
+export const SurveyFooter: React.FC = () => {
return (