Files
formbricks/apps/web/modules/survey/link/components/survey-inactive.tsx
T
Dhruwang Jariwala a5fa876aa3 feat: refactor translation key management (#6717)
Co-authored-by: Piyush Gupta <piyushguptaa2z123@gmail.com>
Co-authored-by: Piyush Gupta <56182734+gupta-piyush19@users.noreply.github.com>
Co-authored-by: Victor Hugo dos Santos <115753265+victorvhs017@users.noreply.github.com>
Co-authored-by: pandeymangg <anshuman.pandey9999@gmail.com>
Co-authored-by: Matti Nannt <matti@formbricks.com>
Co-authored-by: Matti Nannt <mail@matthiasnannt.com>
Co-authored-by: Johannes <johannes@formbricks.com>
Co-authored-by: Johannes <72809645+jobenjada@users.noreply.github.com>
2025-10-23 14:53:11 +00:00

73 lines
2.7 KiB
TypeScript

import { Project } from "@prisma/client";
import { CalendarClockIcon, CheckCircle2Icon, HelpCircleIcon, PauseCircleIcon } from "lucide-react";
import Image from "next/image";
import Link from "next/link";
import { TSurveyClosedMessage } from "@formbricks/types/surveys/types";
import { getTranslate } from "@/lingodotdev/server";
import { Button } from "@/modules/ui/components/button";
import footerLogo from "../lib/footerlogo.svg";
export const SurveyInactive = async ({
status,
surveyClosedMessage,
project,
}: {
status: "paused" | "completed" | "link invalid" | "response submitted" | "link expired";
surveyClosedMessage?: TSurveyClosedMessage | null;
project?: Pick<Project, "linkSurveyBranding">;
}) => {
const t = await getTranslate();
const icons = {
paused: <PauseCircleIcon className="h-20 w-20" />,
completed: <CheckCircle2Icon className="h-20 w-20" />,
"link invalid": <HelpCircleIcon className="h-20 w-20" />,
"response submitted": <CheckCircle2Icon className="h-20 w-20" />,
"link expired": <CalendarClockIcon className="h-20 w-20" />,
};
const descriptions = {
paused: t("s.paused"),
completed: t("s.completed"),
"link invalid": t("s.link_invalid"),
"response submitted": t("s.response_submitted"),
"link expired": t("c.link_expired_description"),
};
const showCTA =
status !== "link invalid" &&
status !== "link expired" &&
status !== "response submitted" &&
((status !== "paused" && status !== "completed") || project?.linkSurveyBranding || !project) &&
!(status === "completed" && surveyClosedMessage);
return (
<div className="flex h-full flex-col items-center justify-between bg-gradient-to-br from-slate-200 to-slate-50 px-4 py-8 text-center">
<div className="my-auto flex flex-col items-center space-y-3 text-slate-300">
{icons[status]}
<h1 className="text-4xl font-bold text-slate-800">
{(status === "completed" || status === "link expired") && surveyClosedMessage
? surveyClosedMessage.heading
: `${t("common.survey")} ${status}.`}
</h1>
<p className="text-lg leading-10 text-slate-500">
{status === "completed" && surveyClosedMessage
? surveyClosedMessage.subheading
: descriptions[status]}
</p>
{showCTA && (
<Button className="mt-2" asChild>
<Link href="https://formbricks.com">{t("s.create_your_own")}</Link>
</Button>
)}
</div>
{(!project || project.linkSurveyBranding) && (
<div>
<Link href="https://formbricks.com">
<Image src={footerLogo as string} alt="Brand logo" className="mx-auto w-40" />
</Link>
</div>
)}
</div>
);
};