Skip to content

🎥 Make videos programmatically with React

higher fidelity and new style of progress bar

Jonny Burger208142ff8023
diff --git a/packages/cli/src/make-progress-bar.ts b/packages/cli/src/make-progress-bar.ts
index 6c3d338808..26cd444fea 100644
--- a/packages/cli/src/make-progress-bar.ts
+++ b/packages/cli/src/make-progress-bar.ts
@@ -1,5 +1,19 @@
+const full = '─';
+const half = 'â•´';
+
export const makeProgressBar = (percentage: number) => {
const totalBars = 20;
const barsToShow = Math.floor(percentage * totalBars);
- return `[${'='.repeat(barsToShow).padEnd(totalBars, ' ')}]`;
+ const extraBar = (percentage * totalBars) % barsToShow;
+
+ const base = full.repeat(barsToShow) + (extraBar > 0.5 ? half : '');
+ if (percentage === 0) {
+ return `â•·${' '.repeat(totalBars)}`;
+ }
+
+ if (percentage >= 1) {
+ return `â•­${base.substring(0, base.length - 1)}â•®`;
+ }
+
+ return `â•­${base.padEnd(totalBars, ' ')}`;
};