Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

✨ Add branding page (#2102)

Luke Vellacfd8bdfb58f1
diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.json
index 95000446c..e9979a999 100644
--- a/apps/web/public/locales/en/app.json
+++ b/apps/web/public/locales/en/app.json
@@ -563,5 +563,17 @@
"usersDescription": "Manage users on this instance",
"whiteLabelAddon": "White Label Add-on",
"whiteLabelAddonDescription": "This add-on allows you to brand Rallly with your own logo and colors.",
- "refreshLicense": "Refresh License"
+ "refreshLicense": "Refresh License",
+ "setEnvironmentVariable": "This value can be changed by setting the <env /> environment variable.",
+ "branding": "Branding",
+ "brandingDescription": "View your instance branding configuration",
+ "customBrandingAlertDescription": "Custom branding is available to Enterprise license holders as a paid add-on.",
+ "colors": "Colors",
+ "colorsDescription": "Primary colors used for theming",
+ "primaryColor": "Primary Color",
+ "primaryColorDark": "Primary Color (Dark Mode)",
+ "logos": "Logos",
+ "logosDescription": "Logo images used throughout the application",
+ "logo": "Logo",
+ "logoIcon": "Logo Icon"
}
diff --git a/apps/web/src/app/[locale]/control-panel/branding/page.tsx b/apps/web/src/app/[locale]/control-panel/branding/page.tsx
new file mode 100644
index 000000000..9184e3fd6
--- /dev/null
+++ b/apps/web/src/app/[locale]/control-panel/branding/page.tsx
@@ -0,0 +1,207 @@
+import { Alert, AlertDescription } from "@rallly/ui/alert";
+import { CodeIcon, GemIcon } from "lucide-react";
+import type { Metadata } from "next";
+import {
+ PageSection,
+ PageSectionContent,
+ PageSectionDescription,
+ PageSectionGroup,
+ PageSectionHeader,
+ PageSectionTitle,
+} from "@/app/components/page-layout";
+import {
+ SettingsPage,
+ SettingsPageContent,
+ SettingsPageDescription,
+ SettingsPageHeader,
+ SettingsPageTitle,
+} from "@/app/components/settings-layout";
+import { requireAdmin } from "@/auth/data";
+import { Trans } from "@/components/trans";
+import { env } from "@/env";
+import {
+ getLogoIconUrl,
+ getLogoUrl,
+ getPrimaryColor,
+ hasWhiteLabelAddon,
+} from "@/features/branding/queries";
+import { getTranslation } from "@/i18n/server";
+
+async function loadData() {
+ await requireAdmin();
+ return {
+ primaryColor: getPrimaryColor(),
+ primaryColorDark: env.PRIMARY_COLOR_DARK,
+ logoUrl: getLogoUrl(),
+ hasWhiteLabelAddon: await hasWhiteLabelAddon(),
+ logoIconUrl: getLogoIconUrl(),
+ };
+}
+
+function SetEnvironmentVariableAlert({ variable }: { variable: string }) {
+ return (
+ <Alert>
+ <CodeIcon />
+ <AlertDescription>
+ <p>
+ <Trans
+ i18nKey="setEnvironmentVariable"
+ defaults="This value can be changed by setting the <env /> environment variable."
+ components={{
+ env: <code className="font-mono text-sm">{variable}</code>,
+ }}
+ />
+ </p>
+ </AlertDescription>
+ </Alert>
+ );
+}
+
+export default async function BrandingPage() {
+ const {
+ primaryColor,
+ primaryColorDark,
+ logoUrl,
+ logoIconUrl,
+ hasWhiteLabelAddon,
+ } = await loadData();
+
+ return (
+ <SettingsPage>
+ <SettingsPageHeader>
+ <SettingsPageTitle>
+ <Trans i18nKey="branding" defaults="Branding" />
+ </SettingsPageTitle>
+ <SettingsPageDescription>
+ <Trans
+ i18nKey="brandingDescription"
+ defaults="View your instance branding configuration"
+ />
+ </SettingsPageDescription>
+ </SettingsPageHeader>
+ <SettingsPageContent>
+ {!hasWhiteLabelAddon ? (
+ <Alert variant="primary">
+ <GemIcon />
+ <AlertDescription>
+ <p>
+ <Trans
+ i18nKey="customBrandingAlertDescription"
+ defaults="Custom branding is available to Enterprise license holders as a paid add-on."
+ />
+ </p>
+ </AlertDescription>
+ </Alert>
+ ) : null}
+ <PageSectionGroup>
+ <PageSection variant="card">
+ <PageSectionHeader>
+ <PageSectionTitle>
+ <Trans i18nKey="colors" defaults="Colors" />
+ </PageSectionTitle>
+ <PageSectionDescription>
+ <Trans
+ i18nKey="colorsDescription"
+ defaults="Primary colors used for theming"
+ />
+ </PageSectionDescription>
+ </PageSectionHeader>
+ <PageSectionContent>
+ <div className="space-y-6">
+ <div className="space-y-2">
+ <div className="text-muted-foreground text-xs">
+ <Trans i18nKey="primaryColor" defaults="Primary Color" />
+ </div>
+ <div className="flex items-center gap-2">
+ <div
+ className="size-8 rounded border"
+ style={{ backgroundColor: primaryColor }}
+ />
+ <span className="font-mono text-sm">{primaryColor}</span>
+ </div>
+ <SetEnvironmentVariableAlert variable="PRIMARY_COLOR" />
+ </div>
+ {primaryColorDark ? (
+ <div className="space-y-2">
+ <div className="text-muted-foreground text-xs">
+ <Trans
+ i18nKey="primaryColorDark"
+ defaults="Primary Color (Dark Mode)"
+ />
+ </div>
+ <div className="flex items-center gap-2">
+ <div
+ className="size-8 rounded border"
+ style={{ backgroundColor: primaryColorDark }}
+ />
+ <span className="font-mono text-sm">
+ {primaryColorDark}
+ </span>
+ </div>
+ <SetEnvironmentVariableAlert variable="PRIMARY_COLOR_DARK" />
+ </div>
+ ) : null}
+ </div>
+ </PageSectionContent>
+ </PageSection>
+ <PageSection variant="card">
+ <PageSectionHeader>
+ <PageSectionTitle>
+ <Trans i18nKey="logos" defaults="Logos" />
+ </PageSectionTitle>
+ <PageSectionDescription>
+ <Trans
+ i18nKey="logosDescription"
+ defaults="Logo images used throughout the application"
+ />
+ </PageSectionDescription>
+ </PageSectionHeader>
+ <PageSectionContent>
+ <div className="space-y-6">
+ <div className="space-y-2">
+ <div className="text-muted-foreground text-xs">
+ <Trans i18nKey="logo" defaults="Logo" />
+ </div>
+ <div className="flex items-center gap-4">
+ <div className="flex w-48 items-center justify-center overflow-hidden rounded border">
+ {/* biome-ignore lint/performance/noImgElement: external URLs may not work with Next.js Image */}
+ <img
+ src={logoUrl}
+ alt="Logo"
+ className="max-h-full max-w-full object-contain p-2"
+ />
+ </div>
+ </div>
+ <SetEnvironmentVariableAlert variable="LOGO_URL" />
+ </div>
+ <div className="space-y-2">
+ <div className="text-muted-foreground text-xs">
+ <Trans i18nKey="logoIcon" defaults="Logo Icon" />
+ </div>
+ <div className="flex items-center gap-4">
+ <div className="flex size-16 items-center justify-center overflow-hidden rounded border">
+ {/* biome-ignore lint/performance/noImgElement: external URLs may not work with Next.js Image */}
+ <img
+ src={logoIconUrl}
+ alt="Logo Icon"
+ className="max-h-full max-w-full object-contain p-2"
+ />
+ </div>
+ </div>
+ <SetEnvironmentVariableAlert variable="LOGO_ICON_URL" />
+ </div>
+ </div>
+ </PageSectionContent>
+ </PageSection>
+ </PageSectionGroup>
+ </SettingsPageContent>
+ </SettingsPage>
+ );
+}
+
+export async function generateMetadata(): Promise<Metadata> {
+ const { t } = await getTranslation();
+ return {
+ title: t("branding", { defaultValue: "Branding" }),
+ };
+}
diff --git a/apps/web/src/app/[locale]/control-panel/page.tsx b/apps/web/src/app/[locale]/control-panel/page.tsx
index 6d522065f..a0678b620 100644
--- a/apps/web/src/app/[locale]/control-panel/page.tsx
+++ b/apps/web/src/app/[locale]/control-panel/page.tsx
@@ -5,6 +5,7 @@ import { Tile, TileGrid, TileTitle } from "@rallly/ui/tile";
import {
InfinityIcon,
KeySquareIcon,
+ PaletteIcon,
SettingsIcon,
UsersIcon,
} from "lucide-react";
@@ -109,6 +110,19 @@ export default async function AdminPage() {
</TileTitle>
</Link>
</Tile>
+ {/* BRANDING */}
+ <Tile asChild>
+ <Link href="/control-panel/branding">
+ <div className="flex justify-between">
+ <PageIcon>
+ <PaletteIcon />
+ </PageIcon>
+ </div>
+ <TileTitle>
+ <Trans i18nKey="branding" defaults="Branding" />
+ </TileTitle>
+ </Link>
+ </Tile>
{/* INSTANCE SETTINGS */}
<Tile asChild>
<Link href="/control-panel/settings">
diff --git a/apps/web/src/app/[locale]/control-panel/sidebar.tsx b/apps/web/src/app/[locale]/control-panel/sidebar.tsx
index ddc604214..b234ab5d7 100644
--- a/apps/web/src/app/[locale]/control-panel/sidebar.tsx
+++ b/apps/web/src/app/[locale]/control-panel/sidebar.tsx
@@ -10,6 +10,7 @@ import {
ArrowLeftIcon,
HomeIcon,
KeySquareIcon,
+ PaletteIcon,
SettingsIcon,
UsersIcon,
} from "lucide-react";
@@ -50,6 +51,10 @@ export async function ControlPanelSidebar({
<KeySquareIcon className="size-4" />
<Trans i18nKey="license" defaults="License" />
</NavItem>
+ <NavItem href="/control-panel/branding">
+ <PaletteIcon className="size-4" />
+ <Trans i18nKey="branding" defaults="Branding" />
+ </NavItem>
<NavItem href="/control-panel/settings">
<SettingsIcon className="size-4" />
<Trans i18nKey="settings" defaults="Settings" />
diff --git a/apps/web/src/features/branding/queries.ts b/apps/web/src/features/branding/queries.ts
index d1eaa02fd..843c49c04 100644
--- a/apps/web/src/features/branding/queries.ts
+++ b/apps/web/src/features/branding/queries.ts
@@ -2,6 +2,7 @@ import "server-only";
import type React from "react";
import { env } from "@/env";
+import { loadInstanceLicense } from "@/features/licensing/data";
import { adjustColorForContrast, getForegroundColor } from "@/utils/color";
import {
DARK_MODE_BACKGROUND,
@@ -47,3 +48,8 @@ export function getLogoUrl() {
export function getLogoIconUrl() {
return env.LOGO_ICON_URL ?? DEFAULT_LOGO_ICON_URL;
}
+
+export async function hasWhiteLabelAddon() {
+ const license = await loadInstanceLicense();
+ return license?.whiteLabelAddon ?? false;
+}