Skip to content

🎥 Make videos programmatically with React

new layout for update modal

Jonny Burger28178fab3372
diff --git a/packages/cli/src/editor/components/CopyButton.tsx b/packages/cli/src/editor/components/CopyButton.tsx
index 2e0320ecee..d162aadc66 100644
--- a/packages/cli/src/editor/components/CopyButton.tsx
+++ b/packages/cli/src/editor/components/CopyButton.tsx
@@ -65,11 +65,7 @@ export const CopyButton: React.FC<{
}, [copied]);
return (
- <Button
- onClick={onClick}
- style={{}}
- buttonContainerStyle={buttonContainerStyle}
- >
+ <Button onClick={onClick} buttonContainerStyle={buttonContainerStyle}>
{copyIcon}
<Spacing x={1.5} />{' '}
<span style={labelStyle}>{copied ? labelWhenCopied : label}</span>
diff --git a/packages/cli/src/editor/components/KnownBugs.tsx b/packages/cli/src/editor/components/KnownBugs.tsx
index 9d4756af29..27c0ec8775 100644
--- a/packages/cli/src/editor/components/KnownBugs.tsx
+++ b/packages/cli/src/editor/components/KnownBugs.tsx
@@ -7,11 +7,17 @@ const container: React.CSSProperties = {
alignItems: 'center',
};
+const text: React.CSSProperties = {
+ fontSize: 14,
+ flex: 1,
+};
+
export const KnownBugs: React.FC<{bugs: Bug[]}> = ({bugs}) => {
const bugElements = bugs.map((bug) => {
return (
<div key={bug.description + bug.link} style={container}>
- <div>🪲 {bug.title}</div>
+ <div style={text}>🪲 {bug.title}</div>
+
<OpenIssueButton link={bug.link} />
</div>
);
diff --git a/packages/cli/src/editor/components/UpdateCheck.tsx b/packages/cli/src/editor/components/UpdateCheck.tsx
index 8d6966e506..bc274b27d4 100644
--- a/packages/cli/src/editor/components/UpdateCheck.tsx
+++ b/packages/cli/src/editor/components/UpdateCheck.tsx
@@ -7,7 +7,7 @@ import React, {
} from 'react';
import {VERSION} from 'remotion';
import type {PackageManager} from '../../preview-server/get-package-manager';
-import {BLUE, FAIL_COLOR} from '../helpers/colors';
+import {BLUE, WARNING_COLOR} from '../helpers/colors';
import {ModalsContext} from '../state/modals';
import {useZIndex} from '../state/z-index';
import {updateAvailable} from './RenderQueue/actions';
@@ -73,7 +73,7 @@ export const UpdateCheck = () => {
signal: controller.signal,
})
.then(async (res) => {
- const {body} = await res.json();
+ const body = await res.json();
setKnownBugs(body.bugs);
})
.catch((err: Error) => {
@@ -90,6 +90,7 @@ export const UpdateCheck = () => {
useEffect(() => {
const abortUpdate = checkForUpdates();
const abortBugs = checkForBugs();
+
return () => {
abortUpdate.abort();
abortBugs.abort();
@@ -107,7 +108,7 @@ export const UpdateCheck = () => {
const dynButtonStyle: React.CSSProperties = useMemo(() => {
return {
...buttonStyle,
- color: hasKnownBugs ? FAIL_COLOR : BLUE,
+ color: hasKnownBugs ? WARNING_COLOR : BLUE,
};
}, [hasKnownBugs]);
@@ -126,7 +127,7 @@ export const UpdateCheck = () => {
onClick={openModal}
type="button"
>
- {hasKnownBugs ? 'Bugfixes available!' : 'Update available!'}
+ {hasKnownBugs ? 'Bugfixes available' : 'Update available'}
</button>
);
};
diff --git a/packages/cli/src/editor/components/UpdateModal/OpenIssueButton.tsx b/packages/cli/src/editor/components/UpdateModal/OpenIssueButton.tsx
index b6900b06c1..2b77671565 100644
--- a/packages/cli/src/editor/components/UpdateModal/OpenIssueButton.tsx
+++ b/packages/cli/src/editor/components/UpdateModal/OpenIssueButton.tsx
@@ -17,9 +17,11 @@ const buttonStyle: React.CSSProperties = {
export const OpenIssueButton: React.FC<{link: string}> = ({link}) => {
const [hovered, setHovered] = useState<boolean>(false);
const buttonTooltip = `Open GitHub issue in new Tab`;
+
const handleClick = useCallback(() => {
window.open(link, '_blank');
}, [link]);
+
const svgFillColor = useMemo(() => {
return hovered ? 'white' : LIGHT_TEXT;
}, [hovered]);
diff --git a/packages/cli/src/editor/components/UpdateModal/UpdateModal.tsx b/packages/cli/src/editor/components/UpdateModal/UpdateModal.tsx
index 832f9b2ef4..daea4ac8c2 100644
--- a/packages/cli/src/editor/components/UpdateModal/UpdateModal.tsx
+++ b/packages/cli/src/editor/components/UpdateModal/UpdateModal.tsx
@@ -1,5 +1,5 @@
import React, {useCallback, useContext, useMemo} from 'react';
-import {SELECTED_BACKGROUND} from '../../helpers/colors';
+import {BLUE, SELECTED_BACKGROUND} from '../../helpers/colors';
import {copyText} from '../../helpers/copy-text';
import {ModalsContext} from '../../state/modals';
import {CopyButton} from '../CopyButton';
@@ -15,31 +15,37 @@ const container: React.CSSProperties = {
paddingTop: 0,
};
+const text: React.CSSProperties = {
+ fontSize: 14,
+};
+
const title: React.CSSProperties = {
paddingTop: 12,
paddingBottom: 8,
+ ...text,
};
const code: React.CSSProperties = {
background: SELECTED_BACKGROUND,
padding: '12px 10px',
- fontSize: 17,
+ fontSize: 14,
marginTop: 10,
marginBottom: 10,
};
const link: React.CSSProperties = {
fontWeight: 'bold',
- color: 'inherit',
+ color: BLUE,
textDecoration: 'none',
+ ...text,
};
const commands: {[key in UpdateInfo['packageManager']]: string} = {
- npm: 'npm run upgrade',
- yarn: 'yarn upgrade',
- pnpm: 'pnpm run upgrade',
- bun: 'bun run upgrade',
- unknown: 'npm run upgrade',
+ npm: 'npx remotion upgrade',
+ yarn: 'yarn remotion upgrade',
+ pnpm: 'pnpm exec remotion upgrade',
+ bun: 'bun remotion upgrade',
+ unknown: 'npx remotion upgrade',
};
export const UpdateModal: React.FC<{
@@ -69,15 +75,18 @@ export const UpdateModal: React.FC<{
<div style={container}>
{hasKnownBugs ? (
<>
- <div style={title}>Known bugs in {info.currentVersion}:</div>
+ <div style={title}>
+ The currently installed version {info.currentVersion} has the
+ following known bugs:
+ </div>
<KnownBugs bugs={knownBugs as Bug[]} />
<div style={{height: '20px'}} />
- Run the following command:
+ <div style={text}>To upgrade, run the following command:</div>
</>
) : (
- <p>
+ <div style={text}>
A new update for Remotion is available! Run the following command:
- </p>
+ </div>
)}
<Row align="center">
<Flex>
@@ -88,15 +97,15 @@ export const UpdateModal: React.FC<{
<Spacing x={1} />
<CopyButton
textToCopy={command}
- label="Copy command"
+ label="Copy"
labelWhenCopied="Copied!"
/>
</Row>
- <p>
+ <div style={text}>
This will upgrade Remotion from {info.currentVersion} to{' '}
{info.latestVersion}.
- </p>
- <p>
+ </div>
+ <div style={text}>
Read the{' '}
<a
style={link}
@@ -106,7 +115,7 @@ export const UpdateModal: React.FC<{
Release notes
</a>{' '}
to know what{"'s"} new in Remotion.
- </p>
+ </div>
</div>
</ModalContainer>
);