diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedTabs/EmailTab.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedTabs/EmailTab.tsx index d07daf678c..116c2fe27b 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedTabs/EmailTab.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedTabs/EmailTab.tsx @@ -24,8 +24,6 @@ import { import { useMemo, useState } from "react"; import toast from "react-hot-toast"; import { isLight } from "@/app/lib/utils"; -import { CornerDownLeft } from "lucide-react"; -import Image from "next/image"; interface EmailTabProps { survey: TSurvey; @@ -143,304 +141,262 @@ const getEmailValues = ({ survey, surveyUrl, brandColor, preview }) => { const getEmailTemplate = (survey: TSurvey, surveyUrl: string, brandColor: string, preview: boolean) => { const url = preview ? `${surveyUrl}?preview=true` : surveyUrl; const urlWithPrefilling = preview ? `${surveyUrl}?preview=true&` : `${surveyUrl}?`; - if (survey?.welcomeCard?.enabled) { - return ( - - {survey?.welcomeCard?.fileUrl && ( - Company Logo - )} - - {survey?.welcomeCard?.headline} - - - - - - - - {survey?.welcomeCard?.buttonLabel || "Next"} - - - Press Enter - + const firstQuestion = survey.questions[0]; + switch (firstQuestion.type) { + case TSurveyQuestionType.OpenText: + return ( + + + {firstQuestion.headline} - - - - ); - } else { - const firstQuestion = survey.questions[0]; - switch (firstQuestion.type) { - case TSurveyQuestionType.OpenText: - return ( - - + + {firstQuestion.subheader} + +
+ + + ); + case TSurveyQuestionType.Consent: + return ( + + + {firstQuestion.headline} + + + + + + + {firstQuestion.label} + + + {!firstQuestion.required && ( + + Reject + + )} + + Accept + + + + + ); + case TSurveyQuestionType.NPS: + return ( + +
+ {firstQuestion.headline} {firstQuestion.subheader} -
- - - ); - case TSurveyQuestionType.Consent: - return ( - - - {firstQuestion.headline} - - - + +
+ {Array.from({ length: 11 }, (_, i) => ( + + {i} + + ))} +
+
+ + + {firstQuestion.lowerLabel} + + + {firstQuestion.upperLabel} + + +
+ {/* {!firstQuestion.required && ( + + {firstQuestion.buttonLabel || "Skip"} + + )} */} - - {firstQuestion.label} - - - {!firstQuestion.required && ( - - Reject - - )} - - Accept - - -
- ); - case TSurveyQuestionType.NPS: - return ( - -
- - {firstQuestion.headline} - - - {firstQuestion.subheader} - - -
- {Array.from({ length: 11 }, (_, i) => ( - - {i} - - ))} -
-
- - - {firstQuestion.lowerLabel} - - - - {firstQuestion.upperLabel} - - - -
-
- {/* {!firstQuestion.required && ( +
+
+ ); + case TSurveyQuestionType.CTA: + return ( + + + {firstQuestion.headline} + + + + + + + {!firstQuestion.required && ( - {firstQuestion.buttonLabel || "Skip"} + className="inline-flex cursor-pointer appearance-none rounded-md px-6 py-3 text-sm font-medium text-black"> + {firstQuestion.dismissButtonLabel || "Skip"} - )} */} - - -
- - ); - case TSurveyQuestionType.CTA: - return ( - + )} + + {firstQuestion.buttonLabel} + + + + + ); + case TSurveyQuestionType.Rating: + return ( + +
{firstQuestion.headline} - - - - - - {!firstQuestion.required && ( - - {firstQuestion.dismissButtonLabel || "Skip"} - - )} - - {firstQuestion.buttonLabel} - - - - - ); - case TSurveyQuestionType.Rating: - return ( - -
- - {firstQuestion.headline} - - - {firstQuestion.subheader} - - -
- {Array.from({ length: firstQuestion.range }, (_, i) => ( - - {firstQuestion.scale === "smiley" && 😃} - {firstQuestion.scale === "number" && i + 1} - {firstQuestion.scale === "star" && } - - ))} -
-
- - - {firstQuestion.lowerLabel} - - - {firstQuestion.upperLabel} - - -
-
- {/* {!firstQuestion.required && ( - - {firstQuestion.buttonLabel || "Skip"} - - )} */} - -
-
- ); - case TSurveyQuestionType.MultipleChoiceMulti: - return ( - - - {firstQuestion.headline} - - + {firstQuestion.subheader} - - {firstQuestion.choices.map((choice) => ( -
- {choice.label} -
- ))} -
- -
- ); - case TSurveyQuestionType.MultipleChoiceSingle: - return ( - - - {firstQuestion.headline} - - - {firstQuestion.subheader} - - - {firstQuestion.choices - .filter((choice) => choice.id !== "other") - .map((choice) => ( - - {choice.label} - + +
+ {Array.from({ length: firstQuestion.range }, (_, i) => ( + + {firstQuestion.scale === "smiley" && 😃} + {firstQuestion.scale === "number" && i + 1} + {firstQuestion.scale === "star" && } + ))} +
+
+ + + {firstQuestion.lowerLabel} + + + {firstQuestion.upperLabel} + + +
+ {/* {!firstQuestion.required && ( + + {firstQuestion.buttonLabel || "Skip"} + + )} */} -
- ); - case TSurveyQuestionType.PictureSelection: - return ( - - - {firstQuestion.headline} - - - {firstQuestion.subheader} - -
- {firstQuestion.choices.map((choice) => - firstQuestion.allowMulti ? ( - - ) : ( - - - - ) - )} -
- -
- ); - } +
+
+ ); + case TSurveyQuestionType.MultipleChoiceMulti: + return ( + + + {firstQuestion.headline} + + + {firstQuestion.subheader} + + + {firstQuestion.choices.map((choice) => ( +
+ {choice.label} +
+ ))} +
+ +
+ ); + case TSurveyQuestionType.MultipleChoiceSingle: + return ( + + + {firstQuestion.headline} + + + {firstQuestion.subheader} + + + {firstQuestion.choices + .filter((choice) => choice.id !== "other") + .map((choice) => ( + + {choice.label} + + ))} + + + + ); + case TSurveyQuestionType.PictureSelection: + return ( + + + {firstQuestion.headline} + + + {firstQuestion.subheader} + +
+ {firstQuestion.choices.map((choice) => + firstQuestion.allowMulti ? ( + + ) : ( + + + + ) + )} +
+ +
+ ); } };