🎥 Make videos programmatically with React
circular progress
Jonny Burger65167f12cc44
diff --git a/packages/cli/src/editor/components/RenderQueue/CircularProgress.tsx b/packages/cli/src/editor/components/RenderQueue/CircularProgress.tsxnew file mode 100644index 0000000000..28cb831684--- /dev/null+++ b/packages/cli/src/editor/components/RenderQueue/CircularProgress.tsx@@ -0,0 +1,39 @@+import React from 'react';+import {LIGHT_TEXT} from '../../helpers/colors';++export const RENDER_STATUS_INDICATOR_SIZE = 16;++const STROKE_WIDTH = 3;++const container: React.CSSProperties = {+ height: RENDER_STATUS_INDICATOR_SIZE,+ width: RENDER_STATUS_INDICATOR_SIZE,+ transform: `rotate(-90deg)`,+};++export const CircularProgress: React.FC<{+ progress: number;+}> = ({progress}) => {+ const r = RENDER_STATUS_INDICATOR_SIZE / 2 - STROKE_WIDTH;+ const circumference = r * Math.PI * 2;++ return (+ <svg+ style={container}+ viewBox={`0 0 ${RENDER_STATUS_INDICATOR_SIZE} ${RENDER_STATUS_INDICATOR_SIZE}`}+ >+ <circle+ r={RENDER_STATUS_INDICATOR_SIZE / 2 - STROKE_WIDTH}+ stroke={LIGHT_TEXT}+ fill="none"+ strokeWidth={STROKE_WIDTH}+ cx={RENDER_STATUS_INDICATOR_SIZE / 2}+ cy={RENDER_STATUS_INDICATOR_SIZE / 2}+ strokeDasharray={`${circumference} ${circumference}`}+ strokeMiterlimit={0}+ strokeDashoffset={progress * circumference}+ />+ {progress}+ </svg>+ );+};diff --git a/packages/cli/src/editor/components/RenderQueue/RenderQueueItemStatus.tsx b/packages/cli/src/editor/components/RenderQueue/RenderQueueItemStatus.tsxindex 68aab06598..51c0a20928 100644--- a/packages/cli/src/editor/components/RenderQueue/RenderQueueItemStatus.tsx+++ b/packages/cli/src/editor/components/RenderQueue/RenderQueueItemStatus.tsx@@ -1,10 +1,14 @@import React from 'react';import type {RenderJob} from '../../../preview-server/render-queue/job';import {FAIL_COLOR, LIGHT_TEXT} from '../../helpers/colors';+import {+ CircularProgress,+ RENDER_STATUS_INDICATOR_SIZE,+} from './CircularProgress';const iconStyle: React.CSSProperties = {- height: 16,- width: 16,+ height: RENDER_STATUS_INDICATOR_SIZE,+ width: RENDER_STATUS_INDICATOR_SIZE,};export const RenderQueueItemStatus: React.FC<{@@ -45,5 +49,10 @@ export const RenderQueueItemStatus: React.FC<{);}- return <div>{job.status}</div>;+ if (job.status === 'running') {+ // TODO: Put job progress+ return <CircularProgress progress={0.5} />;+ }++ throw new Error('Unknown job status');};