From 1e9c07afff6b7e8edb832b5c712b0ce957ddaca0 Mon Sep 17 00:00:00 2001 From: JohannaPeanut <76495099+JohannaPeanut@users.noreply.github.com> Date: Thu, 23 Jan 2025 18:14:22 +0100 Subject: [PATCH] Update EditableSurveyResponseMapAndStaticData.tsx --- ...EditableSurveyResponseMapAndStaticData.tsx | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/survey-responses/components/feedback/EditableSurveyResponseMapAndStaticData.tsx b/src/survey-responses/components/feedback/EditableSurveyResponseMapAndStaticData.tsx index c779968b..24125d29 100644 --- a/src/survey-responses/components/feedback/EditableSurveyResponseMapAndStaticData.tsx +++ b/src/survey-responses/components/feedback/EditableSurveyResponseMapAndStaticData.tsx @@ -139,22 +139,24 @@ const EditableSurveyResponseMapAndStaticData = ({ } } - // @ts-expect-error `data` is unkown - const atlasUrl = response.data[userLocationQuestionId] - ? surveyDefinition.atlasUrl!.replace( - "MAPPARAM", - // @ts-expect-error `data` is unkown - `11%2F${response.data[userLocationQuestionId].lat.toFixed(3)}%2F${response.data[userLocationQuestionId].lng.toFixed(3)}`, - ) - : surveyDefinition.atlasUrl!.replace( - "MAPPARAM", - // @ts-expect-error `data` is unkown - `11%2F${center(getParsedLine(response.data[geometryCategoryId])).geometry.coordinates[1].toFixed(3)}%2F${center(getParsedLine(response.data[geometryCategoryId])).geometry.coordinates[0].toFixed(3)}`, - ) + const atlasUrl = surveyDefinition.atlasUrl + ? // @ts-expect-error `data` is unkown + response.data[userLocationQuestionId] + ? surveyDefinition.atlasUrl.replace( + "MAPPARAM", + // @ts-expect-error `data` is unkown + `11%2F${response.data[userLocationQuestionId].lat.toFixed(3)}%2F${response.data[userLocationQuestionId].lng.toFixed(3)}`, + ) + : surveyDefinition.atlasUrl.replace( + "MAPPARAM", + // @ts-expect-error `data` is unkown + `11%2F${center(getParsedLine(response.data[geometryCategoryId])).geometry.coordinates[1].toFixed(3)}%2F${center(getParsedLine(response.data[geometryCategoryId])).geometry.coordinates[0].toFixed(3)}`, + ) + : null return (
- {surveyDefinition.atlasUrl && !showMap && ( + {atlasUrl && !showMap && ( Im Radverkehrsatlas öffnen @@ -217,7 +219,7 @@ const EditableSurveyResponseMapAndStaticData = ({ > In großer Karte öffnen - {surveyDefinition.atlasUrl && ( + {atlasUrl && ( Im Radverkehrsatlas öffnen