From e5e17d75ae70f25b4775b5865d096cf1b0724cbc Mon Sep 17 00:00:00 2001 From: openhands Date: Sat, 12 Sep 2026 17:28:01 +0200 Subject: [PATCH] perf(site): inline small classic icons and favicon as base64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - New src/lib/site-icons.ts: base64 data URIs for the 13 tiny classic icons actually referenced in markup (100–2000 bytes), replacing extra requests with inline payloads. home.png, dynamic flags and currency sets stay on the filesystem. - Default favicon is now served server-side as a base64 SVG data URI (memoized), while a DB-configured custom favicon still takes priority. - Icons render through , so data URIs pass through untouched on all affected pages (home, login, register, settings, navigation, auth top bar, client loading). --- src/app/(site)/login/page.tsx | 7 ++-- src/app/(site)/page.tsx | 36 ++++++++++------- src/app/(site)/register/page.tsx | 7 ++-- src/app/(site)/settings/page.tsx | 17 +++++--- src/app/client/loading.tsx | 3 +- src/app/layout.tsx | 3 +- src/components/auth/auth-top-bar.tsx | 3 +- src/components/navigation.tsx | 59 ++++++++++++---------------- src/lib/default-favicon.ts | 15 +++++++ src/lib/site-icons.ts | 42 ++++++++++++++++++++ 10 files changed, 128 insertions(+), 64 deletions(-) create mode 100644 src/lib/default-favicon.ts create mode 100644 src/lib/site-icons.ts diff --git a/src/app/(site)/login/page.tsx b/src/app/(site)/login/page.tsx index c2148ddf..35278c30 100644 --- a/src/app/(site)/login/page.tsx +++ b/src/app/(site)/login/page.tsx @@ -12,6 +12,7 @@ import { db, User } from "@/lib/db"; import { resolveHotelName } from "@/lib/hotel-name"; import { captchaConfig } from "@/lib/services/captcha"; import { siteSettings } from "@/lib/services/site-settings"; +import { ICON_FRIENDS, ICON_NAV_GOODY, ICON_NAV_ME } from "@/lib/site-icons"; export default async function LoginPage() { const t = await getTranslations("pages.login"); @@ -117,7 +118,7 @@ export default async function LoginPage() { {recentUsers.length > 0 && ( @@ -154,7 +155,7 @@ export default async function LoginPage() { {latestUsers.length > 0 && ( @@ -193,7 +194,7 @@ export default async function LoginPage() {

) : ( {hotelName} ( @@ -458,7 +467,7 @@ export default async function Home() { 0 && ( @@ -588,10 +597,7 @@ export default async function Home() { ) : ( recentPhotos.length > 0 && ( - +

{recentPhotos.slice(0, 4).map((p) => ( 0 && ( @@ -163,7 +164,7 @@ export default async function RegisterPage() { {latestUsers.length > 0 && ( @@ -202,7 +203,7 @@ export default async function RegisterPage() {

@@ -161,7 +166,7 @@ export default async function SettingsPage({

{ const appUrl = process.env.APP_URL ?? "http://localhost:3000"; const hotel = await resolveHotelName(); const customFavicon = await siteSettings.get("cms_favicon"); - const faviconUrl = customFavicon ?? "/favicon.svg"; + const faviconUrl = customFavicon ?? getDefaultFaviconDataUri(); const icons = [ { rel: "icon", url: faviconUrl }, { rel: "shortcut icon", url: faviconUrl }, diff --git a/src/components/auth/auth-top-bar.tsx b/src/components/auth/auth-top-bar.tsx index 3fe731a4..6ab9fcb9 100644 --- a/src/components/auth/auth-top-bar.tsx +++ b/src/components/auth/auth-top-bar.tsx @@ -3,6 +3,7 @@ import { Clock } from "@/components/clock"; import { LanguageSwitcher } from "@/components/language-switcher"; import { Reveal } from "@/components/motion-reveal"; import { ThemeSwitcher } from "@/components/theme-switcher"; +import { ICON_LIGHTHOUSE } from "@/lib/site-icons"; /** * Shared frosted-glass top bar for the public auth pages (login, register, @@ -47,7 +48,7 @@ export function AuthTopBar({ /> ) : ( {hotelName} - + {t("articles")} @@ -120,10 +126,7 @@ export async function Navigation({ session }: { session: Session | null }) { - + {t("shop")} @@ -137,7 +140,7 @@ export async function Navigation({ session }: { session: Session | null }) { - + {t("helpCenter")} @@ -185,7 +185,7 @@ export async function Navigation({ session }: { session: Session | null }) { <> - + {t("articles")} @@ -328,10 +325,7 @@ export async function Navigation({ session }: { session: Session | null }) { - + {t("shop")} @@ -345,7 +339,7 @@ export async function Navigation({ session }: { session: Session | null }) { - + {t("helpCenter")} @@ -393,7 +384,7 @@ export async function Navigation({ session }: { session: Session | null }) { <>