🎥 Make videos programmatically with React
open in new tab
Patric Salvisberg4e683f124edf
diff --git a/packages/cli/src/editor/components/KnownBugs.tsx b/packages/cli/src/editor/components/KnownBugs.tsxnew file mode 100644index 0000000000..5db2ef3363--- /dev/null+++ b/packages/cli/src/editor/components/KnownBugs.tsx@@ -0,0 +1,25 @@+import type {Bug} from './UpdateCheck';+import {OpenIssueButton} from './UpdateModal/OpenIssueButton';++const Title: React.CSSProperties = {+ fontSize: 14,+ fontWeight: 'bold',+};++const container: React.CSSProperties = {+ display: 'flex',+ flexDirection: 'row',+ alignItems: 'center',+};++export const KnownBugs: React.FC<{bugs: Bug[]}> = ({bugs}) => {+ const bugElements = bugs.map((bug) => {+ return (+ <div key={bug.description} style={container}>+ <p style={Title}>- {bug.title}</p>+ <OpenIssueButton link={bug.link} />+ </div>+ );+ });+ return <div>{bugElements}</div>;+};diff --git a/packages/cli/src/editor/components/UpdateModal/OpenIssueButton.tsx b/packages/cli/src/editor/components/UpdateModal/OpenIssueButton.tsxnew file mode 100644index 0000000000..b6846d662a--- /dev/null+++ b/packages/cli/src/editor/components/UpdateModal/OpenIssueButton.tsx@@ -0,0 +1,55 @@+import {useCallback, useMemo, useState} from 'react';+import {LIGHT_TEXT} from '../../helpers/colors';++const svgStyle: React.CSSProperties = {+ width: '11px',+ height: '11px',+};+const buttonStyle: React.CSSProperties = {+ border: 'none',+ width: '20px',+ height: '20px',+ display: 'flex',+ justifyContent: 'center',+ alignItems: 'center',+};++export const OpenIssueButton: React.FC<{link: string}> = ({link}) => {+ const [hovered, setHovered] = useState<boolean>(false);+ const buttonTooltip = `Open in ${window.remotion_editorName}`;+ const handleClick = useCallback(() => {+ window.open(link, '_blank');+ }, [link]);+ const svgFillColor = useMemo(() => {+ return hovered ? 'white' : LIGHT_TEXT;+ }, [hovered]);++ const openInEditorSvg = (+ <svg viewBox="0 0 512 512" style={svgStyle}>+ <path+ fill={svgFillColor}+ d="M320 0c-17.7 0-32 14.3-32 32s14.3 32 32 32h82.7L201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L448 109.3V192c0 17.7 14.3 32 32 32s32-14.3 32-32V32c0-17.7-14.3-32-32-32H320zM80 32C35.8 32 0 67.8 0 112V432c0 44.2 35.8 80 80 80H400c44.2 0 80-35.8 80-80V320c0-17.7-14.3-32-32-32s-32 14.3-32 32V432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16H192c17.7 0 32-14.3 32-32s-14.3-32-32-32H80z"+ />+ </svg>+ );+ const onPointerEnter = useCallback(() => {+ setHovered(true);+ }, []);++ const onPointerLeave = useCallback(() => {+ setHovered(false);+ }, []);++ return (+ <button+ title={buttonTooltip}+ type="button"+ onPointerEnter={onPointerEnter}+ onPointerLeave={onPointerLeave}+ style={buttonStyle}+ onClick={handleClick}+ >+ {openInEditorSvg}+ </button>+ );+};diff --git a/packages/cli/src/editor/components/UpdateModal/UpdateModal.tsx b/packages/cli/src/editor/components/UpdateModal/UpdateModal.tsxindex e052462736..3b1d28e963 100644--- a/packages/cli/src/editor/components/UpdateModal/UpdateModal.tsx+++ b/packages/cli/src/editor/components/UpdateModal/UpdateModal.tsx@@ -9,6 +9,7 @@ import {SELECTED_BACKGROUND} from '../../helpers/colors';import {copyText} from '../../helpers/copy-text';import {ModalsContext} from '../../state/modals';import {CopyButton} from '../CopyButton';+import {KnownBugs} from '../KnownBugs';import {Flex, Row, Spacing} from '../layout';import {ModalContainer} from '../ModalContainer';import {NewCompHeader} from '../ModalHeader';@@ -68,7 +69,10 @@ export const UpdateModal: React.FC<{<NewCompHeader title="Update available" /><div style={container}>{hasKnownBugs ? (- <p>There are known bugs in {info.currentVersion}. Upgrade now</p>+ <>+ <p>Known bugs in {info.currentVersion}</p>+ <KnownBugs bugs={knownBugs as Bug[]} />+ </>) : (<p>A new update for Remotion is availale! Run the following command: