Skip to content

🎥 Make videos programmatically with React

Hide unavailable actions in read-only Studio

JonnyBurger2c724f2428d3
diff --git a/packages/studio/src/components/CanvasOrLoading.tsx b/packages/studio/src/components/CanvasOrLoading.tsx
index e139b8f1d6..621e23ebd0 100644
--- a/packages/studio/src/components/CanvasOrLoading.tsx
+++ b/packages/studio/src/components/CanvasOrLoading.tsx
@@ -196,49 +196,56 @@ const WelcomeActions: React.FC = () => {
onDragOver={onDragOver}
onDrop={onDrop}
>
- <div style={welcomeActions}>
- {leftSidebarStatus === 'collapsed' && compositions.length > 0 ? (
- <InspectorQuickAction
- disabled={false}
- onClick={openComposition}
- renderIcon={(color) => (
- <SearchIcon color={color} style={inspectorActionIconStyle} />
- )}
- >
- Open composition
- </InspectorQuickAction>
- ) : null}
- <InspectorQuickAction
- disabled={!canMutateProject}
- onClick={newComposition}
- renderIcon={(color) => (
- <FilmIcon color={color} style={inspectorActionIconStyle} />
- )}
- >
- New composition
- </InspectorQuickAction>
- <InspectorQuickAction
- disabled={!canMutateProject}
- onClick={importAsset}
- renderIcon={(color) => (
- <UploadIcon color={color} style={inspectorActionIconStyle} />
- )}
- >
- Import asset
- </InspectorQuickAction>
- <InspectorQuickAction
- disabled={false}
- onClick={browseElements}
- renderIcon={(color) => (
- <BrowseElementsIcon
- color={color}
- style={inspectorActionIconStyle}
- />
- )}
- >
- Browse Elements
- </InspectorQuickAction>
- </div>
+ {canMutateProject ||
+ (leftSidebarStatus === 'collapsed' && compositions.length > 0) ? (
+ <div style={welcomeActions}>
+ {leftSidebarStatus === 'collapsed' && compositions.length > 0 ? (
+ <InspectorQuickAction
+ disabled={false}
+ onClick={openComposition}
+ renderIcon={(color) => (
+ <SearchIcon color={color} style={inspectorActionIconStyle} />
+ )}
+ >
+ Open composition
+ </InspectorQuickAction>
+ ) : null}
+ {canMutateProject ? (
+ <>
+ <InspectorQuickAction
+ disabled={false}
+ onClick={newComposition}
+ renderIcon={(color) => (
+ <FilmIcon color={color} style={inspectorActionIconStyle} />
+ )}
+ >
+ New composition
+ </InspectorQuickAction>
+ <InspectorQuickAction
+ disabled={false}
+ onClick={importAsset}
+ renderIcon={(color) => (
+ <UploadIcon color={color} style={inspectorActionIconStyle} />
+ )}
+ >
+ Import asset
+ </InspectorQuickAction>
+ <InspectorQuickAction
+ disabled={false}
+ onClick={browseElements}
+ renderIcon={(color) => (
+ <BrowseElementsIcon
+ color={color}
+ style={inspectorActionIconStyle}
+ />
+ )}
+ >
+ Browse Elements
+ </InspectorQuickAction>
+ </>
+ ) : null}
+ </div>
+ ) : null}
</div>
);
};
diff --git a/packages/studio/src/components/InspectorOpenInEditor.tsx b/packages/studio/src/components/InspectorOpenInEditor.tsx
index b9b3273c58..659d29f8ce 100644
--- a/packages/studio/src/components/InspectorOpenInEditor.tsx
+++ b/packages/studio/src/components/InspectorOpenInEditor.tsx
@@ -149,7 +149,11 @@ export const InspectorOpenInEditor: React.FC<{
gitSourceDisabled: location === null,
onConfigureApps: configureDefaultApps,
onCopyPath:
- locationType === 'folder' && location?.source ? copyPath : undefined,
+ locationType === 'folder' &&
+ location?.source &&
+ !window.remotion_isReadOnlyStudio
+ ? copyPath
+ : undefined,
onOpenInCodingAgent: (codingAgentId, codingAgentName) => {
openWithCodingAgent(codingAgentId, codingAgentName).catch(
() => undefined,