From 7843e2da991237a2e86e19e120ff4c80d19b472c Mon Sep 17 00:00:00 2001 From: Johannes <72809645+jobenjada@users.noreply.github.com> Date: Mon, 12 Feb 2024 12:51:52 +0100 Subject: [PATCH] fix: update Upgrade Notifier in branding removal (#2058) --- .../lookandfeel/components/EditBranding.tsx | 66 +++++++++---------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/lookandfeel/components/EditBranding.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/lookandfeel/components/EditBranding.tsx index 97936d902e..c7d0fd7e2e 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/lookandfeel/components/EditBranding.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/lookandfeel/components/EditBranding.tsx @@ -1,13 +1,12 @@ "use client"; -import Link from "next/link"; import { useState } from "react"; import toast from "react-hot-toast"; import { TProduct, TProductUpdateInput } from "@formbricks/types/product"; -import { Alert, AlertDescription } from "@formbricks/ui/Alert"; import { Label } from "@formbricks/ui/Label"; import { Switch } from "@formbricks/ui/Switch"; +import { UpgradePlanNotice } from "@formbricks/ui/UpgradePlanNotice"; import { updateProductAction } from "../actions"; @@ -31,11 +30,6 @@ export function EditFormbricksBranding({ ); const [updatingBranding, setUpdatingBranding] = useState(false); - const getTextFromType = (type) => { - if (type === "linkSurvey") return "Link Surveys"; - if (type === "inAppSurvey") return "In App Surveys"; - }; - const toggleBranding = async () => { try { setUpdatingBranding(true); @@ -45,9 +39,7 @@ export function EditFormbricksBranding({ [type === "linkSurvey" ? "linkSurveyBranding" : "inAppSurveyBranding"]: newBrandingState, }; await updateProductAction(product.id, inputProduct); - toast.success( - newBrandingState ? "Formbricks branding will be shown." : "Formbricks branding will now be hidden." - ); + toast.success(newBrandingState ? "Formbricks branding is shown." : "Formbricks branding is hidden."); } catch (error) { toast.error(`Error: ${error.message}`); } finally { @@ -56,31 +48,8 @@ export function EditFormbricksBranding({ }; return ( -
- {!canRemoveBranding && ( -
- - - To remove the Formbricks branding from the  - {getTextFromType(type)}, please  - {type === "linkSurvey" ? ( - - upgrade your plan. - - ) : ( - - {isFormbricksCloud ? ( - add your creditcard. - ) : ( - get a self-hosted license (free to get started). - )} - - )} - - -
- )} -
+
+
+ {!canRemoveBranding && ( +
+ {type === "linkSurvey" && ( +
+ +
+ )} + {type !== "linkSurvey" && !isFormbricksCloud && ( + + )} + {type !== "linkSurvey" && isFormbricksCloud && ( + + )} +
+ )}
); }