diff --git a/components/dashboard/DashboardShell.tsx b/components/dashboard/DashboardShell.tsx index c2c40b3..76d023c 100644 --- a/components/dashboard/DashboardShell.tsx +++ b/components/dashboard/DashboardShell.tsx @@ -2,11 +2,13 @@ import { useState, useCallback, useEffect, useRef } from 'react' import dynamic from 'next/dynamic' +import Link from 'next/link' import { usePathname } from 'next/navigation' import { formatUpdatedAgo } from '@ciphera-net/ui' -import { SidebarSimple } from '@phosphor-icons/react' +import { CaretRight, SidebarSimple } from '@phosphor-icons/react' import { SidebarProvider, useSidebar } from '@/lib/sidebar-context' import { useRealtime } from '@/lib/swr/dashboard' +import { getSite } from '@/lib/api/sites' import ContentHeader from './ContentHeader' const PAGE_TITLES: Record = { @@ -58,6 +60,7 @@ function GlassTopBar({ siteId }: { siteId: string | null }) { const { data: realtime } = useRealtime(siteId ?? '') const lastUpdatedRef = useRef(null) const [, setTick] = useState(0) + const [siteName, setSiteName] = useState(null) useEffect(() => { if (siteId && realtime) lastUpdatedRef.current = Date.now() @@ -69,13 +72,18 @@ function GlassTopBar({ siteId }: { siteId: string | null }) { return () => clearInterval(timer) }, [realtime]) + useEffect(() => { + if (!siteId) { setSiteName(null); return } + getSite(siteId).then((s) => setSiteName(s.name)).catch(() => {}) + }, [siteId]) + const dashboardTitle = usePageTitle() const homeTitle = useHomePageTitle() const pageTitle = siteId ? dashboardTitle : homeTitle return (
- {/* Left: collapse toggle + page title */} + {/* Left: collapse toggle + breadcrumbs */}
- {pageTitle} + {siteId && siteName ? ( + + ) : ( + {pageTitle} + )}
{/* Realtime indicator */}