/**
 * Project shell — unified top bar (chat controls | section icons) and a
 * split row below (conversation | artifact). No skinny workspace sidebar.
 */

import { ReactNode } from "react";
import { Toaster } from "sonner";
import { ChatPanel } from "@/components/vibn-chat/chat-panel";
import { ProjectStreamHandler } from "@/components/project/project-stream-handler";
import { DashboardSidebar } from "@/components/project/dashboard-sidebar";

export default async function ProjectShell({
  children,
  params,
}: {
  children: ReactNode;
  params: Promise<{ workspace: string; projectId: string }>;
}) {
  const { workspace, projectId } = await params;

  return (
    <>
      <ProjectStreamHandler projectId={projectId} />
      <div style={pageWrap}>
        <ChatPanel
          structural
          artifactSlot={
            <DashboardSidebar workspace={workspace} projectId={projectId}>
              {children}
            </DashboardSidebar>
          }
        />
      </div>
      <Toaster position="top-center" />
    </>
  );
}

const pageWrap: React.CSSProperties = {
  display: "flex",
  flexDirection: "column",
  flex: 1,
  minHeight: 0,
  height: "100vh",
  background: "#faf8f5",
  overflow: "hidden",
};
