Skip to content

šŸŽ„ Make videos programmatically with React

`@remotion/studio`: Align skill install controls with models

Jonny Burger2c507c354858
diff --git a/packages/example/e2e/studio.test.mts b/packages/example/e2e/studio.test.mts
index 807e50ccb7..f064850c6f 100644
--- a/packages/example/e2e/studio.test.mts
+++ b/packages/example/e2e/studio.test.mts
@@ -1629,7 +1629,7 @@ test.describe('visual mode', () => {
.getByRole('listitem')
.filter({hasText: '/remotion-captions'});
const installButton = captionsSkill.getByRole('button', {
- name: 'Install',
+ name: 'Install remotion-captions in this project',
exact: true,
});
await expect(installButton).toBeVisible();
@@ -1642,8 +1642,9 @@ test.describe('visual mode', () => {
).toBeVisible();
await installButton.click();
await expect(
- captionsSkill.getByRole('button', {name: 'Installing…'}),
- ).toBeDisabled();
+ captionsSkill.getByText('Installing…', {exact: true}),
+ ).toBeVisible();
+ await expect(installButton).toHaveCount(0);
await expect(
dialog
.getByRole('listitem')
@@ -1653,8 +1654,8 @@ test.describe('visual mode', () => {
await page.keyboard.press('Escape');
await openSkills();
await expect(
- captionsSkill.getByRole('button', {name: 'Installing…'}),
- ).toBeDisabled();
+ captionsSkill.getByText('Installing…', {exact: true}),
+ ).toBeVisible();
finishInstall();
await expect(
captionsSkill.getByText('Project', {exact: true}),
diff --git a/packages/studio/src/components/SkillsSettings.tsx b/packages/studio/src/components/SkillsSettings.tsx
index 2900462f20..b87ce5d3d0 100644
--- a/packages/studio/src/components/SkillsSettings.tsx
+++ b/packages/studio/src/components/SkillsSettings.tsx
@@ -9,13 +9,14 @@ import {
import {copyText} from '../helpers/copy-text';
import {useCopyFeedback} from '../helpers/use-copy-feedback';
import {CheckCircleFilled} from '../icons/check-circle-filled';
+import {CloudDownloadIcon} from '../icons/cloud-download';
import {CopyIcon} from '../icons/copy';
-import {Button} from './Button';
import type {RenderInlineAction} from './InlineAction';
import {InlineAction} from './InlineAction';
import {ValidationMessage} from './NewComposition/ValidationMessage';
import {showNotification} from './Notifications/NotificationCenter';
import {useSettings} from './SettingsContext';
+import {Spinner} from './Spinner';
const INSTALL_COMMAND = 'npx remotion skills add';
@@ -104,10 +105,18 @@ const status: React.CSSProperties = {
whiteSpace: 'nowrap',
};
-const installButton: React.CSSProperties = {
- backgroundColor: BLUE,
- color: WHITE,
+const actionIcon: React.CSSProperties = {
+ height: 14,
+ width: 14,
+};
+
+const actionSlot: React.CSSProperties = {
+ alignItems: 'center',
+ display: 'inline-flex',
flexShrink: 0,
+ height: 24,
+ justifyContent: 'center',
+ width: 24,
};
const loading: React.CSSProperties = {
@@ -152,6 +161,9 @@ export const SkillsSettings: React.FC = () => {
},
[copied],
);
+ const renderInstallAction: RenderInlineAction = useCallback((color) => {
+ return <CloudDownloadIcon color={color} style={actionIcon} />;
+ }, []);
return (
<div style={container}>
@@ -199,6 +211,7 @@ export const SkillsSettings: React.FC = () => {
{remotionSkillsInfo.skills.map((skill, index) => {
const installed =
skill.installedInProject || skill.installedGlobally;
+ const installingThisSkill = installingSkill === skill.name;
const installedLocation =
skill.installedInProject && skill.installedGlobally
? 'Project and global'
@@ -221,22 +234,26 @@ export const SkillsSettings: React.FC = () => {
<span style={skillName}>/{skill.name}</span>
{installedLocation ? (
<span style={status}>{installedLocation}</span>
+ ) : installingThisSkill ? (
+ <span style={status}>Installing…</span>
) : null}
{installed ? (
<CheckCircleFilled
aria-hidden
style={{...statusIcon, fill: BLUE}}
/>
+ ) : installingThisSkill ? (
+ <span style={actionSlot}>
+ <Spinner duration={0.5} size={14} />
+ </span>
) : canInstall ? (
- <Button
- size="compact"
- style={installButton}
+ <InlineAction
title={`Install ${skill.name} in this project`}
disabled={installingSkill !== null}
onClick={() => installSkill(skill.name)}
- >
- {installingSkill === skill.name ? 'Installing…' : 'Install'}
- </Button>
+ renderAction={renderInstallAction}
+ variant={null}
+ />
) : null}
</div>
);