Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
♻️ Update custom branding prompt behavior and copy
Luke Vella8f082bdf4651
diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.jsonindex ed8f5a0dc..7fd427801 100644--- a/apps/web/public/locales/en/app.json+++ b/apps/web/public/locales/en/app.json@@ -625,7 +625,7 @@"customBranding": "Custom Branding","customBrandingDescription": "Show your logo and brand colors to your participants","customBrandingPromptTitle": "Custom Branding",- "customBrandingPromptDescription": "You're on the Pro plan. Add your brand colors to polls and emails.",+ "customBrandingPromptDescription": "Get professional scheduling polls with your own logo and colors.","customBrandingPromptCta": "Set Up Now","dismiss": "Dismiss","new": "New"diff --git a/apps/web/src/features/branding/components/custom-branding-prompt.tsx b/apps/web/src/features/branding/components/custom-branding-prompt.tsxindex 90aeb74d6..faa7d3b25 100644--- a/apps/web/src/features/branding/components/custom-branding-prompt.tsx+++ b/apps/web/src/features/branding/components/custom-branding-prompt.tsx@@ -7,27 +7,34 @@ import Image from "next/image";import Link from "next/link";import React from "react";import { useLocalStorage } from "react-use";+import { useUser } from "@/components/user-provider";import { useSpace } from "@/features/space/client";import { Trans, useTranslation } from "@/i18n/client";+import { isBusinessEmail } from "@/utils/is-business-email";export function CustomBrandingPrompt() {const { t } = useTranslation();const { data: space } = useSpace();+ const { user } = useUser();const posthog = usePostHog();const [isDismissed, setIsDismissed] = useLocalStorage(- `custom-branding-prompt-dismissed-${space.id}`,+ "custom-branding-prompt-dismissed",false,);const [showPrompt, setShowPrompt] = React.useState(false);+ const hasBusinessEmail = user?.email ? isBusinessEmail(user.email) : false;+React.useEffect(() => {- if (space.tier === "hobby" || space.showBranding) {+ if (space.showBranding) {return;}- setShowPrompt(true);- }, [space.showBranding, space.tier]);+ if (hasBusinessEmail) {+ setShowPrompt(true);+ }+ }, [space.showBranding, hasBusinessEmail]);if (isDismissed || !showPrompt) {return null;@@ -64,7 +71,7 @@ export function CustomBrandingPrompt() {<p className="mt-2 text-muted-foreground text-sm leading-relaxed"><Transi18nKey="customBrandingPromptDescription"- defaults="You're on the Pro plan. Add your brand colors to polls and emails."+ defaults="Get professional scheduling polls with your own logo and colors."/></p><div className="mt-6 flex gap-2">diff --git a/apps/web/src/utils/is-business-email.ts b/apps/web/src/utils/is-business-email.tsnew file mode 100644index 000000000..5ee1a61c5--- /dev/null+++ b/apps/web/src/utils/is-business-email.ts@@ -0,0 +1,82 @@+const FREE_EMAIL_DOMAINS = new Set([+ "gmail.com",+ "googlemail.com",+ // Microsoft+ "outlook.com",+ "hotmail.com",+ "hotmail.co.uk",+ "hotmail.fr",+ "live.com",+ "live.co.uk",+ "msn.com",+ // Apple+ "icloud.com",+ "me.com",+ "mac.com",+ // Yahoo+ "yahoo.com",+ "yahoo.co.uk",+ "yahoo.fr",+ "yahoo.de",+ "yahoo.es",+ "yahoo.it",+ "yahoo.com.au",+ "yahoo.com.br",+ "yahoo.ca",+ "ymail.com",+ // Proton+ "proton.me",+ "protonmail.com",+ "protonmail.ch",+ "pm.me",+ // Other popular free providers+ "aol.com",+ "aim.com",+ "mail.com",+ "zoho.com",+ "gmx.com",+ "gmx.de",+ "gmx.net",+ "web.de",+ "t-online.de",+ "freenet.de",+ "yandex.com",+ "yandex.ru",+ "mail.ru",+ "inbox.com",+ "fastmail.com",+ "fastmail.fm",+ "hey.com",+ "tutanota.com",+ "tutamail.com",+ "tuta.io",+ // Telecom / ISP providers+ "verizon.net",+ "att.net",+ "bellsouth.net",+ "comcast.net",+ "sbcglobal.net",+ "cox.net",+ "charter.net",+ "earthlink.net",+ "optonline.net",+ "btinternet.com",+ "virginmedia.com",+ "sky.com",+ "ntlworld.com",+ "talktalk.net",+ "orange.fr",+ "free.fr",+ "sfr.fr",+ "laposte.net",+ "wanadoo.fr",+ "bbox.fr",+ "numericable.fr",+]);++export function isBusinessEmail(email: string): boolean {+ const domain = email.split("@")[1]?.toLowerCase();+ if (!domain) return false;+ return !FREE_EMAIL_DOMAINS.has(domain);+}