mirror of
https://github.com/excalidraw/excalidraw.git
synced 2026-12-06 03:05:18 +03:00
feat(app): rotate promo banner messages per editor load (#12664)
Pick one of several promos (presentations, MCP, comments, teams, voice chat, CLI) at random on load, each with its own icon and utm_content. The CLI promo links to its GitHub repo in a blue variant.
This commit is contained in:
1 parent
680f58ccfd
commit
9fbeaed54a
3 files changed
+109
-18
No files matched your search
@@ -1,5 +1,72 @@
|
||||
import { PlusPromoIcon } from "@excalidraw/excalidraw/components/icons";
|
||||
import {
|
||||
PlusPromoIcon,
|
||||
brainIcon,
|
||||
codeIcon,
|
||||
messageCircleIcon,
|
||||
microphoneIcon,
|
||||
presentationIcon,
|
||||
usersIcon,
|
||||
} from "@excalidraw/excalidraw/components/icons";
|
||||
import { useI18n } from "@excalidraw/excalidraw/i18n";
|
||||
import clsx from "clsx";
|
||||
|
||||
import type { TranslationKeys } from "@excalidraw/excalidraw/i18n";
|
||||
|
||||
const plusLink = (utmContent: string) =>
|
||||
`${
|
||||
import.meta.env.VITE_APP_PLUS_LP
|
||||
}/plus?utm_source=excalidraw&utm_medium=app&utm_content=${utmContent}#excalidraw-redirect`;
|
||||
|
||||
// each must stay within the original "Try Excalidraw+ / 14-day free trial"
|
||||
// button width (~93px of text)
|
||||
const PROMOS: readonly {
|
||||
href: string;
|
||||
icon: React.ReactNode;
|
||||
title: TranslationKeys;
|
||||
subtitle: TranslationKeys;
|
||||
className?: string;
|
||||
}[] = [
|
||||
{
|
||||
href: plusLink("guestBanner_presentations"),
|
||||
icon: presentationIcon,
|
||||
title: "promoBanner.presentations",
|
||||
subtitle: "promoBanner.withExcalidrawPlus",
|
||||
},
|
||||
{
|
||||
href: plusLink("guestBanner_mcp"),
|
||||
icon: brainIcon,
|
||||
title: "promoBanner.mcp",
|
||||
subtitle: "promoBanner.excalidrawPlusMcp",
|
||||
},
|
||||
{
|
||||
href: plusLink("guestBanner_comments"),
|
||||
icon: messageCircleIcon,
|
||||
title: "promoBanner.comments",
|
||||
subtitle: "promoBanner.withExcalidrawPlus",
|
||||
},
|
||||
{
|
||||
href: plusLink("guestBanner_teams"),
|
||||
icon: usersIcon,
|
||||
title: "promoBanner.teams",
|
||||
subtitle: "promoBanner.withExcalidrawPlus",
|
||||
},
|
||||
{
|
||||
href: plusLink("guestBanner_voice"),
|
||||
icon: microphoneIcon,
|
||||
title: "promoBanner.voiceChat",
|
||||
subtitle: "promoBanner.withExcalidrawPlus",
|
||||
},
|
||||
{
|
||||
href: "https://github.com/excalidraw/cli",
|
||||
icon: codeIcon,
|
||||
title: "promoBanner.cli",
|
||||
subtitle: "promoBanner.cliTagline",
|
||||
className: "plus-banner--blue",
|
||||
},
|
||||
];
|
||||
|
||||
// picked once per editor load
|
||||
const promo = PROMOS[Math.floor(Math.random() * PROMOS.length)];
|
||||
|
||||
export const ExcalidrawPlusPromoBanner = ({
|
||||
isSignedIn,
|
||||
@@ -9,26 +76,20 @@ export const ExcalidrawPlusPromoBanner = ({
|
||||
const { t } = useI18n();
|
||||
return (
|
||||
<a
|
||||
href={
|
||||
isSignedIn
|
||||
? import.meta.env.VITE_APP_PLUS_APP
|
||||
: `${
|
||||
import.meta.env.VITE_APP_PLUS_LP
|
||||
}/plus?utm_source=excalidraw&utm_medium=app&utm_content=guestBanner#excalidraw-redirect`
|
||||
}
|
||||
href={isSignedIn ? import.meta.env.VITE_APP_PLUS_APP : promo.href}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
className="plus-banner"
|
||||
className={clsx("plus-banner", !isSignedIn && promo.className)}
|
||||
>
|
||||
<span className="plus-banner__icon">{PlusPromoIcon}</span>
|
||||
<span className="plus-banner__icon">
|
||||
{isSignedIn ? PlusPromoIcon : promo.icon}
|
||||
</span>
|
||||
<span className="plus-banner__text">
|
||||
<span className="plus-banner__title">
|
||||
{isSignedIn ? t("labels.signIn") : t("labels.tryExcalidrawPlus")}
|
||||
{isSignedIn ? t("labels.signIn") : t(promo.title)}
|
||||
</span>
|
||||
{!isSignedIn && (
|
||||
<span className="plus-banner__subtitle">
|
||||
{t("labels.plusFreeTrial")}
|
||||
</span>
|
||||
<span className="plus-banner__subtitle">{t(promo.subtitle)}</span>
|
||||
)}
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -91,6 +91,8 @@
|
||||
--plus-banner-bg-hover: var(--color-primary-light);
|
||||
--plus-banner-border: var(--color-primary-light-darker);
|
||||
--plus-banner-subtitle: #8b88e0;
|
||||
--plus-banner-color: var(--color-primary);
|
||||
--plus-banner-active: var(--color-brand-active);
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -100,7 +102,7 @@
|
||||
border: 1px solid var(--plus-banner-border);
|
||||
border-radius: var(--border-radius-lg);
|
||||
background-color: var(--plus-banner-bg);
|
||||
color: var(--color-primary) !important;
|
||||
color: var(--plus-banner-color) !important;
|
||||
text-decoration: none !important;
|
||||
font-family: var(--ui-font);
|
||||
box-sizing: border-box;
|
||||
@@ -114,7 +116,17 @@
|
||||
}
|
||||
|
||||
&:active {
|
||||
border-color: var(--color-brand-active);
|
||||
border-color: var(--plus-banner-active);
|
||||
}
|
||||
|
||||
// non-E+ promos (e.g. the CLI)
|
||||
&--blue {
|
||||
--plus-banner-bg: #e7f5ff;
|
||||
--plus-banner-bg-hover: #d0ebff;
|
||||
--plus-banner-border: #a5d8ff;
|
||||
--plus-banner-subtitle: #339af0;
|
||||
--plus-banner-color: #1971c2;
|
||||
--plus-banner-active: #1971c2;
|
||||
}
|
||||
|
||||
&__icon {
|
||||
@@ -155,4 +167,13 @@
|
||||
--plus-banner-border: #4f4d6f;
|
||||
--plus-banner-subtitle: #8f8cc4;
|
||||
}
|
||||
|
||||
.plus-banner--blue {
|
||||
--plus-banner-bg: #1d2b38;
|
||||
--plus-banner-bg-hover: #2a4257;
|
||||
--plus-banner-border: #34516b;
|
||||
--plus-banner-subtitle: #6b9cc4;
|
||||
--plus-banner-color: #74c0fc;
|
||||
--plus-banner-active: #74c0fc;
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,6 @@
|
||||
"signUp": "Sign up",
|
||||
"signIn": "Sign in",
|
||||
"upgrade": "Upgrade",
|
||||
"tryExcalidrawPlus": "Try Excalidraw+",
|
||||
"plusFreeTrial": "14-day free trial",
|
||||
"paste": "Paste",
|
||||
"pasteAsPlaintext": "Paste as plaintext",
|
||||
"pasteCharts": "Paste charts",
|
||||
@@ -787,5 +785,16 @@
|
||||
"spacebar": "Space",
|
||||
"delete": "Delete",
|
||||
"mmb": "Scroll wheel"
|
||||
},
|
||||
"promoBanner": {
|
||||
"presentations": "Presentations",
|
||||
"mcp": "Draw with AI",
|
||||
"comments": "Make comments",
|
||||
"teams": "Work in a team",
|
||||
"voiceChat": "Voice chat",
|
||||
"withExcalidrawPlus": "with Excalidraw+",
|
||||
"excalidrawPlusMcp": "Excalidraw+ MCP",
|
||||
"cli": "Excalidraw CLI",
|
||||
"cliTagline": "for humans & AI"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user