"use client";

/**
 * Project home scaffold.
 *
 * Mirrors the /[workspace]/projects scaffold: VIBNSidebar on the left,
 * cream main area on the right. Used only for the project home page
 * (`/{workspace}/project/{id}`) — sub-routes use the (workspace) group
 * with the ProjectShell tab nav instead.
 */

import { ReactNode } from "react";
import { useParams } from "next/navigation";
import { Toaster } from "sonner";
import { VIBNSidebar } from "@/components/layout/vibn-sidebar";
import { ProjectAssociationPrompt } from "@/components/project-association-prompt";

export default function ProjectHomeLayout({ children }: { children: ReactNode }) {
  const params = useParams();
  const workspace = params.workspace as string;

  return (
    <>
      <div style={{ display: "flex", height: "100vh", background: "#f6f4f0", overflow: "hidden" }}>
        <VIBNSidebar workspace={workspace} />
        <main style={{ flex: 1, overflow: "auto" }}>
          {children}
        </main>
      </div>
      <ProjectAssociationPrompt workspace={workspace} />
      <Toaster position="top-center" />
    </>
  );
}
