import { useEffect, useState } from "react"; import { twMerge } from "tailwind-merge"; import { useBknd } from "ui/client/BkndProvider"; import { JsonSchemaForm } from "ui/components/form/json-schema"; import { Scrollable } from "ui/layouts/AppShell/AppShell"; function useSchema() { const [schema, setSchema] = useState(); useEffect(() => { if (schema) return; fetch("/api/system/schema") .then((res) => res.json()) .then((data) => setSchema(data)); }, []); return schema; } const uiSchema = { auth: { jwt: { basepath: { "ui:options": { label: false } }, fields: { "ui:options": { label: false, orderable: false } } }, strategies: { additionalProperties: { "ui:widget": "select", type: { "ui:widget": "hidden" } }, type: { "ui:widget": "hidden" } } }, server: { cors: { allow_methods: { "ui:widget": "checkboxes" }, allow_headers: { "ui:options": { orderable: false } } } }, media: { adapter: { "ui:options": { label: false }, type: { "ui:widget": "hidden" } } } }; export default function SchemaTest() { const { app, schema } = useBknd(); const keys = ["auth", "server", "media", "data"] as const; const [tab, setTab] = useState(keys[0]); console.log("schema", schema, app.config); if (!schema) return; const current = { key: tab, schema: schema[tab], uiSchema: uiSchema[tab] || {}, config: app.config[tab] }; console.log("current", current); return (
{keys.map((key) => ( ))}
); }