mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-02 08:06:00 +00:00
21 lines
573 B
TypeScript
21 lines
573 B
TypeScript
import type { BkndAdminProps } from "bknd/ui";
|
|
import { Suspense, lazy, useEffect, useState } from "react";
|
|
|
|
export function adminPage(props?: BkndAdminProps) {
|
|
const Admin = lazy(() => import("bknd/ui").then((mod) => ({ default: mod.Admin })));
|
|
return () => {
|
|
const [loaded, setLoaded] = useState(false);
|
|
useEffect(() => {
|
|
if (typeof window === "undefined") return;
|
|
setLoaded(true);
|
|
}, []);
|
|
if (!loaded) return null;
|
|
|
|
return (
|
|
<Suspense>
|
|
<Admin {...props} />
|
|
</Suspense>
|
|
);
|
|
};
|
|
}
|