feat: Added a not-connected state to the survey state indicator

feat: Added a not-connected state to the survey state indicator
This commit is contained in:
Johannes
2023-10-06 19:40:42 +05:45
committed by GitHub
2 changed files with 25 additions and 4 deletions

View File

@@ -81,7 +81,12 @@ export default async function SurveysList({ environmentId }: { environmentId: st
<div className="flex items-center">
{survey.status !== "draft" && (
<>
<SurveyStatusIndicator status={survey.status} tooltip environment={environment} />
<SurveyStatusIndicator
status={survey.status}
tooltip
environment={environment}
type={survey.type}
/>
</>
)}
{survey.status === "draft" && (

View File

@@ -2,16 +2,32 @@
import { TEnvironment } from "@formbricks/types/v1/environment";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@formbricks/ui";
import { ArchiveBoxIcon, CheckIcon, PauseIcon } from "@heroicons/react/24/solid";
import { ArchiveBoxIcon, CheckIcon, PauseIcon, ExclamationTriangleIcon } from "@heroicons/react/24/solid";
interface SurveyStatusIndicatorProps {
status: string;
tooltip?: boolean;
environment: TEnvironment;
type: string;
}
export default function SurveyStatusIndicator({ status, tooltip, environment }: SurveyStatusIndicatorProps) {
if (!environment.widgetSetupCompleted) return null;
export default function SurveyStatusIndicator({
status,
tooltip,
environment,
type,
}: SurveyStatusIndicatorProps) {
if (!environment.widgetSetupCompleted) {
if (type === "web") {
return (
<div>
<ExclamationTriangleIcon className="h-4 w-4 text-amber-500" />
</div>
);
} else {
return null;
}
}
if (tooltip) {
return (
<TooltipProvider>