From be970248686c0af7d8506cba8c64bf507419da3d Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Sun, 22 Jun 2025 13:07:02 +0200 Subject: so much stuff??? --- apps/web/src/components/app-provider.tsx | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 apps/web/src/components/app-provider.tsx (limited to 'apps/web/src/components/app-provider.tsx') diff --git a/apps/web/src/components/app-provider.tsx b/apps/web/src/components/app-provider.tsx new file mode 100644 index 00000000..257fc8fa --- /dev/null +++ b/apps/web/src/components/app-provider.tsx @@ -0,0 +1,42 @@ +"use client"; + +import { useEffect } from "react"; +import { Loader2 } from "lucide-react"; +import { useAppStore } from "@/stores/app-store"; +import { usePanelStore } from "@/stores/panel-store"; + +interface AppProviderProps { + children: React.ReactNode; +} + +export function AppProvider({ children }: AppProviderProps) { + const { isInitializing, isPanelsReady, initializeApp } = useAppStore(); + const { setInitialized } = usePanelStore(); + + useEffect(() => { + const initialize = async () => { + // Initialize the app + await initializeApp(); + + // Initialize panel store for future resize events + setInitialized(); + }; + + initialize(); + }, [initializeApp, setInitialized]); + + // Show loading screen while initializing + if (isInitializing || !isPanelsReady) { + return ( +
+
+ +

Loading editor...

+
+
+ ); + } + + // App is ready, render children + return <>{children}; +} -- cgit v1.3.1