import { ReactFlowProvider } from "@xyflow/react";
import "./App.css";
import { CanvasBuilder } from "./Canvas";
import { Tabs, TabsTrigger, TabsContent, TabsList } from "./components/ui/tabs";
import { Config } from "./Config";
import { Integrations } from "./Integrations";
import { Toaster } from "./components/ui/toaster";
import { ProjectSelect } from "./ProjectSelect";
import { Logs } from "./components/logs";

export default function App() {
	return (
		<ReactFlowProvider>
			<div className="h-screen flex flex-col">
				<AppImpl />
				<Toaster />
			</div>
		</ReactFlowProvider>
	);
}

function AppImpl() {
	return (
		<Tabs defaultValue="canvas" className="flex-1 flex flex-col min-h-0">
			<div className="flex items-center justify-between px-4 border-b">
				<TabsList>
					<TabsTrigger value="canvas">Canvas</TabsTrigger>
					<TabsTrigger value="logs">Logs</TabsTrigger>
					<TabsTrigger value="config">Config</TabsTrigger>
					<TabsTrigger value="integrations">Integrations</TabsTrigger>
				</TabsList>
				<ProjectSelect />
			</div>
			<TabsContent value="canvas" className="flex-1 min-h-0">
				<CanvasBuilder />
			</TabsContent>
			<TabsContent value="config" className="flex-1 min-h-0">
				<Config />
			</TabsContent>
			<TabsContent value="integrations" className="flex-1 min-h-0">
				<Integrations />
			</TabsContent>
			<TabsContent value="logs" className="flex-1 min-h-0">
				<Logs />
			</TabsContent>
		</Tabs>
	);
}
