@katajere/recap 1.0.12 → 1.0.14
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/dist/App.css +10 -10
- package/dist/RecapStory.d.ts +2 -2
- package/dist/RecapStory.d.ts.map +1 -1
- package/dist/RecapStory.js +121 -66
- package/dist/StoryProgress.d.ts +3 -2
- package/dist/StoryProgress.d.ts.map +1 -1
- package/dist/StoryProgress.js +66 -12
- package/dist/components/Header.d.ts +2 -1
- package/dist/components/Header.d.ts.map +1 -1
- package/dist/components/Header.js +3 -2
- package/dist/data/mock.d.ts +1 -1
- package/dist/data/mock.d.ts.map +1 -1
- package/dist/data/mock.js +24 -19
- package/dist/data/recapCopy.js +1 -1
- package/dist/slides/Slide10Final.d.ts +2 -1
- package/dist/slides/Slide10Final.d.ts.map +1 -1
- package/dist/slides/Slide10Final.js +8 -7
- package/dist/slides/Slide1Intro.css +44 -0
- package/dist/slides/Slide1Intro.d.ts +3 -1
- package/dist/slides/Slide1Intro.d.ts.map +1 -1
- package/dist/slides/Slide1Intro.js +11 -4
- package/dist/slides/Slide3Revenue.d.ts +2 -1
- package/dist/slides/Slide3Revenue.d.ts.map +1 -1
- package/dist/slides/Slide3Revenue.js +2 -2
- package/dist/slides/Slide9Year.d.ts +2 -1
- package/dist/slides/Slide9Year.d.ts.map +1 -1
- package/dist/slides/Slide9Year.js +4 -2
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/format.d.ts +5 -2
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +7 -4
- package/package.json +1 -1
- package/src/App.css +10 -10
- package/src/RecapStory.tsx +157 -89
- package/src/StoryProgress.tsx +96 -21
- package/src/components/Header.tsx +4 -2
- package/src/data/mock.ts +32 -20
- package/src/data/recapCopy.ts +1 -1
- package/src/slides/Slide10Final.tsx +9 -6
- package/src/slides/Slide1Intro.css +44 -0
- package/src/slides/Slide1Intro.tsx +27 -4
- package/src/slides/Slide3Revenue.tsx +3 -2
- package/src/slides/Slide9Year.tsx +5 -2
- package/src/types.ts +6 -0
- package/src/utils/format.ts +7 -4
package/src/RecapStory.tsx
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { AnimatePresence, motion } from
|
|
3
|
-
import StoryProgress from
|
|
4
|
-
import Header from
|
|
5
|
-
import Slide1Intro from
|
|
6
|
-
import Slide2Days from
|
|
7
|
-
import Slide3Revenue from
|
|
8
|
-
import Slide4Orders from
|
|
9
|
-
import Slide5Buyers from
|
|
10
|
-
import Slide6Customer from
|
|
11
|
-
import Slide7Products from
|
|
12
|
-
import Slide8Months from
|
|
13
|
-
import Slide9Year from
|
|
14
|
-
import Slide10Final from
|
|
15
|
-
import { slideVariants } from
|
|
16
|
-
import { slideDurations } from
|
|
17
|
-
import { BUSINESS_CATEGORIES, RecapData } from
|
|
18
|
-
import { useBackgroundMusic } from
|
|
19
|
-
import soundOnIcon from
|
|
20
|
-
import soundOffIcon from
|
|
21
|
-
import recapMusic from
|
|
22
|
-
import
|
|
1
|
+
import React, { useState, useRef } from "react";
|
|
2
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
3
|
+
import StoryProgress from "./StoryProgress";
|
|
4
|
+
import Header from "./components/Header";
|
|
5
|
+
import Slide1Intro from "./slides/Slide1Intro";
|
|
6
|
+
import Slide2Days from "./slides/Slide2Days";
|
|
7
|
+
import Slide3Revenue from "./slides/Slide3Revenue";
|
|
8
|
+
import Slide4Orders from "./slides/Slide4Orders";
|
|
9
|
+
import Slide5Buyers from "./slides/Slide5Buyers";
|
|
10
|
+
import Slide6Customer from "./slides/Slide6Customer";
|
|
11
|
+
import Slide7Products from "./slides/Slide7Products";
|
|
12
|
+
import Slide8Months from "./slides/Slide8Months";
|
|
13
|
+
import Slide9Year from "./slides/Slide9Year";
|
|
14
|
+
import Slide10Final from "./slides/Slide10Final";
|
|
15
|
+
import { slideVariants } from "./utils";
|
|
16
|
+
import { slideDurations as defaultDurations } from "./data/mock";
|
|
17
|
+
import { BUSINESS_CATEGORIES, RecapData } from "./types";
|
|
18
|
+
import { useBackgroundMusic } from "./hooks/useBackgroundMusic";
|
|
19
|
+
import soundOnIcon from "./assets/sound-on.svg";
|
|
20
|
+
import soundOffIcon from "./assets/sound-off.svg";
|
|
21
|
+
import recapMusic from "./assets/recap-music.mp3";
|
|
22
|
+
import "./RecapStory.css";
|
|
23
23
|
|
|
24
24
|
interface RecapStoryProps {
|
|
25
25
|
recapData: RecapData;
|
|
@@ -30,15 +30,31 @@ interface RecapStoryProps {
|
|
|
30
30
|
*/
|
|
31
31
|
function RecapStory({ recapData }: RecapStoryProps) {
|
|
32
32
|
const [activeIndex, setActiveIndex] = useState<number>(0);
|
|
33
|
-
const
|
|
34
|
-
const [
|
|
33
|
+
const durations = recapData.slideDurations || defaultDurations;
|
|
34
|
+
const [introDuration, setIntroDuration] = useState<number>(
|
|
35
|
+
durations.intro
|
|
36
|
+
);
|
|
37
|
+
const [isIntroDurationReady, setIsIntroDurationReady] =
|
|
38
|
+
useState<boolean>(false);
|
|
39
|
+
const [isPaused, setIsPaused] = useState<boolean>(false);
|
|
40
|
+
const holdTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
41
|
+
const isHoldingRef = useRef<boolean>(false);
|
|
42
|
+
|
|
43
|
+
// Cleanup on unmount to prevent memory leaks
|
|
44
|
+
React.useEffect(() => {
|
|
45
|
+
return () => {
|
|
46
|
+
if (holdTimerRef.current) {
|
|
47
|
+
clearTimeout(holdTimerRef.current);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}, []);
|
|
35
51
|
const { isMuted, isPlaying, toggleMute, play, stop } = useBackgroundMusic({
|
|
36
52
|
src: recapMusic,
|
|
37
53
|
volume: 0.6,
|
|
38
54
|
autoPlay: true,
|
|
39
|
-
loop: false
|
|
55
|
+
loop: false,
|
|
40
56
|
});
|
|
41
|
-
|
|
57
|
+
|
|
42
58
|
// Handle intro duration updates
|
|
43
59
|
const handleIntroDurationCalculated = (duration: number) => {
|
|
44
60
|
setIntroDuration(duration);
|
|
@@ -56,21 +72,23 @@ function RecapStory({ recapData }: RecapStoryProps) {
|
|
|
56
72
|
|
|
57
73
|
// Define slides with their durations (new-user only sees the intro)
|
|
58
74
|
const fullSlideSet = [
|
|
59
|
-
{ id:
|
|
60
|
-
{ id:
|
|
61
|
-
{ id:
|
|
62
|
-
{ id:
|
|
63
|
-
{ id:
|
|
64
|
-
{ id:
|
|
65
|
-
{ id:
|
|
66
|
-
{ id:
|
|
67
|
-
{ id:
|
|
68
|
-
{ id:
|
|
75
|
+
{ id: "intro", duration: introDuration },
|
|
76
|
+
{ id: "days", duration: durations.days },
|
|
77
|
+
{ id: "revenue", duration: durations.revenue },
|
|
78
|
+
{ id: "orders", duration: durations.orders },
|
|
79
|
+
{ id: "buyers", duration: durations.buyers },
|
|
80
|
+
{ id: "customer", duration: durations.customer },
|
|
81
|
+
{ id: "products", duration: durations.products },
|
|
82
|
+
{ id: "months", duration: durations.months },
|
|
83
|
+
{ id: "year", duration: durations.year },
|
|
84
|
+
{ id: "final", duration: durations.final },
|
|
69
85
|
];
|
|
70
|
-
const slides = isNewUser
|
|
86
|
+
const slides = isNewUser
|
|
87
|
+
? [{ id: "intro", duration: introDuration }]
|
|
88
|
+
: fullSlideSet;
|
|
71
89
|
|
|
72
90
|
const currentSlide = slides[activeIndex];
|
|
73
|
-
const isFinalSlide = currentSlide.id ===
|
|
91
|
+
const isFinalSlide = currentSlide.id === "final";
|
|
74
92
|
|
|
75
93
|
// Ensure music plays only on slides 1-9 and stops immediately on the final slide
|
|
76
94
|
React.useEffect(() => {
|
|
@@ -97,25 +115,57 @@ function RecapStory({ recapData }: RecapStoryProps) {
|
|
|
97
115
|
}
|
|
98
116
|
|
|
99
117
|
if (activeIndex < slides.length - 1) {
|
|
100
|
-
setActiveIndex(prev => prev + 1);
|
|
118
|
+
setActiveIndex((prev) => prev + 1);
|
|
119
|
+
setIsPaused(false);
|
|
101
120
|
}
|
|
102
121
|
};
|
|
103
122
|
|
|
104
123
|
const handleReplay = () => {
|
|
105
124
|
setActiveIndex(0);
|
|
106
125
|
setIsIntroDurationReady(false);
|
|
126
|
+
setIsPaused(false);
|
|
107
127
|
};
|
|
108
128
|
|
|
109
129
|
// Jump to specific slide when bar is clicked
|
|
110
130
|
const handleBarClick = (index: number) => {
|
|
111
131
|
setActiveIndex(index);
|
|
132
|
+
setIsPaused(false);
|
|
112
133
|
};
|
|
113
134
|
|
|
114
|
-
// Handle
|
|
115
|
-
const
|
|
135
|
+
// Handle hold to pause
|
|
136
|
+
const handlePointerDown = (event: React.PointerEvent<HTMLDivElement>) => {
|
|
137
|
+
// Ignore if on interactive elements
|
|
138
|
+
const target = event.target as HTMLElement;
|
|
139
|
+
if (target.tagName === "BUTTON" || target.closest("button")) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
isHoldingRef.current = false;
|
|
144
|
+
|
|
145
|
+
// Start hold timer - pause after 150ms of holding
|
|
146
|
+
holdTimerRef.current = setTimeout(() => {
|
|
147
|
+
isHoldingRef.current = true;
|
|
148
|
+
setIsPaused(true);
|
|
149
|
+
}, 150);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const handlePointerUp = (event: React.PointerEvent<HTMLDivElement>) => {
|
|
153
|
+
// Clear hold timer
|
|
154
|
+
if (holdTimerRef.current) {
|
|
155
|
+
clearTimeout(holdTimerRef.current);
|
|
156
|
+
holdTimerRef.current = null;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// If was holding, just unpause and don't navigate
|
|
160
|
+
if (isHoldingRef.current) {
|
|
161
|
+
isHoldingRef.current = false;
|
|
162
|
+
setIsPaused(false);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
|
|
116
166
|
// Ignore clicks on interactive elements
|
|
117
167
|
const target = event.target as HTMLElement;
|
|
118
|
-
if (target.tagName ===
|
|
168
|
+
if (target.tagName === "BUTTON" || target.closest("button")) {
|
|
119
169
|
return;
|
|
120
170
|
}
|
|
121
171
|
|
|
@@ -123,80 +173,87 @@ function RecapStory({ recapData }: RecapStoryProps) {
|
|
|
123
173
|
const rect = container.getBoundingClientRect();
|
|
124
174
|
const tapX = event.clientX - rect.left;
|
|
125
175
|
const screenWidth = rect.width;
|
|
126
|
-
|
|
127
|
-
// Left
|
|
128
|
-
if (tapX < screenWidth
|
|
176
|
+
|
|
177
|
+
// Left 20% of screen = previous slide
|
|
178
|
+
if (tapX < screenWidth * 0.2) {
|
|
129
179
|
if (activeIndex > 0) {
|
|
130
|
-
setActiveIndex(prev => prev - 1);
|
|
180
|
+
setActiveIndex((prev) => prev - 1);
|
|
181
|
+
setIsPaused(false);
|
|
131
182
|
}
|
|
132
|
-
}
|
|
133
|
-
// Right
|
|
134
|
-
else {
|
|
183
|
+
}
|
|
184
|
+
// Right 20% of screen = next slide
|
|
185
|
+
else if (tapX > screenWidth * 0.8) {
|
|
135
186
|
if (!isFinalSlide && activeIndex < slides.length - 1) {
|
|
136
|
-
setActiveIndex(prev => prev + 1);
|
|
187
|
+
setActiveIndex((prev) => prev + 1);
|
|
188
|
+
setIsPaused(false);
|
|
137
189
|
}
|
|
138
190
|
}
|
|
191
|
+
// Middle 60% = no navigation, just tap (already handled by hold logic)
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const handlePointerLeave = () => {
|
|
195
|
+
// Clear hold timer and unpause if leaving
|
|
196
|
+
if (holdTimerRef.current) {
|
|
197
|
+
clearTimeout(holdTimerRef.current);
|
|
198
|
+
holdTimerRef.current = null;
|
|
199
|
+
}
|
|
200
|
+
if (isHoldingRef.current) {
|
|
201
|
+
isHoldingRef.current = false;
|
|
202
|
+
setIsPaused(false);
|
|
203
|
+
}
|
|
139
204
|
};
|
|
140
205
|
|
|
141
206
|
// Render current slide content
|
|
142
207
|
const renderSlide = () => {
|
|
143
208
|
switch (currentSlide.id) {
|
|
144
|
-
case
|
|
209
|
+
case "intro":
|
|
145
210
|
return (
|
|
146
|
-
<Slide1Intro
|
|
211
|
+
<Slide1Intro
|
|
147
212
|
businessName={recapData.businessName}
|
|
148
213
|
businessCategory={recapData.businessCategory}
|
|
214
|
+
introHeadline={recapData.introHeadline}
|
|
215
|
+
introSubtitle={recapData.introSubtitle}
|
|
149
216
|
onDurationCalculated={handleIntroDurationCalculated}
|
|
150
217
|
/>
|
|
151
218
|
);
|
|
152
|
-
case
|
|
153
|
-
return
|
|
154
|
-
|
|
155
|
-
days={recapData.days}
|
|
156
|
-
streak={recapData.streak}
|
|
157
|
-
/>
|
|
158
|
-
);
|
|
159
|
-
case 'revenue':
|
|
219
|
+
case "days":
|
|
220
|
+
return <Slide2Days days={recapData.days} streak={recapData.streak} />;
|
|
221
|
+
case "revenue":
|
|
160
222
|
return (
|
|
161
|
-
<Slide3Revenue
|
|
223
|
+
<Slide3Revenue
|
|
162
224
|
revenue={recapData.revenue}
|
|
225
|
+
currency={recapData.currency}
|
|
163
226
|
businessCategory={recapData.businessCategory}
|
|
164
227
|
/>
|
|
165
228
|
);
|
|
166
|
-
case
|
|
167
|
-
return
|
|
168
|
-
|
|
169
|
-
orders={recapData.orders}
|
|
170
|
-
/>
|
|
171
|
-
);
|
|
172
|
-
case 'buyers':
|
|
229
|
+
case "orders":
|
|
230
|
+
return <Slide4Orders orders={recapData.orders} />;
|
|
231
|
+
case "buyers":
|
|
173
232
|
return (
|
|
174
233
|
<Slide5Buyers
|
|
175
234
|
firstTimeBuyers={recapData.firstTimeBuyers}
|
|
176
235
|
repeatBuyers={recapData.repeatBuyers}
|
|
177
236
|
/>
|
|
178
237
|
);
|
|
179
|
-
case
|
|
238
|
+
case "customer":
|
|
239
|
+
return <Slide6Customer customerName={recapData.topCustomerName} />;
|
|
240
|
+
case "products":
|
|
241
|
+
return <Slide7Products products={recapData.topProducts} />;
|
|
242
|
+
case "months":
|
|
243
|
+
return <Slide8Months busiestMonth={recapData.busiestMonth} />;
|
|
244
|
+
case "year":
|
|
180
245
|
return (
|
|
181
|
-
<
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
<Slide7Products products={recapData.topProducts} />
|
|
186
|
-
);
|
|
187
|
-
case 'months':
|
|
188
|
-
return (
|
|
189
|
-
<Slide8Months busiestMonth={recapData.busiestMonth} />
|
|
190
|
-
);
|
|
191
|
-
case 'year':
|
|
192
|
-
return (
|
|
193
|
-
<Slide9Year businessCategory={recapData.businessCategory} />
|
|
246
|
+
<Slide9Year
|
|
247
|
+
businessCategory={recapData.businessCategory}
|
|
248
|
+
year={recapData.year}
|
|
249
|
+
/>
|
|
194
250
|
);
|
|
195
|
-
case
|
|
251
|
+
case "final":
|
|
196
252
|
return (
|
|
197
253
|
<Slide10Final
|
|
198
254
|
videoUrl={recapData.videoUrl}
|
|
199
255
|
downloadUrl={recapData.downloadUrl}
|
|
256
|
+
year={recapData.year}
|
|
200
257
|
onReplay={handleReplay}
|
|
201
258
|
/>
|
|
202
259
|
);
|
|
@@ -209,9 +266,13 @@ function RecapStory({ recapData }: RecapStoryProps) {
|
|
|
209
266
|
<div className="recap-story">
|
|
210
267
|
{/* Top group: Header + Progress */}
|
|
211
268
|
<div className="recap-story__top-group">
|
|
212
|
-
{/* Header with Huxxle logo and Recap
|
|
269
|
+
{/* Header with Huxxle logo and Recap badge */}
|
|
213
270
|
<div className="recap-story__header-wrapper">
|
|
214
|
-
<Header
|
|
271
|
+
<Header
|
|
272
|
+
showRecapBadge={true}
|
|
273
|
+
badgeVariant={isNewUser ? "new-user" : "default"}
|
|
274
|
+
year={recapData.year}
|
|
275
|
+
/>
|
|
215
276
|
</div>
|
|
216
277
|
|
|
217
278
|
{/* Progress bars with sound toggle */}
|
|
@@ -225,20 +286,21 @@ function RecapStory({ recapData }: RecapStoryProps) {
|
|
|
225
286
|
onComplete={handleProgressComplete}
|
|
226
287
|
onBarClick={handleBarClick}
|
|
227
288
|
hideBorder={isFinalSlide}
|
|
289
|
+
isPaused={isPaused}
|
|
228
290
|
/>
|
|
229
291
|
)}
|
|
230
292
|
</div>
|
|
231
293
|
|
|
232
|
-
{!isFinalSlide && (
|
|
294
|
+
{!isFinalSlide && recapData.isVideo !== true && (
|
|
233
295
|
<button
|
|
234
296
|
type="button"
|
|
235
297
|
className="recap-story__sound-toggle"
|
|
236
298
|
onClick={toggleMute}
|
|
237
|
-
aria-label={isMuted ?
|
|
299
|
+
aria-label={isMuted ? "Unmute sound" : "Mute sound"}
|
|
238
300
|
>
|
|
239
301
|
<img
|
|
240
302
|
src={isMuted ? soundOffIcon : soundOnIcon}
|
|
241
|
-
alt={isMuted ?
|
|
303
|
+
alt={isMuted ? "Unmute sound" : "Mute sound"}
|
|
242
304
|
className="recap-story__sound-icon"
|
|
243
305
|
draggable={false}
|
|
244
306
|
/>
|
|
@@ -248,7 +310,13 @@ function RecapStory({ recapData }: RecapStoryProps) {
|
|
|
248
310
|
</div>
|
|
249
311
|
|
|
250
312
|
{/* Slide content with transitions */}
|
|
251
|
-
<div
|
|
313
|
+
<div
|
|
314
|
+
className="recap-story__slides"
|
|
315
|
+
onPointerDown={handlePointerDown}
|
|
316
|
+
onPointerUp={handlePointerUp}
|
|
317
|
+
onPointerLeave={handlePointerLeave}
|
|
318
|
+
onPointerCancel={handlePointerLeave}
|
|
319
|
+
>
|
|
252
320
|
<AnimatePresence mode="wait">
|
|
253
321
|
<motion.div
|
|
254
322
|
key={currentSlide.id}
|
package/src/StoryProgress.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React, { useEffect, useState } from
|
|
2
|
-
import
|
|
3
|
-
import './StoryProgress.css';
|
|
1
|
+
import React, { useEffect, useState, useRef } from "react";
|
|
2
|
+
import "./StoryProgress.css";
|
|
4
3
|
|
|
5
4
|
interface StoryProgressProps {
|
|
6
5
|
total: number;
|
|
@@ -9,44 +8,120 @@ interface StoryProgressProps {
|
|
|
9
8
|
onComplete: () => void;
|
|
10
9
|
onBarClick: (index: number) => void;
|
|
11
10
|
hideBorder?: boolean;
|
|
11
|
+
isPaused?: boolean;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* StoryProgress - Story-style progress bars at the top
|
|
16
16
|
*/
|
|
17
|
-
function StoryProgress({
|
|
18
|
-
|
|
17
|
+
function StoryProgress({
|
|
18
|
+
total,
|
|
19
|
+
active,
|
|
20
|
+
duration,
|
|
21
|
+
onComplete,
|
|
22
|
+
onBarClick,
|
|
23
|
+
hideBorder,
|
|
24
|
+
isPaused,
|
|
25
|
+
}: StoryProgressProps) {
|
|
26
|
+
const [progress, setProgress] = useState(0);
|
|
27
|
+
const progressRef = useRef(0);
|
|
28
|
+
const startTimeRef = useRef<number>(0);
|
|
29
|
+
const pausedProgressRef = useRef<number>(0);
|
|
30
|
+
const animationFrameRef = useRef<number | null>(null);
|
|
31
|
+
const onCompleteRef = useRef(onComplete);
|
|
19
32
|
|
|
20
|
-
//
|
|
33
|
+
// Keep onComplete ref up to date
|
|
21
34
|
useEffect(() => {
|
|
22
|
-
|
|
35
|
+
onCompleteRef.current = onComplete;
|
|
36
|
+
}, [onComplete]);
|
|
37
|
+
|
|
38
|
+
// Reset progress when active slide changes
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
setProgress(0);
|
|
41
|
+
progressRef.current = 0;
|
|
42
|
+
pausedProgressRef.current = 0;
|
|
43
|
+
startTimeRef.current = performance.now();
|
|
23
44
|
}, [active]);
|
|
24
45
|
|
|
46
|
+
// Animation loop with pause support
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (isPaused) {
|
|
49
|
+
// Save current progress when pausing
|
|
50
|
+
pausedProgressRef.current = progressRef.current;
|
|
51
|
+
if (animationFrameRef.current) {
|
|
52
|
+
cancelAnimationFrame(animationFrameRef.current);
|
|
53
|
+
animationFrameRef.current = null;
|
|
54
|
+
}
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Resume from paused progress
|
|
59
|
+
startTimeRef.current = performance.now();
|
|
60
|
+
const startProgress = pausedProgressRef.current;
|
|
61
|
+
if (startProgress >= 1) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (startProgress >= 1) {
|
|
65
|
+
setProgress(1);
|
|
66
|
+
onCompleteRef.current();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const remainingDuration = duration * (1 - startProgress) * 1000;
|
|
70
|
+
|
|
71
|
+
const animate = (currentTime: number) => {
|
|
72
|
+
const elapsed = currentTime - startTimeRef.current;
|
|
73
|
+
const newProgress =
|
|
74
|
+
startProgress + (elapsed / remainingDuration) * (1 - startProgress);
|
|
75
|
+
|
|
76
|
+
if (newProgress >= 1) {
|
|
77
|
+
progressRef.current = 1;
|
|
78
|
+
setProgress(1);
|
|
79
|
+
onCompleteRef.current();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
progressRef.current = newProgress;
|
|
84
|
+
setProgress(newProgress);
|
|
85
|
+
animationFrameRef.current = requestAnimationFrame(animate);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
animationFrameRef.current = requestAnimationFrame(animate);
|
|
89
|
+
|
|
90
|
+
return () => {
|
|
91
|
+
if (animationFrameRef.current) {
|
|
92
|
+
cancelAnimationFrame(animationFrameRef.current);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}, [isPaused, duration, active]);
|
|
96
|
+
|
|
25
97
|
return (
|
|
26
|
-
<div
|
|
98
|
+
<div
|
|
99
|
+
className={`story-progress${
|
|
100
|
+
hideBorder ? " story-progress--no-border" : ""
|
|
101
|
+
}`}
|
|
102
|
+
>
|
|
27
103
|
{Array.from({ length: total }).map((_, index) => {
|
|
28
104
|
const isActive = index === active;
|
|
29
105
|
const isCompleted = index < active;
|
|
30
|
-
|
|
106
|
+
|
|
31
107
|
return (
|
|
32
|
-
<div
|
|
33
|
-
key={index}
|
|
108
|
+
<div
|
|
109
|
+
key={index}
|
|
34
110
|
className="story-progress__bar-container"
|
|
35
111
|
onClick={() => onBarClick(index)}
|
|
36
112
|
>
|
|
37
|
-
<div
|
|
113
|
+
<div
|
|
114
|
+
className={`story-progress__bar ${
|
|
115
|
+
isCompleted ? "completed" : ""
|
|
116
|
+
}`}
|
|
117
|
+
>
|
|
38
118
|
{isActive && (
|
|
39
|
-
<
|
|
40
|
-
key={key}
|
|
119
|
+
<div
|
|
41
120
|
className="story-progress__bar-fill"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
duration: duration,
|
|
46
|
-
ease: 'linear'
|
|
121
|
+
style={{
|
|
122
|
+
transform: `scaleX(${progress})`,
|
|
123
|
+
transformOrigin: "left",
|
|
47
124
|
}}
|
|
48
|
-
onAnimationComplete={onComplete}
|
|
49
|
-
style={{ transformOrigin: 'left' }}
|
|
50
125
|
/>
|
|
51
126
|
)}
|
|
52
127
|
</div>
|
|
@@ -7,18 +7,20 @@ import huxxleBlueLogo from '../assets/huxxle-blue-logo.svg';
|
|
|
7
7
|
interface HeaderProps {
|
|
8
8
|
showRecapBadge?: boolean;
|
|
9
9
|
badgeVariant?: 'default' | 'new-user';
|
|
10
|
+
year?: number; // e.g., 2025
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Header - Top navigation with logo and optional Recap 25' badge
|
|
14
15
|
* Uses different logos for login/OTP screens vs recap slides
|
|
15
16
|
*/
|
|
16
|
-
function Header({ showRecapBadge = false, badgeVariant = 'default' }: HeaderProps) {
|
|
17
|
+
function Header({ showRecapBadge = false, badgeVariant = 'default', year = 2025 }: HeaderProps) {
|
|
17
18
|
const logoSrc = showRecapBadge
|
|
18
19
|
? badgeVariant === 'new-user'
|
|
19
20
|
? huxxleBlueLogo
|
|
20
21
|
: slideLogo
|
|
21
22
|
: loginLogo;
|
|
23
|
+
const shortYear = year.toString().slice(-2);
|
|
22
24
|
|
|
23
25
|
const headerClasses = ['header'];
|
|
24
26
|
if (showRecapBadge) {
|
|
@@ -32,7 +34,7 @@ function Header({ showRecapBadge = false, badgeVariant = 'default' }: HeaderProp
|
|
|
32
34
|
<header className={headerClasses.join(' ')}>
|
|
33
35
|
<img src={logoSrc} alt="Huxxle" className="header__logo" />
|
|
34
36
|
{showRecapBadge && (
|
|
35
|
-
<div className="header__badge">Recap
|
|
37
|
+
<div className="header__badge">Recap {shortYear}'</div>
|
|
36
38
|
)}
|
|
37
39
|
</header>
|
|
38
40
|
);
|
package/src/data/mock.ts
CHANGED
|
@@ -1,50 +1,62 @@
|
|
|
1
|
-
import { BUSINESS_CATEGORIES } from
|
|
2
|
-
import type { RecapData } from
|
|
1
|
+
import { BUSINESS_CATEGORIES } from "../types";
|
|
2
|
+
import type { RecapData } from "../types";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Mock data for the recap experience
|
|
6
6
|
* This will be replaced with real API data later
|
|
7
7
|
*/
|
|
8
8
|
export const mockRecapData: RecapData = {
|
|
9
|
-
businessName:
|
|
9
|
+
businessName: "RICHYO ENTERPRISES",
|
|
10
10
|
days: 259,
|
|
11
11
|
streak: 47,
|
|
12
|
-
revenue:
|
|
12
|
+
revenue: 22594,
|
|
13
13
|
orders: 487,
|
|
14
14
|
firstTimeBuyers: 234,
|
|
15
15
|
repeatBuyers: 65,
|
|
16
|
-
topCustomerName:
|
|
16
|
+
topCustomerName: "Micheal Scoffy",
|
|
17
|
+
currency: "GBP",
|
|
18
|
+
year: 2025,
|
|
19
|
+
introHeadline: "You Be New Face OOO....",
|
|
20
|
+
introSubtitle: "Come back for 6 days time, we dey for you 😉",
|
|
17
21
|
topProducts: [
|
|
18
22
|
{
|
|
19
|
-
name:
|
|
23
|
+
name: "Vanilla Yoghurt",
|
|
20
24
|
units: 45,
|
|
21
|
-
productImage:
|
|
25
|
+
productImage:
|
|
26
|
+
"https://images.unsplash.com/photo-1447078806655-40579c2520d6?auto=format&fit=crop&w=400&q=80",
|
|
22
27
|
},
|
|
23
28
|
{
|
|
24
|
-
name:
|
|
29
|
+
name: "Cocoa Milkshake",
|
|
25
30
|
units: 38,
|
|
26
|
-
productImage:
|
|
31
|
+
productImage:
|
|
32
|
+
"https://images.unsplash.com/photo-1504674900247-0877df9cc836?auto=format&fit=crop&w=400&q=80",
|
|
27
33
|
},
|
|
28
34
|
{
|
|
29
|
-
name:
|
|
35
|
+
name: "Spicy Crunch",
|
|
30
36
|
units: 33,
|
|
31
|
-
productImage:
|
|
37
|
+
productImage:
|
|
38
|
+
"https://images.unsplash.com/photo-1447078806655-40579c2520d6?auto=format&fit=crop&w=400&q=80",
|
|
32
39
|
},
|
|
33
40
|
{
|
|
34
|
-
name:
|
|
41
|
+
name: "Fresh Plantain Chips",
|
|
35
42
|
units: 29,
|
|
36
|
-
productImage:
|
|
43
|
+
productImage:
|
|
44
|
+
"https://images.unsplash.com/photo-1506084868230-bb9d95c24759?auto=format&fit=crop&w=400&q=80",
|
|
37
45
|
},
|
|
38
46
|
{
|
|
39
|
-
name:
|
|
47
|
+
name: "Mango Juice",
|
|
40
48
|
units: 27,
|
|
41
|
-
productImage:
|
|
42
|
-
|
|
49
|
+
productImage:
|
|
50
|
+
"https://images.unsplash.com/photo-1447078806655-40579c2520d6?auto=format&fit=crop&w=400&q=80",
|
|
51
|
+
},
|
|
43
52
|
],
|
|
44
53
|
businessCategory: BUSINESS_CATEGORIES.THRIVING,
|
|
45
|
-
busiestMonth:
|
|
46
|
-
videoUrl:
|
|
47
|
-
|
|
54
|
+
busiestMonth: "Oct",
|
|
55
|
+
videoUrl:
|
|
56
|
+
"https://katajereassets.blob.core.windows.net/sp-list-assets/mocksite_walkthrough_a75c98dd-47ef-4f2c-a97c-ab2b3c3c97a5_2315a6b2d671d142f34e08cad43929c5.mp4",
|
|
57
|
+
downloadUrl:
|
|
58
|
+
"https://api.huxxle.com/api/download?fileUrl=https://katajereassets.blob.core.windows.net/sp-list-assets/mocksite_walkthrough_a75c98dd-47ef-4f2c-a97c-ab2b3c3c97a5_2315a6b2d671d142f34e08cad43929c5.mp4",
|
|
59
|
+
isVideo: true
|
|
48
60
|
};
|
|
49
61
|
|
|
50
62
|
// Slide durations in seconds - each slide can have its own timing
|
|
@@ -58,5 +70,5 @@ export const slideDurations: Record<string, number> = {
|
|
|
58
70
|
products: 8,
|
|
59
71
|
months: 8,
|
|
60
72
|
year: 8,
|
|
61
|
-
final: 8
|
|
73
|
+
final: 8,
|
|
62
74
|
};
|
package/src/data/recapCopy.ts
CHANGED
|
@@ -19,7 +19,7 @@ export const recapCopy: Record<BusinessCategory, RecapSlideCopy> = {
|
|
|
19
19
|
not_thriving: {
|
|
20
20
|
introHeadline: 'Omoor! We See Your Hustle, But….',
|
|
21
21
|
introSubtitle: 'Make we talk small 🤫',
|
|
22
|
-
introVariant: '
|
|
22
|
+
introVariant: 'default',
|
|
23
23
|
revenueFooter: 'Consistency go pay, we dey your back.',
|
|
24
24
|
yearHeadline: 'This year rough, but you are the real MVP'
|
|
25
25
|
},
|