import { useEffect, useState, type ReactNode } from 'react'; import { Toaster } from 'react-hot-toast'; import { runInit, type InitDef } from '@wener/common/meta'; import { DaisyTheme } from '../daisy'; import { ConsoleAuth } from './components/ConsoleAuth/ConsoleAuth'; import { ErrorSuspenseBoundary, LoadingIndicator } from './index'; export namespace Console { export const App = ({ children, content }: { children?: ReactNode; content?: ReactNode }) => { return ( <> {children} {content} ); }; export const Root = ({ init, children }: { init?: Array; children?: ReactNode }) => { const { done } = useInit(init); if (!done) { return ; } return ( <> ); }; } function useInit(init?: InitDef[]) { const [state, setState] = useState({ done: false }); useEffect(() => { runInit(init).finally(() => { setState({ done: true }); }); }, []); return state; }