From a9bf8fcdaae7262a9c73342cb5a04f23837f8914 Mon Sep 17 00:00:00 2001 From: Piyush Gupta <56182734+gupta-piyush19@users.noreply.github.com> Date: Wed, 24 Apr 2024 18:58:38 +0530 Subject: [PATCH] fix: adds loader in the thankyou card while response submission (#2520) Co-authored-by: Johannes --- .../edit/components/EditThankYouCard.tsx | 1 + apps/web/playwright/survey.spec.ts | 2 + apps/web/playwright/utils/helper.ts | 2 +- .../src/components/general/ThankYouCard.tsx | 100 ++++++++++-------- 4 files changed, 58 insertions(+), 47 deletions(-) diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/edit/components/EditThankYouCard.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/edit/components/EditThankYouCard.tsx index 555ae68dae..db20d72ef8 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/edit/components/EditThankYouCard.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/edit/components/EditThankYouCard.tsx @@ -109,6 +109,7 @@ export default function EditThankYouCard({
{ await page.getByPlaceholder(surveys.createAndSubmit.address.placeholder).fill("This is my Address"); await page.getByRole("button", { name: "Finish" }).click(); + await page.waitForTimeout(500); + // Thank You Card await expect(page.getByText(surveys.createAndSubmit.thankYouCard.headline)).toBeVisible(); await expect(page.getByText(surveys.createAndSubmit.thankYouCard.description)).toBeVisible(); diff --git a/apps/web/playwright/utils/helper.ts b/apps/web/playwright/utils/helper.ts index fb3803a181..8f1277b7c5 100644 --- a/apps/web/playwright/utils/helper.ts +++ b/apps/web/playwright/utils/helper.ts @@ -275,6 +275,6 @@ export const createSurvey = async ( // Thank You Card await page.getByText("Thank You CardShown").click(); - await page.getByLabel("Question").fill(params.thankYouCard.headline); + await page.getByLabel("Headline").fill(params.thankYouCard.headline); await page.getByLabel("Description").fill(params.thankYouCard.description); }; diff --git a/packages/surveys/src/components/general/ThankYouCard.tsx b/packages/surveys/src/components/general/ThankYouCard.tsx index 7ce43d9f56..3c24009323 100644 --- a/packages/surveys/src/components/general/ThankYouCard.tsx +++ b/packages/surveys/src/components/general/ThankYouCard.tsx @@ -1,5 +1,6 @@ import Button from "@/components/buttons/SubmitButton"; import Headline from "@/components/general/Headline"; +import { LoadingSpinner } from "@/components/general/LoadingSpinner"; import { QuestionMedia } from "@/components/general/QuestionMedia"; import RedirectCountDown from "@/components/general/RedirectCountdown"; import Subheader from "@/components/general/Subheader"; @@ -36,57 +37,64 @@ export const ThankYouCard = ({ isResponseSendingFinished, isInIframe, }: ThankYouCardProps) => { + const media = imageUrl || videoUrl ? : null; + const checkmark = ( +
+ + + + +
+ ); + return (
- {imageUrl || videoUrl ? ( - - ) : ( -
-
- - + {media || checkmark} + + + + {buttonLabel && ( +
+
+ )} + + ) : ( + <> +
+
- -
+

Sending responses...

+ )} - -
- - - - {buttonLabel && isResponseSendingFinished && ( -
-
- )} -
); };