Skip to content

🎥 Make videos programmatically with React

use notification component to display error

Orim Dominicc6c1793906b9
diff --git a/packages/cli/src/editor/helpers/use-menu-structure.tsx b/packages/cli/src/editor/helpers/use-menu-structure.tsx
index ca5700b865..4b074c3205 100644
--- a/packages/cli/src/editor/helpers/use-menu-structure.tsx
+++ b/packages/cli/src/editor/helpers/use-menu-structure.tsx
@@ -5,6 +5,7 @@ import {truthy} from '../../truthy';
import {Row} from '../components/layout';
import type {Menu} from '../components/Menu/MenuItem';
import type {SelectionItem} from '../components/NewComposition/ComboBox';
+import { notificationCenter } from '../components/Notifications/NotificationCenter';
import type {TQuickSwitcherResult} from '../components/QuickSwitcher/QuickSwitcherResult';
import {getPreviewSizeLabel, getUniqueSizes} from '../components/SizeSelector';
import {inOutHandles} from '../components/TimelineInOutToggle';
@@ -172,11 +173,22 @@ export const useMenuStructure = (closeMenu: () => void) => {
.then((res)=> res.json())
.then(({success}) => {
if(!success){
- console.error('Could not open in editor');
+ notificationCenter.current?.addNotification({
+ content: `Could not open ${window.remotion_editorName}`,
+ duration: 2000,
+ created: Date.now(),
+ id: String(Math.random()),
+ });
}
})
- .catch(() => {
- console.error('Could not open in editor');
+ .catch((err) => {
+ console.error(err)
+ notificationCenter.current?.addNotification({
+ content: `Could not open ${window.remotion_editorName}`,
+ duration: 2000,
+ created: Date.now(),
+ id: String(Math.random()),
+ });
})
},
type: 'item' as const,