Compare commits

...

4 Commits

Author SHA1 Message Date
pandeymangg
aba02cf62c Trigger Checks 2026-03-24 12:20:28 +05:30
pandeymangg
5d166cae8b fixes merge conflicts 2026-03-23 17:05:53 +05:30
Aryan
8d0847bb9a Requested Changes 2026-03-17 21:45:53 +05:30
Aryan
6c871b5cd5 feat: enhance welcome card to support video uploads and display 2026-03-17 21:45:53 +05:30
7 changed files with 30 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
import { Languages } from "lucide-react";
import { getLanguageLabel } from "@formbricks/i18n-utils/src/utils";
import { useTranslation } from "react-i18next";
import { getLanguageLabel } from "@formbricks/i18n-utils/src/utils";
import { TSurvey } from "@formbricks/types/surveys/types";
import { TUserLocale } from "@formbricks/types/user";
import { getEnabledLanguages } from "@/lib/i18n/utils";
@@ -18,11 +18,7 @@ interface LanguageDropdownProps {
locale: TUserLocale;
}
export const LanguageDropdown = ({
survey,
setLanguage,
locale,
}: LanguageDropdownProps) => {
export const LanguageDropdown = ({ survey, setLanguage, locale }: LanguageDropdownProps) => {
const { t } = useTranslation();
const enabledLanguages = getEnabledLanguages(survey.languages ?? []);
@@ -33,7 +29,10 @@ export const LanguageDropdown = ({
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="secondary" title={t("common.select_language")} aria-label={t("common.select_language")}>
<Button
variant="secondary"
title={t("common.select_language")}
aria-label={t("common.select_language")}>
<Languages className="h-5 w-5" />
</Button>
</DropdownMenuTrigger>

View File

@@ -1,7 +1,7 @@
"use client";
import { useTranslation } from "react-i18next";
import { type JSX, useState } from "react";
import { useTranslation } from "react-i18next";
import { TActionClass } from "@formbricks/types/action-classes";
import { TEnvironment } from "@formbricks/types/environment";
import { ActionDetailModal } from "./ActionDetailModal";

View File

@@ -128,14 +128,21 @@ export const EditWelcomeCard = ({
id="welcome-card-image"
allowedFileExtensions={["png", "jpeg", "jpg", "webp", "heic"]}
environmentId={environmentId}
onFileUpload={(url: string[] | undefined, _fileType: "image" | "video") => {
if (url?.length) {
updateSurvey({ fileUrl: url[0] });
onFileUpload={(url: string[] | undefined, fileType: "image" | "video") => {
if (url?.length && url[0]) {
const update =
fileType === "video"
? { videoUrl: url[0], fileUrl: undefined }
: { fileUrl: url[0], videoUrl: undefined };
updateSurvey(update);
} else {
updateSurvey({ fileUrl: undefined });
updateSurvey({ fileUrl: undefined, videoUrl: undefined });
}
}}
fileUrl={localSurvey?.welcomeCard?.fileUrl}
videoUrl={localSurvey?.welcomeCard?.videoUrl}
isVideoAllowed={true}
maxSizeInMB={5}
isStorageConfigured={isStorageConfigured}
/>
</div>

View File

@@ -1,6 +1,6 @@
import { useTranslation } from "react-i18next";
import { ArrowUpFromLineIcon } from "lucide-react";
import React from "react";
import { useTranslation } from "react-i18next";
import { TAllowedFileExtension } from "@formbricks/types/storage";
import { cn } from "@/lib/cn";
import { showStorageNotConfiguredToast } from "@/modules/ui/components/storage-not-configured-toast/lib/utils";

View File

@@ -310,7 +310,11 @@ export const PreviewSurvey = ({
setIsFullScreenPreview(true);
}
}}
aria-label={isFullScreenPreview ? t("environments.surveys.edit.shrink_preview") : t("environments.surveys.edit.expand_preview")}></button>
aria-label={
isFullScreenPreview
? t("environments.surveys.edit.shrink_preview")
: t("environments.surveys.edit.expand_preview")
}></button>
</div>
<div className="ml-4 flex w-full justify-between font-mono text-sm text-slate-400">
<p>

View File

@@ -765,6 +765,7 @@ export function Survey({
headline={localSurvey.welcomeCard.headline}
subheader={localSurvey.welcomeCard.subheader}
fileUrl={localSurvey.welcomeCard.fileUrl}
videoUrl={localSurvey.welcomeCard.videoUrl}
buttonLabel={localSurvey.welcomeCard.buttonLabel}
onSubmit={onSubmit}
survey={localSurvey}

View File

@@ -8,6 +8,7 @@ import { ScrollableContainer } from "@/components/wrappers/scrollable-container"
import { getLocalizedValue } from "@/lib/i18n";
import { replaceRecallInfo } from "@/lib/recall";
import { calculateElementIdx, getElementsFromSurveyBlocks } from "@/lib/utils";
import { ElementMedia } from "./element-media";
import { Headline } from "./headline";
import { Subheader } from "./subheader";
@@ -15,6 +16,7 @@ interface WelcomeCardProps {
headline?: TI18nString;
subheader?: TI18nString;
fileUrl?: string;
videoUrl?: string;
buttonLabel?: TI18nString;
onSubmit: (data: TResponseData, ttc: TResponseTtc) => void;
survey: TJsEnvironmentStateSurvey;
@@ -69,6 +71,7 @@ export function WelcomeCard({
headline,
subheader,
fileUrl,
videoUrl,
buttonLabel,
onSubmit,
languageCode,
@@ -144,8 +147,8 @@ export function WelcomeCard({
return (
<ScrollableContainer fullSizeCards={fullSizeCards}>
<div>
{fileUrl ? (
<img src={fileUrl} className="mb-8 max-h-96 w-1/4 object-contain" alt={t("common.company_logo")} />
{fileUrl || videoUrl ? (
<ElementMedia imgUrl={fileUrl} videoUrl={videoUrl} altText={t("common.company_logo")} />
) : null}
<Headline