diff options
| author | Simon Orzel <simonorzel@gmail.com> | 2025-07-20 18:35:06 +0200 |
|---|---|---|
| committer | Simon Orzel <simonorzel@gmail.com> | 2025-07-20 18:35:06 +0200 |
| commit | b03287df8d6fa14153af264c6a3e3da5b2a06153 (patch) | |
| tree | 100b2c2a729295419dce61655bca418e74195ec4 /apps/web/src/components/editor-provider.tsx | |
| parent | 061624ab588afff18073ae62fbac425c1aa5cf3a (diff) | |
| parent | ba3da43728bc051aa033dc7b45042b0f0f788e63 (diff) | |
| download | opencut-b03287df8d6fa14153af264c6a3e3da5b2a06153.tar.gz | |
Merge branch 'main' into feat/project-preview-images
Diffstat (limited to 'apps/web/src/components/editor-provider.tsx')
| -rw-r--r-- | apps/web/src/components/editor-provider.tsx | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/apps/web/src/components/editor-provider.tsx b/apps/web/src/components/editor-provider.tsx index c036b507..25d040db 100644 --- a/apps/web/src/components/editor-provider.tsx +++ b/apps/web/src/components/editor-provider.tsx @@ -1,53 +1,53 @@ -"use client"; - -import { useEffect } from "react"; -import { Loader2 } from "lucide-react"; -import { useEditorStore } from "@/stores/editor-store"; -import { - useKeybindingsListener, - useKeybindingDisabler, -} from "@/hooks/use-keybindings"; -import { useEditorActions } from "@/hooks/use-editor-actions"; - -interface EditorProviderProps { - children: React.ReactNode; -} - -export function EditorProvider({ children }: EditorProviderProps) { - const { isInitializing, isPanelsReady, initializeApp } = useEditorStore(); - const { disableKeybindings, enableKeybindings } = useKeybindingDisabler(); - - // Set up action handlers - useEditorActions(); - - // Set up keybinding listener - useKeybindingsListener(); - - // Disable keybindings when initializing - useEffect(() => { - if (isInitializing || !isPanelsReady) { - disableKeybindings(); - } else { - enableKeybindings(); - } - }, [isInitializing, isPanelsReady, disableKeybindings, enableKeybindings]); - - useEffect(() => { - initializeApp(); - }, [initializeApp]); - - // Show loading screen while initializing - if (isInitializing || !isPanelsReady) { - return ( - <div className="h-screen w-screen flex items-center justify-center bg-background"> - <div className="flex flex-col items-center gap-4"> - <Loader2 className="h-8 w-8 animate-spin text-muted-foreground" /> - <p className="text-sm text-muted-foreground">Loading editor...</p> - </div> - </div> - ); - } - - // App is ready, render children - return <>{children}</>; -} +"use client";
+
+import { useEffect } from "react";
+import { Loader2 } from "lucide-react";
+import { useEditorStore } from "@/stores/editor-store";
+import {
+ useKeybindingsListener,
+ useKeybindingDisabler,
+} from "@/hooks/use-keybindings";
+import { useEditorActions } from "@/hooks/use-editor-actions";
+
+interface EditorProviderProps {
+ children: React.ReactNode;
+}
+
+export function EditorProvider({ children }: EditorProviderProps) {
+ const { isInitializing, isPanelsReady, initializeApp } = useEditorStore();
+ const { disableKeybindings, enableKeybindings } = useKeybindingDisabler();
+
+ // Set up action handlers
+ useEditorActions();
+
+ // Set up keybinding listener
+ useKeybindingsListener();
+
+ // Disable keybindings when initializing
+ useEffect(() => {
+ if (isInitializing || !isPanelsReady) {
+ disableKeybindings();
+ } else {
+ enableKeybindings();
+ }
+ }, [isInitializing, isPanelsReady, disableKeybindings, enableKeybindings]);
+
+ useEffect(() => {
+ initializeApp();
+ }, [initializeApp]);
+
+ // Show loading screen while initializing
+ if (isInitializing || !isPanelsReady) {
+ return (
+ <div className="h-screen w-screen flex items-center justify-center bg-background">
+ <div className="flex flex-col items-center gap-4">
+ <Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
+ <p className="text-sm text-muted-foreground">Loading editor...</p>
+ </div>
+ </div>
+ );
+ }
+
+ // App is ready, render children
+ return <>{children}</>;
+}
|
