@sansavision/create-vidra-app 0.1.21-alpha.0 → 0.1.22-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sansavision/create-vidra-app",
3
- "version": "0.1.21-alpha.0",
3
+ "version": "0.1.22-alpha.0",
4
4
  "description": "Scaffold a new Vidra video project — SDK, Player, Web Capture ready to go",
5
5
  "bin": {
6
6
  "create-vidra-app": "./index.js"
@@ -1,9 +1,44 @@
1
- import { useState, useEffect, useRef, useMemo, useCallback } from 'react';
1
+ import { useState, useEffect, useRef, useCallback } from 'react';
2
2
  import { Play, Pause, RotateCcw, Eye, Zap, ArrowRight, Camera } from 'lucide-react';
3
3
 
4
4
  const ANIMATION_DURATION = 3.0; // seconds — total animation length
5
5
  const CAPTURE_FPS = 30;
6
6
 
7
+ // Color palette for randomized bars
8
+ const BAR_COLORS = [
9
+ '#3b82f6', '#22c55e', '#a855f7', '#f97316', '#ec4899',
10
+ '#06b6d4', '#eab308', '#ef4444', '#8b5cf6', '#14b8a6',
11
+ ];
12
+ const BAR_LABELS = [
13
+ ['Q1', 'Q2', 'Q3', 'Q4', 'Q5'],
14
+ ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
15
+ ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],
16
+ ['US', 'EU', 'UK', 'JP', 'AU'],
17
+ ['Web', 'iOS', 'Droid', 'Mac', 'Win'],
18
+ ['Alpha', 'Beta', 'Gamma', 'Delta', 'Zeta'],
19
+ ];
20
+ const CHART_TITLES = [
21
+ 'Revenue by Quarter', 'Monthly Sales', 'Weekly Traffic',
22
+ 'Regional Revenue', 'Platform Users', 'Release Metrics',
23
+ ];
24
+
25
+ /** Generate random bar chart data */
26
+ function generateRandomData(): { title: string; bars: BarData[] } {
27
+ const labelSetIdx = Math.floor(Math.random() * BAR_LABELS.length);
28
+ const labels = BAR_LABELS[labelSetIdx];
29
+ const title = CHART_TITLES[labelSetIdx];
30
+ // Shuffle colors
31
+ const shuffled = [...BAR_COLORS].sort(() => Math.random() - 0.5);
32
+ return {
33
+ title,
34
+ bars: labels.map((label, i) => ({
35
+ label,
36
+ value: 20 + Math.floor(Math.random() * 80), // 20–99
37
+ color: shuffled[i % shuffled.length],
38
+ })),
39
+ };
40
+ }
41
+
7
42
  interface BarData {
8
43
  label: string;
9
44
  value: number;
@@ -14,12 +49,12 @@ interface BarData {
14
49
  * Animated bar chart React component — the "source" web scene.
15
50
  * Used in both live and captured views — content is pixel-identical.
16
51
  */
17
- function AnimatedBarChart({ time, data, label }: { time: number; data: BarData[]; label?: string }) {
52
+ function AnimatedBarChart({ time, data, title, label }: { time: number; data: BarData[]; title: string; label?: string }) {
18
53
  const maxVal = Math.max(...data.map((d: BarData) => d.value));
19
54
 
20
55
  return (
21
56
  <div className="w-full bg-gradient-to-br from-[#0f172a] to-[#1e293b] rounded-2xl p-6 border border-white/10 shadow-xl shadow-black/30">
22
- <h3 className="text-lg font-bold text-white mb-1 text-center">Revenue by Quarter</h3>
57
+ <h3 className="text-lg font-bold text-white mb-1 text-center">{title}</h3>
23
58
  {label && (
24
59
  <p className="text-[11px] text-blue-300/50 text-center mb-6">
25
60
  {label}
@@ -76,13 +111,8 @@ export default function WebSceneMode() {
76
111
  const currentFrame = Math.floor(time * CAPTURE_FPS);
77
112
  const totalFrames = ANIMATION_DURATION * CAPTURE_FPS;
78
113
 
79
- const data = useMemo<BarData[]>(() => [
80
- { label: 'Q1', value: 45, color: '#3b82f6' },
81
- { label: 'Q2', value: 72, color: '#22c55e' },
82
- { label: 'Q3', value: 58, color: '#a855f7' },
83
- { label: 'Q4', value: 91, color: '#f97316' },
84
- { label: 'Q5', value: 68, color: '#ec4899' },
85
- ], []);
114
+ // Randomized data new values every playback to prove it's live
115
+ const [chartData, setChartData] = useState(() => generateRandomData());
86
116
 
87
117
  // Animation loop
88
118
  const animate = useCallback(() => {
@@ -110,6 +140,7 @@ export default function WebSceneMode() {
110
140
 
111
141
  const restart = useCallback(() => {
112
142
  cancelAnimationFrame(rafRef.current);
143
+ setChartData(generateRandomData()); // new random data each playback!
113
144
  setTime(0);
114
145
  startRef.current = performance.now();
115
146
  setIsPlaying(true);
@@ -155,7 +186,8 @@ export default function WebSceneMode() {
155
186
  <div className="w-full max-w-2xl">
156
187
  <AnimatedBarChart
157
188
  time={time}
158
- data={data}
189
+ data={chartData.bars}
190
+ title={chartData.title}
159
191
  label="React component + requestAnimationFrame"
160
192
  />
161
193
  </div>
@@ -174,7 +206,8 @@ export default function WebSceneMode() {
174
206
  </div>
175
207
  <AnimatedBarChart
176
208
  time={time}
177
- data={data}
209
+ data={chartData.bars}
210
+ title={chartData.title}
178
211
  label="Live — continuous requestAnimationFrame"
179
212
  />
180
213
  </div>
@@ -204,7 +237,8 @@ export default function WebSceneMode() {
204
237
  <div className="relative">
205
238
  <AnimatedBarChart
206
239
  time={capturedTime}
207
- data={data}
240
+ data={chartData.bars}
241
+ title={chartData.title}
208
242
  label={`Frame ${currentFrame} — t = ${capturedTime.toFixed(3)}s`}
209
243
  />
210
244
  {/* Subtle scan-line overlay to visually distinguish captured output */}