"use client"; import { usePathname } from "next/navigation"; import { ReactNode, useState } from "react"; import Link from "next/link"; import { signOut, useSession } from "next-auth/react"; import { CooChat } from "./coo-chat"; import { Toaster } from "sonner"; import { MonitorPlay, ListChecks, Code2, Palette, Cloud } from "lucide-react"; interface ProjectShellProps { children: ReactNode; workspace: string; projectId: string; projectName: string; projectDescription?: string; projectStatus?: string; projectProgress?: number; discoveryPhase?: number; capturedData?: Record; createdAt?: string; updatedAt?: string; featureCount?: number; creationMode?: "fresh" | "chat-import" | "code-import" | "migration"; } const CHAT_W = 320; const SECTIONS = [ { id: "build", label: "Build", path: "build" }, { id: "market", label: "Market", path: "growth" }, { id: "assist", label: "Assist", path: "assist" }, ] as const; const TOOLS = [ { id: "preview", Icon: MonitorPlay, title: "Preview" }, { id: "tasks", Icon: ListChecks, title: "Tasks" }, { id: "code", Icon: Code2, title: "Code" }, { id: "design", Icon: Palette, title: "Design" }, { id: "backend", Icon: Cloud, title: "Backend" }, ]; export function ProjectShell({ children, workspace, projectId, projectName, }: ProjectShellProps) { const pathname = usePathname(); const { data: session } = useSession(); const [activeTool, setActiveTool] = useState("preview"); const activeSection = pathname?.includes("/build") ? "build" : pathname?.includes("/growth") ? "market" : pathname?.includes("/assist") ? "assist" : "build"; const userInitial = ( session?.user?.name?.[0] ?? session?.user?.email?.[0] ?? "?" ).toUpperCase(); return ( <>
{/* ── Top bar ── */}
{/* Left — aligns with chat panel */}
VIBN
{projectName}
{/* Right — aligns with content panel */}
{/* Pills + tool icons — grouped together on the left of this section */}
{/* Section pills */} {SECTIONS.map(s => { const isActive = activeSection === s.id; return ( { if (!isActive) (e.currentTarget as HTMLElement).style.background = "#f6f4f0"; }} onMouseLeave={e => { if (!isActive) (e.currentTarget as HTMLElement).style.background = "transparent"; }} > {s.label} ); })} {/* Thin divider between pills and tool icons */}
{/* Tool icons */} {TOOLS.map(({ id, Icon, title }) => { const isActive = activeTool === id; return ( ); })}
{/* Spacer pushes avatar to the right */}
{/* User avatar */}
{/* ── Main area ── */}
{/* Left: Assist chat — persistent */}
Assist
Your product COO
{/* Right: content */}
{children}
); }