import Link from "next/link"; import { Mic, Plus, Wrench } from "lucide-react"; import { requireAuth } from "@/lib/auth/guards"; import { getEffectivePlan } from "@/lib/billing/subscription"; import { getActiveBranding, hexToHslTriplet } from "@/lib/branding"; import { isFlagEnabled } from "@/lib/flags"; import { SidebarNav } from "@/components/app/sidebar-nav"; import { AppMobileNav } from "@/components/app/app-mobile-nav"; import { UserMenu } from "@/components/app/user-menu"; import { CommandPalette } from "@/components/app/command-palette"; import { ImpersonationBanner } from "@/components/app/impersonation-banner"; import { ThemeProvider } from "@/components/providers/theme-provider"; import { Button } from "@/components/ui/button"; // Authed, DB-backed dashboard — never statically prerender. export const dynamic = "force-dynamic"; export default async function AppLayout({ children }: { children: React.ReactNode }) { const session = await requireAuth(); const activeOrgId = session.session.activeOrganizationId; const [{ key: plan }, branding, maintenance] = await Promise.all([ getEffectivePlan(session.user.id, activeOrgId), getActiveBranding(session.user.id, activeOrgId), isFlagEnabled("maintenance_banner"), ]); const isAdmin = session.user.role === "admin"; // White-label: override the brand accent with the org's primary color so the // whole app shell (logo tile, active nav, buttons) adopts it. const brandHsl = hexToHslTriplet(branding?.primaryColor); const brandStyle = brandHsl ? ({ "--brand": brandHsl, "--ring": brandHsl } as React.CSSProperties) : undefined; const workspaceName = branding?.brandName ?? "PodcastYes"; return (
{maintenance && (
We're performing scheduled maintenance — some features may be briefly unavailable.
)}
{branding?.logoUrl ? ( // eslint-disable-next-line @next/next/no-img-element {workspaceName} ) : ( <> {workspaceName} )}
{children}
{branding && !branding.removePoweredBy && (

Powered by PodcastYes

)}
); }