@katajere/recap 1.0.2
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/README.md +39 -0
- package/dist/App.css +120 -0
- package/dist/FloatingFrames.css +55 -0
- package/dist/FloatingFrames.d.ts +11 -0
- package/dist/FloatingFrames.d.ts.map +1 -0
- package/dist/FloatingFrames.js +12 -0
- package/dist/LoginScreen.css +146 -0
- package/dist/OtpScreen.css +133 -0
- package/dist/RecapApp.d.ts +17 -0
- package/dist/RecapApp.d.ts.map +1 -0
- package/dist/RecapApp.js +7 -0
- package/dist/RecapStory.css +105 -0
- package/dist/RecapStory.d.ts +11 -0
- package/dist/RecapStory.d.ts.map +1 -0
- package/dist/RecapStory.js +150 -0
- package/dist/StoryProgress.css +47 -0
- package/dist/StoryProgress.d.ts +15 -0
- package/dist/StoryProgress.d.ts.map +1 -0
- package/dist/StoryProgress.js +23 -0
- package/dist/assets/huxxle-blue-logo.png +0 -0
- package/dist/assets/huxxle-blue-logo.svg +14 -0
- package/dist/assets/huxxle-logo.png +0 -0
- package/dist/assets/huxxle_star_final.gif +0 -0
- package/dist/assets/login-logo.png +0 -0
- package/dist/assets/login-logo.svg +14 -0
- package/dist/assets/money-rain.png +0 -0
- package/dist/assets/raining-money.gif +0 -0
- package/dist/assets/recap-music.mp3 +0 -0
- package/dist/assets/sketch_draw.gif +0 -0
- package/dist/assets/slide-logo.png +0 -0
- package/dist/assets/slide-logo.svg +14 -0
- package/dist/assets/sound-off.svg +4 -0
- package/dist/assets/sound-on.svg +5 -0
- package/dist/components/Header.css +46 -0
- package/dist/components/Header.d.ts +12 -0
- package/dist/components/Header.d.ts.map +1 -0
- package/dist/components/Header.js +25 -0
- package/dist/data/mock.d.ts +8 -0
- package/dist/data/mock.d.ts.map +1 -0
- package/dist/data/mock.js +59 -0
- package/dist/data/recapCopy.d.ts +10 -0
- package/dist/data/recapCopy.d.ts.map +1 -0
- package/dist/data/recapCopy.js +23 -0
- package/dist/hooks/useBackgroundMusic.d.ts +20 -0
- package/dist/hooks/useBackgroundMusic.d.ts.map +1 -0
- package/dist/hooks/useBackgroundMusic.js +62 -0
- package/dist/index.css +13 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/slides/Slide10Final.css +101 -0
- package/dist/slides/Slide10Final.d.ts +9 -0
- package/dist/slides/Slide10Final.d.ts.map +1 -0
- package/dist/slides/Slide10Final.js +68 -0
- package/dist/slides/Slide1Intro.css +261 -0
- package/dist/slides/Slide1Intro.d.ts +13 -0
- package/dist/slides/Slide1Intro.d.ts.map +1 -0
- package/dist/slides/Slide1Intro.js +61 -0
- package/dist/slides/Slide2Days.css +209 -0
- package/dist/slides/Slide2Days.d.ts +11 -0
- package/dist/slides/Slide2Days.d.ts.map +1 -0
- package/dist/slides/Slide2Days.js +11 -0
- package/dist/slides/Slide3Revenue.css +89 -0
- package/dist/slides/Slide3Revenue.d.ts +12 -0
- package/dist/slides/Slide3Revenue.d.ts.map +1 -0
- package/dist/slides/Slide3Revenue.js +16 -0
- package/dist/slides/Slide4Orders.css +135 -0
- package/dist/slides/Slide4Orders.d.ts +10 -0
- package/dist/slides/Slide4Orders.d.ts.map +1 -0
- package/dist/slides/Slide4Orders.js +16 -0
- package/dist/slides/Slide5Buyers.css +140 -0
- package/dist/slides/Slide5Buyers.d.ts +11 -0
- package/dist/slides/Slide5Buyers.d.ts.map +1 -0
- package/dist/slides/Slide5Buyers.js +12 -0
- package/dist/slides/Slide6Customer.css +92 -0
- package/dist/slides/Slide6Customer.d.ts +10 -0
- package/dist/slides/Slide6Customer.d.ts.map +1 -0
- package/dist/slides/Slide6Customer.js +10 -0
- package/dist/slides/Slide7Products.css +144 -0
- package/dist/slides/Slide7Products.d.ts +11 -0
- package/dist/slides/Slide7Products.d.ts.map +1 -0
- package/dist/slides/Slide7Products.js +29 -0
- package/dist/slides/Slide8Months.css +148 -0
- package/dist/slides/Slide8Months.d.ts +7 -0
- package/dist/slides/Slide8Months.d.ts.map +1 -0
- package/dist/slides/Slide8Months.js +31 -0
- package/dist/slides/Slide9Year.css +93 -0
- package/dist/slides/Slide9Year.d.ts +8 -0
- package/dist/slides/Slide9Year.d.ts.map +1 -0
- package/dist/slides/Slide9Year.js +9 -0
- package/dist/types.d.ts +33 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +11 -0
- package/dist/utils/format.d.ts +9 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +17 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/motion.d.ts +19 -0
- package/dist/utils/motion.d.ts.map +1 -0
- package/dist/utils/motion.js +80 -0
- package/package.json +98 -0
- package/src/App.css +120 -0
- package/src/App.tsx +73 -0
- package/src/FloatingFrames.css +55 -0
- package/src/FloatingFrames.tsx +27 -0
- package/src/LoginScreen.css +146 -0
- package/src/LoginScreen.tsx +70 -0
- package/src/OtpScreen.css +133 -0
- package/src/OtpScreen.tsx +109 -0
- package/src/RecapApp.tsx +34 -0
- package/src/RecapStory.css +105 -0
- package/src/RecapStory.tsx +269 -0
- package/src/StoryProgress.css +47 -0
- package/src/StoryProgress.tsx +60 -0
- package/src/assets.d.ts +41 -0
- package/src/components/Header.css +46 -0
- package/src/components/Header.tsx +41 -0
- package/src/data/mock.ts +62 -0
- package/src/data/recapCopy.ts +33 -0
- package/src/hooks/useBackgroundMusic.ts +79 -0
- package/src/index.css +13 -0
- package/src/index.ts +70 -0
- package/src/react-app-env.d.ts +26 -0
- package/src/slides/Slide10Final.css +101 -0
- package/src/slides/Slide10Final.tsx +105 -0
- package/src/slides/Slide1Intro.css +261 -0
- package/src/slides/Slide1Intro.tsx +141 -0
- package/src/slides/Slide2Days.css +209 -0
- package/src/slides/Slide2Days.tsx +92 -0
- package/src/slides/Slide3Revenue.css +89 -0
- package/src/slides/Slide3Revenue.tsx +76 -0
- package/src/slides/Slide4Orders.css +135 -0
- package/src/slides/Slide4Orders.tsx +63 -0
- package/src/slides/Slide5Buyers.css +140 -0
- package/src/slides/Slide5Buyers.tsx +74 -0
- package/src/slides/Slide6Customer.css +92 -0
- package/src/slides/Slide6Customer.tsx +27 -0
- package/src/slides/Slide7Products.css +144 -0
- package/src/slides/Slide7Products.tsx +81 -0
- package/src/slides/Slide8Months.css +148 -0
- package/src/slides/Slide8Months.tsx +63 -0
- package/src/slides/Slide9Year.css +93 -0
- package/src/slides/Slide9Year.tsx +35 -0
- package/src/types.ts +39 -0
- package/src/utils/format.ts +18 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/motion.ts +89 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import React, { useState } 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 } 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
|
+
|
|
24
|
+
interface RecapStoryProps {
|
|
25
|
+
recapData: RecapData;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* RecapStory - Story container with header, progress bars, and slide transitions
|
|
30
|
+
*/
|
|
31
|
+
function RecapStory({ recapData }: RecapStoryProps) {
|
|
32
|
+
const [activeIndex, setActiveIndex] = useState<number>(0);
|
|
33
|
+
const [introDuration, setIntroDuration] = useState<number>(slideDurations.intro);
|
|
34
|
+
const [isIntroDurationReady, setIsIntroDurationReady] = useState<boolean>(false);
|
|
35
|
+
const { isMuted, isPlaying, toggleMute, play, stop } = useBackgroundMusic({
|
|
36
|
+
src: recapMusic,
|
|
37
|
+
volume: 0.6,
|
|
38
|
+
autoPlay: true,
|
|
39
|
+
loop: false
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Handle intro duration updates
|
|
43
|
+
const handleIntroDurationCalculated = (duration: number) => {
|
|
44
|
+
setIntroDuration(duration);
|
|
45
|
+
setIsIntroDurationReady(true);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Reset ready state when returning to intro slide
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
if (activeIndex === 0) {
|
|
51
|
+
setIsIntroDurationReady(false);
|
|
52
|
+
}
|
|
53
|
+
}, [activeIndex]);
|
|
54
|
+
|
|
55
|
+
const isNewUser = recapData.businessCategory === BUSINESS_CATEGORIES.NEW_USER;
|
|
56
|
+
|
|
57
|
+
// Define slides with their durations (new-user only sees the intro)
|
|
58
|
+
const fullSlideSet = [
|
|
59
|
+
{ id: 'intro', duration: introDuration },
|
|
60
|
+
{ id: 'days', duration: slideDurations.days },
|
|
61
|
+
{ id: 'revenue', duration: slideDurations.revenue },
|
|
62
|
+
{ id: 'orders', duration: slideDurations.orders },
|
|
63
|
+
{ id: 'buyers', duration: slideDurations.buyers },
|
|
64
|
+
{ id: 'customer', duration: slideDurations.customer },
|
|
65
|
+
{ id: 'products', duration: slideDurations.products },
|
|
66
|
+
{ id: 'months', duration: slideDurations.months },
|
|
67
|
+
{ id: 'year', duration: slideDurations.year },
|
|
68
|
+
{ id: 'final', duration: slideDurations.final }
|
|
69
|
+
];
|
|
70
|
+
const slides = isNewUser ? [{ id: 'intro', duration: introDuration }] : fullSlideSet;
|
|
71
|
+
|
|
72
|
+
const currentSlide = slides[activeIndex];
|
|
73
|
+
const isFinalSlide = currentSlide.id === 'final';
|
|
74
|
+
|
|
75
|
+
// Ensure music plays only on slides 1-9 and stops immediately on the final slide
|
|
76
|
+
React.useEffect(() => {
|
|
77
|
+
if (isFinalSlide) {
|
|
78
|
+
stop();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (isIntroDurationReady && !isPlaying) {
|
|
83
|
+
play();
|
|
84
|
+
}
|
|
85
|
+
}, [isFinalSlide, isIntroDurationReady, isPlaying, play, stop]);
|
|
86
|
+
|
|
87
|
+
// Stop music when reaching the final slide (safety net)
|
|
88
|
+
React.useEffect(() => {
|
|
89
|
+
if (isFinalSlide) {
|
|
90
|
+
stop();
|
|
91
|
+
}
|
|
92
|
+
}, [isFinalSlide, stop]);
|
|
93
|
+
|
|
94
|
+
const handleProgressComplete = () => {
|
|
95
|
+
if (isFinalSlide) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (activeIndex < slides.length - 1) {
|
|
100
|
+
setActiveIndex(prev => prev + 1);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const handleReplay = () => {
|
|
105
|
+
setActiveIndex(0);
|
|
106
|
+
setIsIntroDurationReady(false);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// Jump to specific slide when bar is clicked
|
|
110
|
+
const handleBarClick = (index: number) => {
|
|
111
|
+
setActiveIndex(index);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// Handle screen tap navigation (WhatsApp-style)
|
|
115
|
+
const handleScreenTap = (event: React.MouseEvent<HTMLDivElement>) => {
|
|
116
|
+
// Ignore clicks on interactive elements
|
|
117
|
+
const target = event.target as HTMLElement;
|
|
118
|
+
if (target.tagName === 'BUTTON' || target.closest('button')) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const container = event.currentTarget;
|
|
123
|
+
const rect = container.getBoundingClientRect();
|
|
124
|
+
const tapX = event.clientX - rect.left;
|
|
125
|
+
const screenWidth = rect.width;
|
|
126
|
+
|
|
127
|
+
// Left third of screen = previous slide
|
|
128
|
+
if (tapX < screenWidth / 3) {
|
|
129
|
+
if (activeIndex > 0) {
|
|
130
|
+
setActiveIndex(prev => prev - 1);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// Right two-thirds of screen = next slide
|
|
134
|
+
else {
|
|
135
|
+
if (!isFinalSlide && activeIndex < slides.length - 1) {
|
|
136
|
+
setActiveIndex(prev => prev + 1);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
// Render current slide content
|
|
142
|
+
const renderSlide = () => {
|
|
143
|
+
switch (currentSlide.id) {
|
|
144
|
+
case 'intro':
|
|
145
|
+
return (
|
|
146
|
+
<Slide1Intro
|
|
147
|
+
businessName={recapData.businessName}
|
|
148
|
+
businessCategory={recapData.businessCategory}
|
|
149
|
+
onDurationCalculated={handleIntroDurationCalculated}
|
|
150
|
+
/>
|
|
151
|
+
);
|
|
152
|
+
case 'days':
|
|
153
|
+
return (
|
|
154
|
+
<Slide2Days
|
|
155
|
+
days={recapData.days}
|
|
156
|
+
streak={recapData.streak}
|
|
157
|
+
/>
|
|
158
|
+
);
|
|
159
|
+
case 'revenue':
|
|
160
|
+
return (
|
|
161
|
+
<Slide3Revenue
|
|
162
|
+
revenue={recapData.revenue}
|
|
163
|
+
businessCategory={recapData.businessCategory}
|
|
164
|
+
/>
|
|
165
|
+
);
|
|
166
|
+
case 'orders':
|
|
167
|
+
return (
|
|
168
|
+
<Slide4Orders
|
|
169
|
+
orders={recapData.orders}
|
|
170
|
+
/>
|
|
171
|
+
);
|
|
172
|
+
case 'buyers':
|
|
173
|
+
return (
|
|
174
|
+
<Slide5Buyers
|
|
175
|
+
firstTimeBuyers={recapData.firstTimeBuyers}
|
|
176
|
+
repeatBuyers={recapData.repeatBuyers}
|
|
177
|
+
/>
|
|
178
|
+
);
|
|
179
|
+
case 'customer':
|
|
180
|
+
return (
|
|
181
|
+
<Slide6Customer customerName={recapData.topCustomerName} />
|
|
182
|
+
);
|
|
183
|
+
case 'products':
|
|
184
|
+
return (
|
|
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} />
|
|
194
|
+
);
|
|
195
|
+
case 'final':
|
|
196
|
+
return (
|
|
197
|
+
<Slide10Final
|
|
198
|
+
videoUrl={recapData.videoUrl}
|
|
199
|
+
downloadUrl={recapData.downloadUrl}
|
|
200
|
+
onReplay={handleReplay}
|
|
201
|
+
/>
|
|
202
|
+
);
|
|
203
|
+
default:
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
return (
|
|
209
|
+
<div className="recap-story">
|
|
210
|
+
{/* Top group: Header + Progress */}
|
|
211
|
+
<div className="recap-story__top-group">
|
|
212
|
+
{/* Header with Huxxle logo and Recap 25' badge */}
|
|
213
|
+
<div className="recap-story__header-wrapper">
|
|
214
|
+
<Header showRecapBadge={true} badgeVariant={isNewUser ? 'new-user' : 'default'} />
|
|
215
|
+
</div>
|
|
216
|
+
|
|
217
|
+
{/* Progress bars with sound toggle */}
|
|
218
|
+
<div className="recap-story__progress-wrap">
|
|
219
|
+
<div className="recap-story__progress">
|
|
220
|
+
{(activeIndex !== 0 || isIntroDurationReady) && (
|
|
221
|
+
<StoryProgress
|
|
222
|
+
total={slides.length}
|
|
223
|
+
active={activeIndex}
|
|
224
|
+
duration={currentSlide.duration}
|
|
225
|
+
onComplete={handleProgressComplete}
|
|
226
|
+
onBarClick={handleBarClick}
|
|
227
|
+
hideBorder={isFinalSlide}
|
|
228
|
+
/>
|
|
229
|
+
)}
|
|
230
|
+
</div>
|
|
231
|
+
|
|
232
|
+
{!isFinalSlide && (
|
|
233
|
+
<button
|
|
234
|
+
type="button"
|
|
235
|
+
className="recap-story__sound-toggle"
|
|
236
|
+
onClick={toggleMute}
|
|
237
|
+
aria-label={isMuted ? 'Unmute sound' : 'Mute sound'}
|
|
238
|
+
>
|
|
239
|
+
<img
|
|
240
|
+
src={isMuted ? soundOffIcon : soundOnIcon}
|
|
241
|
+
alt={isMuted ? 'Unmute sound' : 'Mute sound'}
|
|
242
|
+
className="recap-story__sound-icon"
|
|
243
|
+
draggable={false}
|
|
244
|
+
/>
|
|
245
|
+
</button>
|
|
246
|
+
)}
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
249
|
+
|
|
250
|
+
{/* Slide content with transitions */}
|
|
251
|
+
<div className="recap-story__slides" onClick={handleScreenTap}>
|
|
252
|
+
<AnimatePresence mode="wait">
|
|
253
|
+
<motion.div
|
|
254
|
+
key={currentSlide.id}
|
|
255
|
+
variants={slideVariants}
|
|
256
|
+
initial="initial"
|
|
257
|
+
animate="animate"
|
|
258
|
+
exit="exit"
|
|
259
|
+
className="recap-story__slide"
|
|
260
|
+
>
|
|
261
|
+
{renderSlide()}
|
|
262
|
+
</motion.div>
|
|
263
|
+
</AnimatePresence>
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export default RecapStory;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.story-progress {
|
|
2
|
+
display: flex;
|
|
3
|
+
gap: 0.51%;
|
|
4
|
+
width: 100%;
|
|
5
|
+
margin: 0 auto;
|
|
6
|
+
height: clamp(3px, 0.47dvh, 4px);
|
|
7
|
+
position: relative;
|
|
8
|
+
z-index: 10;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.story-progress__bar-container {
|
|
12
|
+
flex: 1;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
position: relative;
|
|
15
|
+
height: 100%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.story-progress__bar {
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
background: transparent;
|
|
22
|
+
border: 0.5px solid rgba(217, 217, 217, 0.3);
|
|
23
|
+
border-radius: 2px;
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
position: relative;
|
|
26
|
+
min-height: 3px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.story-progress--no-border .story-progress__bar {
|
|
30
|
+
border: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.story-progress__bar.completed {
|
|
34
|
+
background: linear-gradient(90deg, #FFFFFF 0%, #FFCC80 100%);
|
|
35
|
+
border: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.story-progress__bar-fill {
|
|
39
|
+
position: absolute;
|
|
40
|
+
top: 0;
|
|
41
|
+
left: 0;
|
|
42
|
+
width: 100%;
|
|
43
|
+
height: 100%;
|
|
44
|
+
background: linear-gradient(90deg, #FFFFFF 0%, #FFCC80 100%);
|
|
45
|
+
transform-origin: left;
|
|
46
|
+
transform: scaleX(0);
|
|
47
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { motion } from 'framer-motion';
|
|
3
|
+
import './StoryProgress.css';
|
|
4
|
+
|
|
5
|
+
interface StoryProgressProps {
|
|
6
|
+
total: number;
|
|
7
|
+
active: number;
|
|
8
|
+
duration: number;
|
|
9
|
+
onComplete: () => void;
|
|
10
|
+
onBarClick: (index: number) => void;
|
|
11
|
+
hideBorder?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* StoryProgress - Story-style progress bars at the top
|
|
16
|
+
*/
|
|
17
|
+
function StoryProgress({ total, active, duration, onComplete, onBarClick, hideBorder }: StoryProgressProps) {
|
|
18
|
+
const [key, setKey] = useState(0);
|
|
19
|
+
|
|
20
|
+
// Reset animation key when active slide changes
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
setKey(prev => prev + 1);
|
|
23
|
+
}, [active]);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className={`story-progress${hideBorder ? ' story-progress--no-border' : ''}`}>
|
|
27
|
+
{Array.from({ length: total }).map((_, index) => {
|
|
28
|
+
const isActive = index === active;
|
|
29
|
+
const isCompleted = index < active;
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div
|
|
33
|
+
key={index}
|
|
34
|
+
className="story-progress__bar-container"
|
|
35
|
+
onClick={() => onBarClick(index)}
|
|
36
|
+
>
|
|
37
|
+
<div className={`story-progress__bar ${isCompleted ? 'completed' : ''}`}>
|
|
38
|
+
{isActive && (
|
|
39
|
+
<motion.div
|
|
40
|
+
key={key}
|
|
41
|
+
className="story-progress__bar-fill"
|
|
42
|
+
initial={{ scaleX: 0 }}
|
|
43
|
+
animate={{ scaleX: 1 }}
|
|
44
|
+
transition={{
|
|
45
|
+
duration: duration,
|
|
46
|
+
ease: 'linear'
|
|
47
|
+
}}
|
|
48
|
+
onAnimationComplete={onComplete}
|
|
49
|
+
style={{ transformOrigin: 'left' }}
|
|
50
|
+
/>
|
|
51
|
+
)}
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
})}
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export default StoryProgress;
|
package/src/assets.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type declarations for asset imports
|
|
3
|
+
* Tells TypeScript how to handle SVG, GIF, PNG, and other static assets
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
declare module '*.svg' {
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
export const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
9
|
+
const content: string;
|
|
10
|
+
export default content;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare module '*.gif' {
|
|
14
|
+
const content: string;
|
|
15
|
+
export default content;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare module '*.png' {
|
|
19
|
+
const content: string;
|
|
20
|
+
export default content;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare module '*.jpg' {
|
|
24
|
+
const content: string;
|
|
25
|
+
export default content;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare module '*.jpeg' {
|
|
29
|
+
const content: string;
|
|
30
|
+
export default content;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare module '*.webp' {
|
|
34
|
+
const content: string;
|
|
35
|
+
export default content;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare module '*.mp3' {
|
|
39
|
+
const src: string;
|
|
40
|
+
export default src;
|
|
41
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* Header styles */
|
|
2
|
+
.header {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
width: 100%;
|
|
8
|
+
min-height: 32px;
|
|
9
|
+
gap: 16px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* Logo image - contains both icon and text */
|
|
13
|
+
.header__logo {
|
|
14
|
+
height: 24px;
|
|
15
|
+
width: auto;
|
|
16
|
+
object-fit: contain;
|
|
17
|
+
flex-shrink: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.header__badge {
|
|
21
|
+
font-family: 'Lora', serif;
|
|
22
|
+
font-style: normal;
|
|
23
|
+
font-weight: 700;
|
|
24
|
+
font-size: clamp(14px, 5.13vw, 20px);
|
|
25
|
+
line-height: 1.2;
|
|
26
|
+
background-image: linear-gradient(90deg, #FFFFFF 0%, #FFCC80 100%);
|
|
27
|
+
-webkit-background-clip: text;
|
|
28
|
+
-webkit-text-fill-color: transparent;
|
|
29
|
+
background-clip: text;
|
|
30
|
+
color: transparent;
|
|
31
|
+
white-space: normal;
|
|
32
|
+
word-wrap: break-word;
|
|
33
|
+
flex-shrink: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@media (max-width: 360px) {
|
|
37
|
+
.header__badge {
|
|
38
|
+
white-space: nowrap;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.header--new-user .header__badge {
|
|
43
|
+
background-image: linear-gradient(90deg, #4F4CD8 0%, #FF9900 100%);
|
|
44
|
+
background-size: 100%;
|
|
45
|
+
background-position: 0;
|
|
46
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './Header.css';
|
|
3
|
+
import loginLogo from '../assets/login-logo.svg';
|
|
4
|
+
import slideLogo from '../assets/slide-logo.svg';
|
|
5
|
+
import huxxleBlueLogo from '../assets/huxxle-blue-logo.svg';
|
|
6
|
+
|
|
7
|
+
interface HeaderProps {
|
|
8
|
+
showRecapBadge?: boolean;
|
|
9
|
+
badgeVariant?: 'default' | 'new-user';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Header - Top navigation with logo and optional Recap 25' badge
|
|
14
|
+
* Uses different logos for login/OTP screens vs recap slides
|
|
15
|
+
*/
|
|
16
|
+
function Header({ showRecapBadge = false, badgeVariant = 'default' }: HeaderProps) {
|
|
17
|
+
const logoSrc = showRecapBadge
|
|
18
|
+
? badgeVariant === 'new-user'
|
|
19
|
+
? huxxleBlueLogo
|
|
20
|
+
: slideLogo
|
|
21
|
+
: loginLogo;
|
|
22
|
+
|
|
23
|
+
const headerClasses = ['header'];
|
|
24
|
+
if (showRecapBadge) {
|
|
25
|
+
headerClasses.push('header--with-badge');
|
|
26
|
+
}
|
|
27
|
+
if (badgeVariant === 'new-user') {
|
|
28
|
+
headerClasses.push('header--new-user');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<header className={headerClasses.join(' ')}>
|
|
33
|
+
<img src={logoSrc} alt="Huxxle" className="header__logo" />
|
|
34
|
+
{showRecapBadge && (
|
|
35
|
+
<div className="header__badge">Recap 25'</div>
|
|
36
|
+
)}
|
|
37
|
+
</header>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default Header;
|
package/src/data/mock.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { BUSINESS_CATEGORIES } from '../types';
|
|
2
|
+
import type { RecapData } from '../types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Mock data for the recap experience
|
|
6
|
+
* This will be replaced with real API data later
|
|
7
|
+
*/
|
|
8
|
+
export const mockRecapData: RecapData = {
|
|
9
|
+
businessName: 'RICHYO ENTERPRISES',
|
|
10
|
+
days: 259,
|
|
11
|
+
streak: 47,
|
|
12
|
+
revenue: 22594123,
|
|
13
|
+
orders: 487,
|
|
14
|
+
firstTimeBuyers: 234,
|
|
15
|
+
repeatBuyers: 65,
|
|
16
|
+
topCustomerName: 'Micheal Scoffy',
|
|
17
|
+
topProducts: [
|
|
18
|
+
{
|
|
19
|
+
name: 'Vanilla Yoghurt',
|
|
20
|
+
units: 45,
|
|
21
|
+
productImage: 'https://images.unsplash.com/photo-1447078806655-40579c2520d6?auto=format&fit=crop&w=400&q=80'
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'Cocoa Milkshake',
|
|
25
|
+
units: 38,
|
|
26
|
+
productImage: 'https://images.unsplash.com/photo-1504674900247-0877df9cc836?auto=format&fit=crop&w=400&q=80'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'Spicy Crunch',
|
|
30
|
+
units: 33,
|
|
31
|
+
productImage: 'https://images.unsplash.com/photo-1447078806655-40579c2520d6?auto=format&fit=crop&w=400&q=80'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'Fresh Plantain Chips',
|
|
35
|
+
units: 29,
|
|
36
|
+
productImage: 'https://images.unsplash.com/photo-1506084868230-bb9d95c24759?auto=format&fit=crop&w=400&q=80'
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'Mango Juice',
|
|
40
|
+
units: 27,
|
|
41
|
+
productImage: 'https://images.unsplash.com/photo-1447078806655-40579c2520d6?auto=format&fit=crop&w=400&q=80'
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
businessCategory: BUSINESS_CATEGORIES.THRIVING,
|
|
45
|
+
busiestMonth: 'Oct',
|
|
46
|
+
videoUrl: 'https://katajereassets.blob.core.windows.net/sp-list-assets/mocksite_walkthrough_a75c98dd-47ef-4f2c-a97c-ab2b3c3c97a5_2315a6b2d671d142f34e08cad43929c5.mp4',
|
|
47
|
+
downloadUrl: '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'
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// Slide durations in seconds - each slide can have its own timing
|
|
51
|
+
export const slideDurations: Record<string, number> = {
|
|
52
|
+
intro: 8,
|
|
53
|
+
days: 8,
|
|
54
|
+
revenue: 8,
|
|
55
|
+
orders: 8,
|
|
56
|
+
buyers: 8,
|
|
57
|
+
customer: 8,
|
|
58
|
+
products: 8,
|
|
59
|
+
months: 8,
|
|
60
|
+
year: 8,
|
|
61
|
+
final: 8
|
|
62
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BusinessCategory } from '../types';
|
|
2
|
+
|
|
3
|
+
export interface RecapSlideCopy {
|
|
4
|
+
introHeadline: string;
|
|
5
|
+
introSubtitle: string;
|
|
6
|
+
introVariant: 'default' | 'struggling' | 'new-user';
|
|
7
|
+
revenueFooter: string;
|
|
8
|
+
yearHeadline: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const recapCopy: Record<BusinessCategory, RecapSlideCopy> = {
|
|
12
|
+
thriving: {
|
|
13
|
+
introHeadline: 'This Year You Carry Your Hustle For Head',
|
|
14
|
+
introSubtitle: 'Make we look the numbers 🔥',
|
|
15
|
+
introVariant: 'default',
|
|
16
|
+
revenueFooter: 'More money dey come!',
|
|
17
|
+
yearHeadline: 'You really kill am this year, You are the real MVP'
|
|
18
|
+
},
|
|
19
|
+
not_thriving: {
|
|
20
|
+
introHeadline: 'Omoor! We See Your Hustle, But….',
|
|
21
|
+
introSubtitle: 'Make we talk small 🤫',
|
|
22
|
+
introVariant: 'struggling',
|
|
23
|
+
revenueFooter: 'Consistency go pay, we dey your back.',
|
|
24
|
+
yearHeadline: 'This year rough, but you are the real MVP'
|
|
25
|
+
},
|
|
26
|
+
new_user: {
|
|
27
|
+
introHeadline: 'You Be New Face OOO....',
|
|
28
|
+
introSubtitle: 'Come back for 6 days time, we dey for you 😉',
|
|
29
|
+
introVariant: 'new-user',
|
|
30
|
+
revenueFooter: 'Draft the plan, then the sales go follow.',
|
|
31
|
+
yearHeadline: 'You really kill am this year, You are the real MVP'
|
|
32
|
+
}
|
|
33
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
interface UseBackgroundMusicOptions {
|
|
4
|
+
src: string;
|
|
5
|
+
volume?: number;
|
|
6
|
+
autoPlay?: boolean;
|
|
7
|
+
loop?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* useBackgroundMusic - simple audio controller for a single background track.
|
|
12
|
+
* Handles autoplay attempt (may be blocked by browsers), mute toggle, and cleanup on unmount.
|
|
13
|
+
*/
|
|
14
|
+
export function useBackgroundMusic({ src, volume = 0.6, autoPlay = true, loop = false }: UseBackgroundMusicOptions) {
|
|
15
|
+
const audioRef = useRef<HTMLAudioElement | null>(null);
|
|
16
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
|
17
|
+
const [isMuted, setIsMuted] = useState(false);
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const audio = new Audio(src);
|
|
21
|
+
audio.loop = loop;
|
|
22
|
+
audio.volume = volume;
|
|
23
|
+
audioRef.current = audio;
|
|
24
|
+
|
|
25
|
+
const handlePlay = () => setIsPlaying(true);
|
|
26
|
+
const handlePause = () => setIsPlaying(false);
|
|
27
|
+
const handleEnded = () => setIsPlaying(false);
|
|
28
|
+
|
|
29
|
+
audio.addEventListener('play', handlePlay);
|
|
30
|
+
audio.addEventListener('pause', handlePause);
|
|
31
|
+
audio.addEventListener('ended', handleEnded);
|
|
32
|
+
|
|
33
|
+
if (autoPlay) {
|
|
34
|
+
const playPromise = audio.play();
|
|
35
|
+
if (playPromise !== undefined) {
|
|
36
|
+
playPromise.catch(() => {
|
|
37
|
+
// Autoplay may be blocked; user interaction will be needed.
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return () => {
|
|
43
|
+
audio.removeEventListener('play', handlePlay);
|
|
44
|
+
audio.removeEventListener('pause', handlePause);
|
|
45
|
+
audio.removeEventListener('ended', handleEnded);
|
|
46
|
+
audio.pause();
|
|
47
|
+
audio.src = '';
|
|
48
|
+
audioRef.current = null;
|
|
49
|
+
};
|
|
50
|
+
}, [src, volume, autoPlay, loop]);
|
|
51
|
+
|
|
52
|
+
const play = () => {
|
|
53
|
+
const playPromise = audioRef.current?.play();
|
|
54
|
+
if (playPromise !== undefined) {
|
|
55
|
+
playPromise.catch(() => {
|
|
56
|
+
// Playback failed (likely blocked); caller may prompt user interaction.
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const pause = () => audioRef.current?.pause();
|
|
62
|
+
|
|
63
|
+
const stop = () => {
|
|
64
|
+
if (audioRef.current) {
|
|
65
|
+
audioRef.current.pause();
|
|
66
|
+
audioRef.current.currentTime = 0;
|
|
67
|
+
setIsPlaying(false);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const toggleMute = () => {
|
|
72
|
+
if (!audioRef.current) return;
|
|
73
|
+
const nextMuted = !audioRef.current.muted;
|
|
74
|
+
audioRef.current.muted = nextMuted;
|
|
75
|
+
setIsMuted(nextMuted);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
return { isPlaying, isMuted, play, pause, stop, toggleMute };
|
|
79
|
+
}
|
package/src/index.css
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
body {
|
|
2
|
+
margin: 0;
|
|
3
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
4
|
+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
5
|
+
sans-serif;
|
|
6
|
+
-webkit-font-smoothing: antialiased;
|
|
7
|
+
-moz-osx-font-smoothing: grayscale;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
code {
|
|
11
|
+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
|
12
|
+
monospace;
|
|
13
|
+
}
|