Skip to content

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

⚡️ Inline the default wordmark instead of fetching /static/logo.svg

Luke Vella3018420022f2
diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts
index cfde690f6..79729cfa9 100644
--- a/apps/web/next.config.ts
+++ b/apps/web/next.config.ts
@@ -158,6 +158,15 @@ const nextConfig: NextConfig = {
},
],
},
+ {
+ source: "/static/:path*",
+ headers: [
+ {
+ key: "Cache-Control",
+ value: "public, max-age=604800, stale-while-revalidate=86400",
+ },
+ ],
+ },
];
},
devIndicators:
diff --git a/apps/web/src/features/branding/assets/logo.svg b/apps/web/src/features/branding/assets/logo.svg
new file mode 100644
index 000000000..a86bd5d3c
--- /dev/null
+++ b/apps/web/src/features/branding/assets/logo.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 97 18">
+ <path fill-rule="evenodd" d="M1.565 0C.701 0 0 .7 0 1.565v14.87C0 17.299.7 18 1.565 18h14.87c.864 0 1.565-.7 1.565-1.565V1.565C18 .701 17.3 0 16.435 0H1.565zm14.799 4.09H1.636v12.274h14.728V4.09zm-2.277-1.742a.783.783 0 11-1.565 0 .783.783 0 011.565 0zM3.913 3.13a.783.783 0 100-1.565.783.783 0 000 1.565zm1.06 7.32a.391.391 0 010-.553l.553-.553a.391.391 0 01.553 0l1.974 1.973 4.321-4.321a.391.391 0 01.553 0l.554.553c.153.153.153.401 0 .554L8.332 13.25a.391.391 0 01-.553 0l-2.806-2.8zm27.246-7.825h-4.133V14h2.148V9.703h2.053L34.507 14h2.306v-.11l-2.51-4.702c.325-.142.617-.314.877-.516.38-.292.674-.654.883-1.086.208-.432.312-.943.312-1.531 0-.745-.167-1.373-.5-1.883-.333-.51-.81-.896-1.43-1.156-.62-.26-1.362-.391-2.226-.391zm-1.985 5.383h2.008c.443 0 .81-.078 1.102-.235.291-.156.51-.372.656-.648.151-.276.227-.591.227-.945 0-.38-.073-.709-.22-.985a1.482 1.482 0 00-.663-.648c-.297-.151-.672-.227-1.125-.227h-1.985v3.688zM45.97 2.625h.531L50.773 14h-2.28l-.855-2.531H43.39L42.54 14h-2.274l4.25-11.375h1.453zm-2.01 7.148h3.106l-1.556-4.61-1.55 4.61zm18.205 2.54V14h-7.219V2.625h2.149v9.688h5.07zM73.82 14v-1.688h-5.07V2.626h-2.148V14h7.218zm11.657-1.688V14H78.257V2.625h2.15v9.688h5.07zM91.71 7.93l-2.5-5.305h-2.375l3.789 7.21V14h2.18V9.836l3.78-7.211h-2.358L91.71 7.93z" clip-rule="evenodd" />
+</svg>
\ No newline at end of file
diff --git a/apps/web/src/features/branding/components/default-logo.tsx b/apps/web/src/features/branding/components/default-logo.tsx
index 52992b154..230ad6f61 100644
--- a/apps/web/src/features/branding/components/default-logo.tsx
+++ b/apps/web/src/features/branding/components/default-logo.tsx
@@ -1,6 +1,21 @@
import { cn } from "@rallly/ui";
+import LogoWordmark from "@/features/branding/assets/logo.svg";
import { DEFAULT_APP_NAME, LOGO_VIEWBOX } from "@/features/branding/constants";
+/**
+ * The default wordmark, inlined so the most viewed pages don't each fetch it.
+ * Light and dark variants differ only in color, so it uses `currentColor`.
+ */
+export function DefaultWordmark({ className }: { className?: string }) {
+ return (
+ <LogoWordmark
+ role="img"
+ aria-label={DEFAULT_APP_NAME}
+ className={cn("block text-[#4f46e5] dark:text-white", className)}
+ />
+ );
+}
+
/**
* Renders the default logo in the same viewbox as `Logo` with `size="fit"`.
* Static assets only, so it stays safe to render from client error boundaries
@@ -12,18 +27,7 @@ export function DefaultLogo({ className }: { className?: string }) {
className={cn("flex items-center justify-center", className)}
style={{ width: LOGO_VIEWBOX.width, height: LOGO_VIEWBOX.height }}
>
- {/* biome-ignore lint/performance/noImgElement: we don't need Image component here */}
- <img
- src="/static/logo.svg"
- alt={DEFAULT_APP_NAME}
- className="block max-h-full max-w-full object-contain dark:hidden"
- />
- {/* biome-ignore lint/performance/noImgElement: we don't need Image component here */}
- <img
- src="/static/logo-dark.svg"
- alt={DEFAULT_APP_NAME}
- className="hidden max-h-full max-w-full object-contain dark:block"
- />
+ <DefaultWordmark className="h-auto w-full" />
</div>
);
}
diff --git a/apps/web/src/features/branding/components/logo.tsx b/apps/web/src/features/branding/components/logo.tsx
index c3cdf2830..ae84596f5 100644
--- a/apps/web/src/features/branding/components/logo.tsx
+++ b/apps/web/src/features/branding/components/logo.tsx
@@ -1,6 +1,14 @@
import { cn } from "@rallly/ui";
import { env } from "@/env";
-import { LOGO_VIEWBOX } from "@/features/branding/constants";
+import {
+ DefaultLogo,
+ DefaultWordmark,
+} from "@/features/branding/components/default-logo";
+import {
+ DEFAULT_LOGO_URL,
+ DEFAULT_LOGO_URL_DARK,
+ LOGO_VIEWBOX,
+} from "@/features/branding/constants";
import { getInstanceBrandingConfig } from "@/features/branding/data";
const sizes = {
@@ -21,6 +29,21 @@ export const Logo = async ({
}) => {
const { logo } = await getInstanceBrandingConfig();
+ // The default logo is inlined; only a custom one is fetched as an image
+ if (logo.light === DEFAULT_LOGO_URL && logo.dark === DEFAULT_LOGO_URL_DARK) {
+ if (size === "fit") {
+ return <DefaultLogo className={className} />;
+ }
+ return (
+ <div
+ className={cn("inline-block", className)}
+ style={{ height: sizes[size].height }}
+ >
+ <DefaultWordmark className="h-full w-auto" />
+ </div>
+ );
+ }
+
if (size === "fit") {
return (
<div
diff --git a/apps/web/src/features/poll/components/poll-footer.tsx b/apps/web/src/features/poll/components/poll-footer.tsx
index 59779105b..895da3c84 100644
--- a/apps/web/src/features/poll/components/poll-footer.tsx
+++ b/apps/web/src/features/poll/components/poll-footer.tsx
@@ -4,13 +4,12 @@ import { cn } from "@rallly/ui";
import type React from "react";
import { InstanceFooterLinks } from "@/components/instance-footer-links";
import { Link } from "@/components/link";
+import LogoWordmark from "@/features/branding/assets/logo.svg";
import { useBranding } from "@/features/branding/client";
import { DEFAULT_APP_NAME } from "@/features/branding/constants";
import { usePoll } from "@/features/poll/client";
import { Trans } from "@/i18n/client";
-const LOGO_MASK = "url(/static/logo.svg) center / contain no-repeat";
-
/**
* Footer for the participant-facing poll surfaces: the invite page, and the
* admin page which previews it.
@@ -81,14 +80,7 @@ function PoweredByLink({ className }: { className: string }) {
}}
>
<Trans i18nKey="poweredBy" defaults="Powered by" />
- {/* The wordmark is masked so it inherits the pill's text color in both
- themes. The mask sits in an inline style because a url() in the
- stylesheet resolves against the asset host, not this page's origin. */}
- <span
- aria-hidden="true"
- className="h-3.5 w-[75px] bg-foreground"
- style={{ mask: LOGO_MASK, WebkitMask: LOGO_MASK }}
- />
+ <LogoWordmark aria-hidden="true" className="h-3.5 w-auto" />
<span className="sr-only"> {DEFAULT_APP_NAME}</span>
</Link>
);
diff --git a/apps/web/src/features/poll/vote/components/powered-by-link.tsx b/apps/web/src/features/poll/vote/components/powered-by-link.tsx
index c9113a266..c28efb938 100644
--- a/apps/web/src/features/poll/vote/components/powered-by-link.tsx
+++ b/apps/web/src/features/poll/vote/components/powered-by-link.tsx
@@ -1,11 +1,10 @@
"use client";
import { posthog } from "@rallly/posthog/client";
import { Link } from "@/components/link";
+import LogoWordmark from "@/features/branding/assets/logo.svg";
import { DEFAULT_APP_NAME } from "@/features/branding/constants";
import { Trans } from "@/i18n/client";
-const LOGO_MASK = "url(/static/logo.svg) center / contain no-repeat";
-
/** The attribution pill. Client only because the click is tracked. */
export function PoweredByLink({
pollId,
@@ -30,14 +29,7 @@ export function PoweredByLink({
}}
>
<Trans i18nKey="poweredBy" defaults="Powered by" />
- {/* The wordmark is masked so it inherits the pill's text color in both
- themes. The mask sits in an inline style because a url() in the
- stylesheet resolves against the asset host, not this page's origin. */}
- <span
- aria-hidden="true"
- className="h-3.5 w-[75px] bg-foreground"
- style={{ mask: LOGO_MASK, WebkitMask: LOGO_MASK }}
- />
+ <LogoWordmark aria-hidden="true" className="h-3.5 w-auto" />
<span className="sr-only"> {DEFAULT_APP_NAME}</span>
</Link>
);