From 4f39c097e4503cac9d88d8317a162749d2c1e62c Mon Sep 17 00:00:00 2001 From: MOH Date: Sat, 7 Mar 2026 18:44:00 +0100 Subject: [PATCH] Use dynamic favicon in root sidebar --- components/dashboard/dashboard-layout.tsx | 16 ++++++++++++++-- components/dashboard/sidebar.tsx | 11 ++++++++--- components/root/root-dashboard-shell.tsx | 7 ++++++- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/components/dashboard/dashboard-layout.tsx b/components/dashboard/dashboard-layout.tsx index 3115865..4a7220e 100644 --- a/components/dashboard/dashboard-layout.tsx +++ b/components/dashboard/dashboard-layout.tsx @@ -18,6 +18,7 @@ type DashboardLayoutProps = { description: string; icon?: LucideIcon; items: RootNavItem[]; + sidebarIconSrc?: string; sidebarTop?: ReactNode; sidebarFooter?: ReactNode; headerActions?: ReactNode; @@ -29,6 +30,7 @@ export function DashboardLayout({ description, icon: Icon, items, + sidebarIconSrc, sidebarTop, sidebarFooter, headerActions, @@ -38,7 +40,12 @@ export function DashboardLayout({
@@ -54,7 +61,12 @@ export function DashboardLayout({ {title} {description} - + diff --git a/components/dashboard/sidebar.tsx b/components/dashboard/sidebar.tsx index 1b6e2b6..fe3347d 100644 --- a/components/dashboard/sidebar.tsx +++ b/components/dashboard/sidebar.tsx @@ -1,6 +1,5 @@ import type { ReactNode } from "react"; import Link from "next/link"; -import Image from "next/image"; import type { LucideIcon } from "lucide-react"; import { Separator } from "@/components/ui/separator"; @@ -16,11 +15,12 @@ type DashboardSidebarItem = { type DashboardSidebarProps = { items: DashboardSidebarItem[]; + iconSrc?: string; top?: ReactNode; footer?: ReactNode; }; -export function DashboardSidebar({ items, top, footer }: DashboardSidebarProps) { +export function DashboardSidebar({ items, iconSrc, top, footer }: DashboardSidebarProps) { function renderItem(item: DashboardSidebarItem, nested = false) { const Icon = item.icon; @@ -48,7 +48,12 @@ export function DashboardSidebar({ items, top, footer }: DashboardSidebarProps)
- Mohs Admin + {/* eslint-disable-next-line @next/next/no-img-element */} + Mohs Admin

Mohs Admin

diff --git a/components/root/root-dashboard-shell.tsx b/components/root/root-dashboard-shell.tsx index 235863c..40c9d67 100644 --- a/components/root/root-dashboard-shell.tsx +++ b/components/root/root-dashboard-shell.tsx @@ -5,6 +5,7 @@ import { Globe2, ImageIcon, LayoutDashboard, + LogOut, PlusSquare, ShieldAlert, SwatchBook, @@ -16,6 +17,7 @@ import { DashboardLayout } from "@/components/dashboard/dashboard-layout"; import { MotionFade } from "@/components/motion-fade"; import { ThemeToggle } from "@/components/theme-toggle"; import { Button } from "@/components/ui/button"; +import { getSiteSettingsMediaBindings } from "@/lib/app-config"; import { getLocalizedPath } from "@/lib/locale"; import { getRootNavigation } from "@/lib/root-navigation"; @@ -44,7 +46,7 @@ type RootDashboardShellProps = { children: ReactNode; }; -export function RootDashboardShell({ +export async function RootDashboardShell({ copy, active, portfolioChild, @@ -55,6 +57,7 @@ export function RootDashboardShell({ toolbar, children, }: RootDashboardShellProps) { + const mediaBindings = await getSiteSettingsMediaBindings(); const sidebarItems = getRootNavigation(copy, active, portfolioChild).filter( (item) => item.href !== "/root/maintenance" && item.href !== "/root/ui-kit", ); @@ -86,6 +89,7 @@ export function RootDashboardShell({ description={headerDescription} icon={headerIcon} items={sidebarItems} + sidebarIconSrc={mediaBindings.favicon?.url} sidebarTop={