import { useEffect } from "react";
import { AppLayout, Button, DatasetPicker, describePlot, Divider, useDataset } from "@elvis/ui";
// import { LoadingScreen } from "@elvis/ui";
import { OKABE_ITO_COLORS } from "./colors.ts";
import { DATASETS } from "./datasets.ts";
import DecisionBoundaryPlot from "./DecisionBoundaryPlot.tsx";
import Sidebar from "./Sidebar.tsx";
import Usage from "./Usage.tsx";
import useAppLogic from "./useAppLogic.ts";
const MANUAL_CLASSES = OKABE_ITO_COLORS.map(({ name, value }) => ({ name, color: value }));
export default function App() {
const app = useAppLogic();
const dataset = useDataset({ task: "classification", builtins: DATASETS, classes: MANUAL_CLASSES });
const processed = dataset.result?.ok ? dataset.result.dataset : null;
// Plot whatever the picker produces and send it to Python. Drawing points by
// hand keeps the view still; loading a table zooms to fit it.
useEffect(() => {
app.handleSetDataset(processed, dataset.source !== "manual");
}, [dataset.result]);
//if (!app.backendReady) {
//return
Examples are coming soon.
} panel={ <>Loading Python… actions will run once it is ready.
)} {app.pythonStatus === "failed" && (Python failed to load. Try reloading the page.
)}{app.modelError}
)}{describePlot(dataset.result.dataset)}
)} ); }