"use client" import Link from "next/link" import { usePathname } from "next/navigation" import { useSession, signOut } from "next-auth/react" import { useState, useEffect } from "react" import { LayoutDashboard, Megaphone, FileBarChart, Upload, Download, Settings, Plus, ExternalLink, LogOut, Shield, MessageCircle, AlertTriangle } from "lucide-react" import { cn } from "@/lib/utils" const navItems = [ { href: "/dashboard", label: "Overview", icon: LayoutDashboard }, { href: "/dashboard/events", label: "Campaigns", icon: Megaphone }, { href: "/dashboard/pledges", label: "Pledges", icon: FileBarChart }, { href: "/dashboard/reconcile", label: "Reconcile", icon: Upload }, { href: "/dashboard/exports", label: "Exports", icon: Download }, { href: "/dashboard/settings", label: "Settings", icon: Settings }, ] const adminNav = { href: "/dashboard/admin", label: "Super Admin", icon: Shield } export default function DashboardLayout({ children }: { children: React.ReactNode }) { const pathname = usePathname() const { data: session } = useSession() // eslint-disable-next-line @typescript-eslint/no-explicit-any const user = session?.user as any return (
{/* Top bar — sharp, no blur */}
P
{user?.orgName || "Pledge Now, Pay Later"}
{session && ( )}
{/* Desktop sidebar — clean, no decorative elements */} {/* Mobile bottom nav */} {/* Main content */}
{children}
) } /** Persistent WhatsApp connection banner — shows until connected */ function WhatsAppBanner() { const [status, setStatus] = useState(null) const [dismissed, setDismissed] = useState(false) const pathname = usePathname() useEffect(() => { // Don't show on settings page (they're already there) if (pathname === "/dashboard/settings") { setStatus("skip"); return } fetch("/api/whatsapp/send") .then(r => r.json()) .then(data => setStatus(data.connected ? "CONNECTED" : "OFFLINE")) .catch(() => setStatus("OFFLINE")) }, [pathname]) if (status === "CONNECTED" || status === "skip" || status === null || dismissed) return null return (

WhatsApp not connected — reminders won't send

Connect your WhatsApp to auto-send pledge receipts and payment reminders to donors. Takes 60 seconds.

Connect WhatsApp
) }