Skip to content

🎥 Make videos programmatically with React

better defaults for read-only studio

Jonny Burger88b25a9adfc1
diff --git a/packages/studio/src/components/CurrentCompositionSideEffects.tsx b/packages/studio/src/components/CurrentCompositionSideEffects.tsx
index f11447b43d..192f1d6271 100644
--- a/packages/studio/src/components/CurrentCompositionSideEffects.tsx
+++ b/packages/studio/src/components/CurrentCompositionSideEffects.tsx
@@ -41,7 +41,9 @@ export const TitleUpdater: React.FC = () => {
return null;
};
-export const CurrentCompositionKeybindings: React.FC = () => {
+export const CurrentCompositionKeybindings: React.FC<{
+ readOnlyStudio: boolean;
+}> = ({readOnlyStudio}) => {
const keybindings = useKeybinding();
const video = Internals.useVideo();
const {type} = useContext(StudioServerConnectionCtx).previewServerState;
@@ -51,6 +53,10 @@ export const CurrentCompositionKeybindings: React.FC = () => {
return;
}
+ if (readOnlyStudio) {
+ return sendErrorNotification('Studio is read-only');
+ }
+
if (type !== 'connected') {
sendErrorNotification('Studio server is offline');
return;
@@ -61,7 +67,7 @@ export const CurrentCompositionKeybindings: React.FC = () => {
) as HTMLDivElement;
renderButton.click();
- }, [type, video]);
+ }, [readOnlyStudio, type, video]);
useEffect(() => {
const binding = keybindings.registerKeybinding({
diff --git a/packages/studio/src/components/Timeline/TimelineStack/index.tsx b/packages/studio/src/components/Timeline/TimelineStack/index.tsx
index 9bbcbcbbce..9ee503aeab 100644
--- a/packages/studio/src/components/Timeline/TimelineStack/index.tsx
+++ b/packages/studio/src/components/Timeline/TimelineStack/index.tsx
@@ -132,16 +132,20 @@ export const TimelineStack: React.FC<{
setTitleHovered(false);
}, []);
+ const hoverable =
+ (originalLocation && isCompact) ||
+ (assetPath && window.remotion_editorName);
+
const style = useMemo((): React.CSSProperties => {
return {
fontSize: 12,
color: opening
? VERY_LIGHT_TEXT
- : stackHovered
+ : stackHovered && hoverable
? LIGHT_TEXT
: VERY_LIGHT_TEXT,
marginLeft: 10,
- cursor: 'pointer',
+ cursor: hoverable ? 'pointer' : undefined,
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
@@ -150,11 +154,7 @@ export const TimelineStack: React.FC<{
overflow: 'hidden',
flexShrink: 100000,
};
- }, [stackHovered, opening]);
-
- const hoverable =
- (originalLocation && isCompact) ||
- (assetPath && window.remotion_editorName);
+ }, [opening, stackHovered, hoverable]);
const textStyle: React.CSSProperties = useMemo(() => {
const hoverEffect = titleHovered && hoverable;
diff --git a/packages/studio/src/components/TopPanel.tsx b/packages/studio/src/components/TopPanel.tsx
index d5c8158d74..1c0e40a858 100644
--- a/packages/studio/src/components/TopPanel.tsx
+++ b/packages/studio/src/components/TopPanel.tsx
@@ -134,7 +134,7 @@ export const TopPanel: React.FC<{
</SplitterContainer>
</div>
<PreviewToolbar readOnlyStudio={readOnlyStudio} />
- <CurrentCompositionKeybindings />
+ <CurrentCompositionKeybindings readOnlyStudio={readOnlyStudio} />
<TitleUpdater />
</div>
);