import { useLocation, useNavigate } from "react-router-dom";
import { IDE } from "../modules/ide";
import type { FileNode } from "../modules/ide";

export const IDEPage = () => {
  const navigate = useNavigate();
  const location = useLocation();
  const files: FileNode | undefined = location.state?.files;

  return (
    <div
      className="absolute top-0 left-0 w-full h-full z-90"
      style={{ backgroundColor: "var(--bg-primary)" }}
    >
      <IDE onBack={() => navigate("/templates")} initialFiles={files} />
    </div>
  );
};
