feat: rich text in headlines (#6685)

Co-authored-by: Johannes <johannes@formbricks.com>
Co-authored-by: Dhruwang <dhruwangjariwala18@gmail.com>
This commit is contained in:
Anshuman Pandey
2025-10-16 15:59:46 +05:30
committed by GitHub
parent df191de1b4
commit 36c5fc4a65
100 changed files with 1523 additions and 1002 deletions
@@ -1,12 +1,13 @@
"use client";
import { getLocalizedValue } from "@/lib/i18n/utils";
import { parseRecallInfo } from "@/lib/utils/recall";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip";
import { useTranslate } from "@tolgee/react";
import { CheckCircle2Icon, ChevronsDownIcon, XCircleIcon } from "lucide-react";
import { TResponseData } from "@formbricks/types/responses";
import { TSurveyQuestion } from "@formbricks/types/surveys/types";
import { getTextContent } from "@formbricks/types/surveys/validation";
import { getLocalizedValue } from "@/lib/i18n/utils";
import { parseRecallInfo } from "@/lib/utils/recall";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip";
interface QuestionSkipProps {
skippedQuestions: string[] | undefined;
@@ -72,12 +73,16 @@ export const QuestionSkip = ({
{skippedQuestions?.map((questionId) => {
return (
<p className="my-2" key={questionId}>
{parseRecallInfo(
getLocalizedValue(
questions.find((question) => question.id === questionId)!.headline,
"default"
),
responseData
{getTextContent(
parseRecallInfo(
getLocalizedValue(
questions.find((question) => question.id === questionId)?.headline ?? {
default: "",
},
"default"
),
responseData
)
)}
</p>
);
@@ -107,12 +112,16 @@ export const QuestionSkip = ({
skippedQuestions.map((questionId) => {
return (
<p className="my-2" key={questionId}>
{parseRecallInfo(
getLocalizedValue(
questions.find((question) => question.id === questionId)!.headline,
"default"
),
responseData
{getTextContent(
parseRecallInfo(
getLocalizedValue(
questions.find((question) => question.id === questionId)?.headline ?? {
default: "",
},
"default"
),
responseData
)
)}
</p>
);
@@ -4,6 +4,7 @@ import { useTranslate } from "@tolgee/react";
import { CheckCircle2Icon } from "lucide-react";
import { TResponseWithQuotas } from "@formbricks/types/responses";
import { TSurvey } from "@formbricks/types/surveys/types";
import { getTextContent } from "@formbricks/types/surveys/validation";
import { getLocalizedValue } from "@/lib/i18n/utils";
import { parseRecallInfo } from "@/lib/utils/recall";
import { ResponseCardQuotas } from "@/modules/ee/quotas/components/single-response-card-quotas";
@@ -77,13 +78,15 @@ export const SingleResponseCardBody = ({
<div key={`${question.id}`}>
{isValidValue(response.data[question.id]) ? (
<div>
<p className="mb-1 text-sm text-slate-500">
<p className="mb-1 text-sm font-semibold text-slate-600">
{formatTextWithSlashes(
parseRecallInfo(
getLocalizedValue(question.headline, "default"),
response.data,
response.variables,
true
getTextContent(
parseRecallInfo(
getLocalizedValue(question.headline, "default"),
response.data,
response.variables,
true
)
)
)}
</p>