diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 738e55c201..0c20c66e69 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -37,4 +37,5 @@ Fixes # (issue) - [ ] Checked for warnings, there are none - [ ] Removed all `console.logs` - [ ] Merged the latest changes from main onto my branch with `git pull origin main` +- [ ] My changes don't cause any responsiveness issues - [ ] Updated the Formbricks Docs if changes were necessary diff --git a/apps/formbricks-com/components/dummyUI/TemplateList.tsx b/apps/formbricks-com/components/dummyUI/TemplateList.tsx index 3008a54886..9e96545f0d 100644 --- a/apps/formbricks-com/components/dummyUI/TemplateList.tsx +++ b/apps/formbricks-com/components/dummyUI/TemplateList.tsx @@ -48,22 +48,6 @@ export default function TemplateList({ onTemplateClick, activeTemplate }: Templa ))}
- {/* */} {templates .filter((template) => selectedFilter === ALL_CATEGORY_NAME || template.category === selectedFilter) .map((template: Template) => ( diff --git a/apps/formbricks-com/components/dummyUI/templates.ts b/apps/formbricks-com/components/dummyUI/templates.ts index b575639868..508d14a248 100644 --- a/apps/formbricks-com/components/dummyUI/templates.ts +++ b/apps/formbricks-com/components/dummyUI/templates.ts @@ -28,7 +28,7 @@ import type { Template } from "@formbricks/types/templates"; const thankYouCardDefault = { enabled: true, headline: "Thank you!", - subheader: "We appreciate your time and insight.", + subheader: "We appreciate your feedback.", }; export const customSurvey: Template = { diff --git a/apps/web/app/environments/[environmentId]/surveys/PreviewSurvey.tsx b/apps/web/app/environments/[environmentId]/surveys/PreviewSurvey.tsx index e2375496f9..93faabda60 100644 --- a/apps/web/app/environments/[environmentId]/surveys/PreviewSurvey.tsx +++ b/apps/web/app/environments/[environmentId]/surveys/PreviewSurvey.tsx @@ -78,7 +78,12 @@ export default function PreviewSurvey({ frameRef.current = requestAnimationFrame(frame); } else { handleStopCountdown(); - // close modal + setIsModalOpen(false); + // reopen the modal after 1 second + setTimeout(() => { + setIsModalOpen(true); + setActiveQuestionId(questions[0]?.id || ""); // set first question as active + }, 1500); } }; @@ -133,13 +138,13 @@ export default function PreviewSurvey({ case "notEquals": return answerValue !== logic.value; case "lessThan": - return answerValue < logic.value; + return logic.value !== undefined && answerValue < logic.value; case "lessEqual": - return answerValue <= logic.value; + return logic.value !== undefined && answerValue <= logic.value; case "greaterThan": - return answerValue > logic.value; + return logic.value !== undefined && answerValue > logic.value; case "greaterEqual": - return answerValue >= logic.value; + return logic.value !== undefined && answerValue >= logic.value; case "includesAll": return ( Array.isArray(answerValue) && diff --git a/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/CTAQuestionForm.tsx b/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/CTAQuestionForm.tsx index 159a3dc5cf..7c58f0561c 100644 --- a/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/CTAQuestionForm.tsx +++ b/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/CTAQuestionForm.tsx @@ -21,12 +21,14 @@ export default function CTAQuestionForm({ lastQuestion, }: CTAQuestionFormProps): JSX.Element { const [firstRender, setFirstRender] = useState(true); + return (
idx !== questionIdx && ( - + {idx + 1} - {truncate(question.headline, 14)} ) @@ -317,9 +317,10 @@ export default function LogicEditor({
{question.choices.filter((c) => c.id === "other").length === 0 && ( diff --git a/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/MultipleChoiceSingleForm.tsx b/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/MultipleChoiceSingleForm.tsx index 57f76e9b78..046b2a02cd 100644 --- a/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/MultipleChoiceSingleForm.tsx +++ b/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/MultipleChoiceSingleForm.tsx @@ -4,6 +4,7 @@ import { Button, Input, Label } from "@formbricks/ui"; import { TrashIcon, PlusIcon } from "@heroicons/react/24/solid"; import { createId } from "@paralleldrive/cuid2"; import { cn } from "@formbricks/lib/cn"; +import { useEffect, useRef, useState } from "react"; interface OpenQuestionFormProps { localSurvey: Survey; @@ -19,6 +20,10 @@ export default function MultipleChoiceSingleForm({ updateQuestion, lastQuestion, }: OpenQuestionFormProps): JSX.Element { + const lastChoiceRef = useRef(null); + const [isNew, setIsNew] = useState(true); + const questionRef = useRef(null); + const updateChoice = (choiceIdx: number, updatedAttributes: any) => { const newChoices = !question.choices ? [] @@ -32,6 +37,7 @@ export default function MultipleChoiceSingleForm({ }; const addChoice = (choiceIdx?: number) => { + setIsNew(false); // This question is no longer new. let newChoices = !question.choices ? [] : question.choices; const otherChoice = newChoices.find((choice) => choice.id === "other"); if (otherChoice) { @@ -75,12 +81,26 @@ export default function MultipleChoiceSingleForm({ updateQuestion(questionIdx, { choices: newChoices, logic: newLogic }); }; + useEffect(() => { + if (lastChoiceRef.current) { + lastChoiceRef.current?.focus(); + } + }, [question.choices?.length]); + + // This effect will run once on initial render, setting focus to the question input. + useEffect(() => { + if (isNew && questionRef.current) { + questionRef.current.focus(); + } + }, [isNew]); + return (
(
{question.choices.filter((c) => c.id === "other").length === 0 && ( - <> - - + )}
diff --git a/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/NPSQuestionForm.tsx b/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/NPSQuestionForm.tsx index 4dc55e93d5..22e70ea49a 100644 --- a/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/NPSQuestionForm.tsx +++ b/apps/web/app/environments/[environmentId]/surveys/[surveyId]/edit/NPSQuestionForm.tsx @@ -22,6 +22,7 @@ export default function NPSQuestionForm({
Question
Question
{ + let value = parseInt(e.target.value); + const updatedSurvey: Survey = { ...localSurvey, delay: value }; + setLocalSurvey(updatedSurvey); + }; + useEffect(() => { if (localSurvey.type === "link") { setOpen(false); @@ -199,6 +205,30 @@ export default function WhenToSendCard({ environmentId, localSurvey, setLocalSur Add condition
+ + {localSurvey.type !== "link" && ( +
+ +
+ )} +
-
+
+ Last updated: {timeSinceConditionally(survey.updatedAt)} +
{survey.type === "link" && (