"use client";
import { ReactNode, useState } from "react";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useSession } from "next-auth/react";
import {
Code2,
FileText,
Key,
Settings,
Menu,
ChevronRight,
X,
AlertTriangle,
Loader2,
} from "lucide-react";
import { cn } from "@/lib/utils";
interface NavItem {
href: string;
label: string;
icon: React.ComponentType<{ className?: string }>;
}
const navItems: NavItem[] = [
{ href: "/dashboard", label: "Generations", icon: FileText },
{ href: "/dashboard/keys", label: "API Keys", icon: Key },
{ href: "/dashboard/settings", label: "Settings", icon: Settings },
];
function Sidebar({ onNavigate }: { onNavigate?: () => void }) {
const pathname = usePathname();
return (
);
}
function VerificationBanner() {
const { data: session } = useSession();
const [dismissed, setDismissed] = useState(false);
const [resending, setResending] = useState(false);
const [sent, setSent] = useState(false);
if (dismissed || !session?.user || session.user.isEmailVerified) {
return null;
}
async function handleResend() {
setResending(true);
try {
const res = await fetch("/api/auth/resend-verification", { method: "POST" });
if (res.ok) setSent(true);
} catch {} finally { setResending(false); }
}
return (
{sent ? "Verification email sent! Check your inbox." : "Please verify your email address. Check your inbox or"}
{!sent && (
)}
);
}
export default function DashboardLayout({ children }: { children: ReactNode }) {
const [sidebarOpen, setSidebarOpen] = useState(false);
return (
{sidebarOpen && (
setSidebarOpen(false)} />
)}
CodeBoard
{children}
);
}