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:
@@ -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}</>
|
||||
|
||||
@@ -23,7 +23,6 @@ import PulseFAQ from '@/components/marketing/PulseFAQ'
|
||||
import { toast } from '@ciphera-net/ui'
|
||||
import { getAuthErrorMessage } from '@ciphera-net/ui'
|
||||
import { getSitesLimitForPlan } from '@/lib/plans'
|
||||
import DashboardShell from '@/components/dashboard/DashboardShell'
|
||||
|
||||
type SiteStatsMap = Record<string, { stats: Stats }>
|
||||
|
||||
@@ -230,7 +229,6 @@ export default function HomePage() {
|
||||
}
|
||||
|
||||
return (
|
||||
<DashboardShell siteId={null}>
|
||||
<div className="w-full max-w-7xl mx-auto px-4 sm:px-6 pb-8">
|
||||
{showFinishSetupBanner && (
|
||||
<div className="mb-6 flex items-center justify-between gap-4 rounded-2xl border border-brand-orange/30 bg-brand-orange/10 px-4 py-3">
|
||||
@@ -374,6 +372,5 @@ export default function HomePage() {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</DashboardShell>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user