fix: removed validation from button labels (#7138)

This commit is contained in:
Dhruwang Jariwala
2026-01-21 19:44:22 +05:30
committed by GitHub
parent 8d47ab9709
commit 22ea7302bb
2 changed files with 1 additions and 82 deletions
@@ -36,7 +36,6 @@ import { PictureSelectionForm } from "@/modules/survey/editor/components/picture
import { RankingElementForm } from "@/modules/survey/editor/components/ranking-element-form";
import { RatingElementForm } from "@/modules/survey/editor/components/rating-element-form";
import { formatTextWithSlashes } from "@/modules/survey/editor/lib/utils";
import { isLabelValidForAllLanguages } from "@/modules/survey/editor/lib/validation";
import { getElementIconMap, getTSurveyElementTypeEnumName } from "@/modules/survey/lib/elements";
import { Alert, AlertButton, AlertTitle } from "@/modules/ui/components/alert";
@@ -128,25 +127,7 @@ export const BlockCard = ({
const isBlockOpen = block.elements.some((element) => element.id === activeElementId);
const hasInvalidElement = block.elements.some((element) => invalidElements?.includes(element.id));
// Check if button labels have incomplete translations for any enabled language
// A button label is invalid if it exists but doesn't have valid text for all enabled languages
const surveyLanguages = localSurvey.languages ?? [];
const hasInvalidButtonLabel =
block.buttonLabel !== undefined &&
block.buttonLabel["default"]?.trim() !== "" &&
!isLabelValidForAllLanguages(block.buttonLabel, surveyLanguages);
// Check if back button label is invalid
// Back button label should exist for all blocks except the first one
const hasInvalidBackButtonLabel =
blockIdx > 0 &&
block.backButtonLabel !== undefined &&
block.backButtonLabel["default"]?.trim() !== "" &&
!isLabelValidForAllLanguages(block.backButtonLabel, surveyLanguages);
// Block should be highlighted if it has invalid elements OR invalid button labels
const isBlockInvalid = hasInvalidElement || hasInvalidButtonLabel || hasInvalidBackButtonLabel;
const isBlockInvalid = hasInvalidElement;
const [isBlockCollapsed, setIsBlockCollapsed] = useState(false);
const [openAdvanced, setOpenAdvanced] = useState(blockLogic.length > 0);