feat: wrap all authenticated pages in DashboardShell, fix site card actions

- Move DashboardShell wrapping to layout-content.tsx for all dashboard
  pages (home, integrations, pricing) instead of per-page
- GlassTopBar derives page title from pathname (Integrations, Pricing)
- Site card: gear icon now opens site settings, separate trash icon for delete
This commit is contained in:
Usman Baig
2026-03-28 19:35:23 +01:00
parent 45c518b3ba
commit c36c1b0696
4 changed files with 40 additions and 11 deletions

View File

@@ -17,6 +17,7 @@ import { LoadingOverlay } from '@ciphera-net/ui'
import { useRouter } from 'next/navigation'
import { UnifiedSettingsProvider, useUnifiedSettings } from '@/lib/unified-settings-context'
import UnifiedSettingsModal from '@/components/settings/unified/UnifiedSettingsModal'
import DashboardShell from '@/components/dashboard/DashboardShell'
const ORG_SWITCH_KEY = 'pulse_switching_org'
@@ -95,7 +96,8 @@ function LayoutInner({ children }: { children: React.ReactNode }) {
const showOfflineBar = Boolean(auth.user && !isOnline)
// Site pages use DashboardShell with full sidebar — no Header needed
const isSitePage = pathname.startsWith('/sites/') && pathname !== '/sites/new'
const isHomePage = pathname === '/'
// Pages that use DashboardShell with home sidebar (no site context)
const isDashboardPage = pathname === '/' || pathname.startsWith('/integrations') || pathname === '/pricing'
// Checkout page has its own minimal layout — no app header/footer
const isCheckoutPage = pathname.startsWith('/checkout')
@@ -104,13 +106,12 @@ function LayoutInner({ children }: { children: React.ReactNode }) {
}
// While auth is loading on a site or checkout page, render nothing to prevent flash of public header
if (auth.loading && (isSitePage || isCheckoutPage || isHomePage)) {
if (auth.loading && (isSitePage || isCheckoutPage || isDashboardPage)) {
return null
}
// Authenticated site pages: full sidebar layout
// DashboardShell inside children handles everything
if (isAuthenticated && (isSitePage || isHomePage)) {
// Authenticated site pages: DashboardShell provided by sites layout
if (isAuthenticated && isSitePage) {
return (
<>
{showOfflineBar && <OfflineBanner isOnline={isOnline} />}
@@ -120,6 +121,17 @@ function LayoutInner({ children }: { children: React.ReactNode }) {
)
}
// Authenticated dashboard pages (home, integrations, pricing): wrap in DashboardShell
if (isAuthenticated && isDashboardPage) {
return (
<>
{showOfflineBar && <OfflineBanner isOnline={isOnline} />}
<DashboardShell siteId={null}>{children}</DashboardShell>
<UnifiedSettingsModal />
</>
)
}
// Checkout page: render children only (has its own layout)
if (isAuthenticated && isCheckoutPage) {
return <>{children}</>