From 6b77e83ca0a14111fb675338102f7b0683ea1fcb Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Sun, 22 Jun 2025 13:08:37 +0200 Subject: rename app provider to editor provider and add it to the editor instead --- apps/web/src/components/app-provider.tsx | 42 ----------------------------- apps/web/src/components/editor-provider.tsx | 42 +++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 42 deletions(-) delete mode 100644 apps/web/src/components/app-provider.tsx create mode 100644 apps/web/src/components/editor-provider.tsx (limited to 'apps/web/src/components') diff --git a/apps/web/src/components/app-provider.tsx b/apps/web/src/components/app-provider.tsx deleted file mode 100644 index 257fc8fa..00000000 --- a/apps/web/src/components/app-provider.tsx +++ /dev/null @@ -1,42 +0,0 @@ -"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}; -} diff --git a/apps/web/src/components/editor-provider.tsx b/apps/web/src/components/editor-provider.tsx new file mode 100644 index 00000000..fbae4c90 --- /dev/null +++ b/apps/web/src/components/editor-provider.tsx @@ -0,0 +1,42 @@ +"use client"; + +import { useEffect } from "react"; +import { Loader2 } from "lucide-react"; +import { useAppStore } from "@/stores/editor-store"; +import { usePanelStore } from "@/stores/panel-store"; + +interface EditorProviderProps { + children: React.ReactNode; +} + +export function EditorProvider({ children }: EditorProviderProps) { + 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