Skip to content

🎥 Make videos programmatically with React

Share skill prefixes and style Studio restart guidance

Jonny Burger6760b1754bef
diff --git a/packages/studio/src/components/AgentPrompt.tsx b/packages/studio/src/components/AgentPrompt.tsx
index d8455f4839..aaca15e361 100644
--- a/packages/studio/src/components/AgentPrompt.tsx
+++ b/packages/studio/src/components/AgentPrompt.tsx
@@ -2,6 +2,7 @@ import React, {useCallback, useContext} from 'react';
import {StudioServerConnectionCtx} from '../helpers/client-id';
import {BLACK_ALPHA_30, BLUE, LIGHT_TEXT, WHITE} from '../helpers/colors';
import {copyText} from '../helpers/copy-text';
+import {getSkillPrefix} from '../helpers/get-skill-prefix';
import {useCopyFeedback} from '../helpers/use-copy-feedback';
import {CopyIcon} from '../icons/copy';
import {SkillsIcon} from '../icons/skills';
@@ -81,7 +82,7 @@ export const AgentPrompt: React.FC<{
!window.remotion_isReadOnlyStudio &&
previewServerState.type === 'connected' &&
remotionSkillsInfo !== null;
- const skillName = `/${skillId}`;
+ const skillName = `${getSkillPrefix()}${skillId}`;
const prompt = `${skillName}${promptDetails}`;
const installCommand = 'npx remotion skills add';
const hasCodingAgent =
diff --git a/packages/studio/src/components/Notifications/ServerDisconnected.tsx b/packages/studio/src/components/Notifications/ServerDisconnected.tsx
index 3004341fb9..4ba23d3632 100644
--- a/packages/studio/src/components/Notifications/ServerDisconnected.tsx
+++ b/packages/studio/src/components/Notifications/ServerDisconnected.tsx
@@ -8,8 +8,10 @@ import {
WHITE_ALPHA_60,
} from '../../helpers/colors';
import {getCodexAnnotation} from '../../helpers/get-codex-annotation';
+import {getSkillPrefix} from '../../helpers/get-skill-prefix';
import {hoverableStyle} from '../../helpers/hoverable';
import {requestCodexAnnotation} from '../../helpers/request-codex-annotation';
+import {SkillsIcon} from '../../icons/skills';
import {Button} from '../Button';
import {useSettings} from '../SettingsContext';
@@ -45,6 +47,18 @@ const inlineCode: React.CSSProperties = {
fontFamily: 'monospace',
};
+const skillCommand: React.CSSProperties = {
+ display: 'inline-flex',
+ alignItems: 'center',
+ gap: 6,
+ verticalAlign: 'middle',
+};
+
+const skillsIcon: React.CSSProperties = {
+ height: 18,
+ width: 18,
+};
+
const annotationButton: React.CSSProperties = {
backgroundColor: TRANSPARENT,
display: 'inline-flex',
@@ -79,15 +93,14 @@ export const ServerDisconnected: React.FC = () => {
const {remotionSkillsInfo} = useSettings();
const annotationTarget = useRef<HTMLDivElement>(null);
const canAnnotate = getCodexAnnotation() !== null;
+ const skillPrefix = getSkillPrefix();
const isInAgent =
- ('oai' in window && Boolean(window.oai)) ||
- ('oai' in document && Boolean(document.oai)) ||
- remotionSkillsInfo?.studioServerStartedByAgent;
+ skillPrefix === '$' || remotionSkillsInfo?.studioServerStartedByAgent;
const restartSkill = isInAgent
? (remotionSkillsInfo?.studioRestartSkill ?? null)
: null;
const restartCommand = restartSkill
- ? `/${restartSkill}`
+ ? `${skillPrefix}${restartSkill}`
: window.remotion_studioServerCommand;
const onSendToChatGPT = useCallback(() => {
if (restartSkill === null) {
@@ -125,8 +138,16 @@ export const ServerDisconnected: React.FC = () => {
The studio server has disconnected. <br />
{restartCommand ? (
<span>
- Run <code style={inlineCode}>{restartCommand}</code> to run it
- again.
+ Run{' '}
+ {restartSkill ? (
+ <span style={skillCommand}>
+ <SkillsIcon color={WHITE} style={skillsIcon} aria-hidden />
+ <span>{restartCommand}</span>
+ </span>
+ ) : (
+ <code style={inlineCode}>{restartCommand}</code>
+ )}{' '}
+ to run it again.
</span>
) : (
<span>Fast refresh will not work.</span>
diff --git a/packages/studio/src/helpers/get-skill-prefix.ts b/packages/studio/src/helpers/get-skill-prefix.ts
new file mode 100644
index 0000000000..a00377ea32
--- /dev/null
+++ b/packages/studio/src/helpers/get-skill-prefix.ts
@@ -0,0 +1,9 @@
+export const getSkillPrefix = (): '$' | '/' => {
+ const isInCodex =
+ (typeof window !== 'undefined' && 'oai' in window && Boolean(window.oai)) ||
+ (typeof document !== 'undefined' &&
+ 'oai' in document &&
+ Boolean(document.oai));
+
+ return isInCodex ? '$' : '/';
+};