Skip to content

🎥 Make videos programmatically with React

Elements: Confirm installs in the action label

JonnyBurger8a994c16ec02
diff --git a/packages/docs/src/components/Elements/ElementPage.module.css b/packages/docs/src/components/Elements/ElementPage.module.css
index 37c1826bc6..448ed31f44 100644
--- a/packages/docs/src/components/Elements/ElementPage.module.css
+++ b/packages/docs/src/components/Elements/ElementPage.module.css
@@ -101,18 +101,10 @@
gap: 10px;
}
-.installingStatus,
-.successStatus {
- margin: 12px 0 0;
- font-size: 0.875rem;
-}
-
.installingStatus {
+ margin: 12px 0 0;
color: var(--ifm-color-emphasis-700);
-}
-
-.successStatus {
- color: var(--ifm-color-success-dark);
+ font-size: 0.875rem;
}
.details {
diff --git a/packages/docs/src/components/Elements/ElementPage.tsx b/packages/docs/src/components/Elements/ElementPage.tsx
index 537e63a59e..d815bb8ff6 100644
--- a/packages/docs/src/components/Elements/ElementPage.tsx
+++ b/packages/docs/src/components/Elements/ElementPage.tsx
@@ -34,10 +34,7 @@ type ElementPageProps = {
readonly sourceCode?: string;
};
-type InstallStatus =
- | {type: 'idle'}
- | {type: 'installing'}
- | {type: 'success'; message: string};
+type InstallStatus = {type: 'idle'} | {type: 'installing'} | {type: 'success'};
export const ElementPage: React.FC<ElementPageProps> = ({
children,
@@ -155,14 +152,7 @@ export const ElementPage: React.FC<ElementPageProps> = ({
if (isEmbeddedInStudio) {
setInstallStatus({type: 'idle'});
} else {
- const {target} = result;
- setInstallStatus({
- type: 'success',
- message:
- target.compositionId === null
- ? `Sent to ${target.projectName ?? 'Remotion Studio'}. Confirm the installation destination in Studio.`
- : `Sent to ${target.projectName ?? 'Remotion Studio'} (currently ${target.compositionId}). Confirm the installation destination in Studio.`,
- });
+ setInstallStatus({type: 'success'});
}
if (window.location.origin === 'https://www.remotion.dev') {
@@ -264,7 +254,9 @@ export const ElementPage: React.FC<ElementPageProps> = ({
<>
<div className={styles.actionRow}>
<ElementStudioAction
- buttonLabel="Use"
+ buttonLabel={
+ installStatus.type === 'success' ? 'Sent to Studio' : 'Use'
+ }
loading={installStatus.type === 'installing'}
onClick={installElement}
payload={elementPayload}
@@ -288,19 +280,10 @@ export const ElementPage: React.FC<ElementPageProps> = ({
</PlainButton>
) : null}
</div>
- {installStatus.type !== 'idle' &&
- (installStatus.type !== 'installing' || isInstallHintVisible) ? (
- <p
- aria-live="polite"
- className={
- installStatus.type === 'installing'
- ? styles.installingStatus
- : styles.successStatus
- }
- >
- {installStatus.type === 'installing'
- ? 'If your browser prompts you, allow local network access so this page can find Remotion Studio.'
- : installStatus.message}
+ {installStatus.type === 'installing' && isInstallHintVisible ? (
+ <p aria-live="polite" className={styles.installingStatus}>
+ If your browser prompts you, allow local network access so
+ this page can find Remotion Studio.
</p>
) : null}
</>