demo login, super admin view, password reset
- Landing page: 'Try the Demo' button links to /login?demo=1 - Login page: 'Try the Demo — no signup needed' button auto-logs in as demo@pnpl.app - /login?demo=1: auto-triggers demo login on page load - Super Admin page (/dashboard/admin): platform stats, org list, user list, recent pledges - /api/admin: returns cross-org data, gated by super_admin role check - Sidebar shows 'Super Admin' link only for super_admin users - Password reset: omair@quikcue.com = Omair2026!, demo@pnpl.app = demo1234 - omair@quikcue.com confirmed as super_admin role
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import Link from "next/link"
|
||||
import { usePathname } from "next/navigation"
|
||||
import { useSession, signOut } from "next-auth/react"
|
||||
import { LayoutDashboard, Calendar, FileBarChart, Upload, Download, Settings, Plus, ExternalLink, LogOut } from "lucide-react"
|
||||
import { LayoutDashboard, Calendar, FileBarChart, Upload, Download, Settings, Plus, ExternalLink, LogOut, Shield } from "lucide-react"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const navItems = [
|
||||
@@ -15,6 +15,8 @@ const navItems = [
|
||||
{ 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()
|
||||
@@ -76,6 +78,23 @@ export default function DashboardLayout({ children }: { children: React.ReactNod
|
||||
</Link>
|
||||
)
|
||||
})}
|
||||
{user?.role === "super_admin" && (
|
||||
<>
|
||||
<div className="my-2 border-t" />
|
||||
<Link
|
||||
href={adminNav.href}
|
||||
className={cn(
|
||||
"flex items-center gap-2.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors",
|
||||
pathname === adminNav.href
|
||||
? "bg-trust-blue/5 text-trust-blue"
|
||||
: "text-muted-foreground hover:bg-gray-100 hover:text-foreground"
|
||||
)}
|
||||
>
|
||||
<adminNav.icon className="h-4 w-4" />
|
||||
{adminNav.label}
|
||||
</Link>
|
||||
</>
|
||||
)}
|
||||
</nav>
|
||||
|
||||
<div className="mt-auto px-2 pt-4">
|
||||
|
||||
Reference in New Issue
Block a user