Skip to content

🎥 Make videos programmatically with React

Elements: Improve unavailable Studio guidance

Igor Samokhovetsbf825f351b40
diff --git a/packages/docs/src/components/Elements/ElementPage.module.css b/packages/docs/src/components/Elements/ElementPage.module.css
index ff00ac8bc1..f1a8233452 100644
--- a/packages/docs/src/components/Elements/ElementPage.module.css
+++ b/packages/docs/src/components/Elements/ElementPage.module.css
@@ -156,6 +156,44 @@
font-weight: 600;
}
+.studioGuidance {
+ margin-top: 12px;
+ padding: 12px;
+ border: 1px solid var(--ifm-color-emphasis-300);
+ border-radius: 8px;
+ background: var(--ifm-color-emphasis-100);
+ font-size: 0.875rem;
+}
+
+.studioGuidanceTitle {
+ margin: 0;
+ font-weight: 600;
+}
+
+.studioGuidanceSteps {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ margin: 10px 0 0;
+ padding: 0;
+ list-style: none;
+}
+
+.studioGuidanceSteps li {
+ display: flex;
+ align-items: flex-start;
+ gap: 8px;
+ line-height: 1.5;
+}
+
+.studioGuidanceSteps li > div {
+ flex: none;
+}
+
+.studioGuidanceSteps li > span {
+ min-width: 0;
+}
+
.successStatus,
.errorStatus {
margin: 12px 0 0;
@@ -314,6 +352,10 @@
height: 160px;
}
+ .studioGuidance {
+ font-size: 1rem;
+ }
+
.actionRow {
align-items: stretch;
flex-direction: column;
diff --git a/packages/docs/src/components/Elements/ElementPage.tsx b/packages/docs/src/components/Elements/ElementPage.tsx
index be1d4f62e9..affeb81efa 100644
--- a/packages/docs/src/components/Elements/ElementPage.tsx
+++ b/packages/docs/src/components/Elements/ElementPage.tsx
@@ -16,6 +16,7 @@ import React, {
useState,
type ReactNode,
} from 'react';
+import {InlineStep} from '../../../components/InlineStep';
import {BlueButton, PlainButton} from '../../../components/layout/Button';
import {Seo} from '../Seo';
import type {ElementDefinition} from './element-definitions';
@@ -261,8 +262,35 @@ export const ElementPage: React.FC<ElementPageProps> = ({
</span>
</div>
) : null}
- {installStatus.type === 'success' ||
- installStatus.type === 'error' ? (
+ {installStatus.type === 'error' &&
+ installStatus.code === 'no-compatible-studio' ? (
+ <div aria-live="polite" className={styles.studioGuidance}>
+ <p className={styles.studioGuidanceTitle}>
+ Connect to Remotion Studio
+ </p>
+ <ol className={styles.studioGuidanceSteps} role="list">
+ <li>
+ <InlineStep>1</InlineStep>
+ <span>
+ Open your Remotion project, or{' '}
+ <a href="/docs/">create a new one</a>.
+ </span>
+ </li>
+ <li>
+ <InlineStep>2</InlineStep>
+ <span>Start Studio and open a composition.</span>
+ </li>
+ <li>
+ <InlineStep>3</InlineStep>
+ <span>
+ Return here and click <strong>Install in Studio</strong>{' '}
+ again.
+ </span>
+ </li>
+ </ol>
+ </div>
+ ) : installStatus.type === 'success' ||
+ installStatus.type === 'error' ? (
<p
aria-live="polite"
className={
@@ -271,18 +299,7 @@ export const ElementPage: React.FC<ElementPageProps> = ({
: styles.errorStatus
}
>
- {installStatus.type === 'error' &&
- installStatus.code === 'no-compatible-studio' ? (
- <>
- Remotion Studio needs to be installed and running.{' '}
- <a href="/docs/">
- Follow the getting-started instructions
- </a>
- , then try again.
- </>
- ) : (
- installStatus.message
- )}
+ {installStatus.message}
</p>
) : null}
</>