import React from "react";
import { Routes, Route, Navigate } from "react-router-dom";
import { Box, CircularProgress } from "@mui/material";
import { useAppContext } from "../context/AppContext";
import { Layout } from "./Layout";
import { ResourceList } from "./ResourceList";
import { ResourceForm } from "./ResourceForm";
import { ResourceDetail } from "./ResourceDetail";
import { ValidationAlert } from "./ValidationAlert";
interface AdminProps {
basePath: string;
}
export function Admin({ basePath }: AdminProps) {
const { resources, loading, errors, warnings } = useAppContext();
if (loading) {
return (
);
}
if (errors.length > 0) {
return ;
}
if (resources.length === 0) {
return (
No resources found in the OpenAPI spec with x-resource defined.
);
}
return (
<>
{warnings.length > 0 && }
} />
{resources.map((r) => (
} />
{!r.streaming && (
<>
} />
} />
} />
>
)}
))}
>
);
}