@katajere/recap 1.0.3 → 1.0.10
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 +156 -156
- package/dist/FloatingFrames.css +55 -55
- package/dist/LoginScreen.css +146 -146
- package/dist/OtpScreen.css +133 -133
- package/dist/RecapStory.css +105 -105
- package/dist/StoryProgress.css +47 -47
- package/dist/assets/huxxle-blue-logo.svg +14 -14
- package/dist/assets/login-logo.svg +14 -14
- package/dist/assets/slide-logo.svg +14 -14
- package/dist/components/Header.css +46 -46
- package/dist/slides/Slide10Final.css +101 -101
- package/dist/slides/Slide1Intro.css +235 -235
- package/dist/slides/Slide2Days.css +209 -209
- package/dist/slides/Slide3Revenue.css +89 -89
- package/dist/slides/Slide4Orders.css +135 -135
- package/dist/slides/Slide5Buyers.css +140 -140
- package/dist/slides/Slide6Customer.css +92 -92
- package/dist/slides/Slide7Products.css +144 -144
- package/dist/slides/Slide8Months.css +148 -148
- package/dist/slides/Slide9Year.css +93 -93
- package/package.json +1 -1
- package/src/App.css +156 -156
- package/src/FloatingFrames.css +55 -55
- package/src/FloatingFrames.tsx +27 -27
- package/src/LoginScreen.css +146 -146
- package/src/LoginScreen.tsx +70 -70
- package/src/OtpScreen.css +133 -133
- package/src/OtpScreen.tsx +109 -109
- package/src/RecapApp.tsx +34 -34
- package/src/RecapStory.css +105 -105
- package/src/RecapStory.tsx +269 -269
- package/src/StoryProgress.css +47 -47
- package/src/StoryProgress.tsx +60 -60
- package/src/assets.d.ts +41 -41
- package/src/components/Header.css +46 -46
- package/src/components/Header.tsx +41 -41
- package/src/data/mock.ts +62 -62
- package/src/data/recapCopy.ts +33 -33
- package/src/hooks/useBackgroundMusic.ts +79 -79
- package/src/index.ts +70 -70
- package/src/react-app-env.d.ts +26 -26
- package/src/slides/Slide10Final.css +101 -101
- package/src/slides/Slide10Final.tsx +105 -105
- package/src/slides/Slide1Intro.css +235 -235
- package/src/slides/Slide1Intro.tsx +141 -141
- package/src/slides/Slide2Days.css +209 -209
- package/src/slides/Slide2Days.tsx +92 -92
- package/src/slides/Slide3Revenue.css +89 -89
- package/src/slides/Slide3Revenue.tsx +76 -76
- package/src/slides/Slide4Orders.css +135 -135
- package/src/slides/Slide4Orders.tsx +63 -63
- package/src/slides/Slide5Buyers.css +140 -140
- package/src/slides/Slide5Buyers.tsx +74 -74
- package/src/slides/Slide6Customer.css +92 -92
- package/src/slides/Slide6Customer.tsx +27 -27
- package/src/slides/Slide7Products.css +144 -144
- package/src/slides/Slide7Products.tsx +81 -81
- package/src/slides/Slide8Months.css +148 -148
- package/src/slides/Slide8Months.tsx +63 -63
- package/src/slides/Slide9Year.css +93 -93
- package/src/slides/Slide9Year.tsx +35 -35
- package/src/types.ts +39 -39
- package/src/utils/format.ts +18 -18
- package/src/utils/index.ts +3 -3
- package/src/utils/motion.ts +89 -89
package/src/RecapStory.tsx
CHANGED
|
@@ -1,269 +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;
|
|
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;
|
package/src/StoryProgress.css
CHANGED
|
@@ -1,47 +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
|
-
}
|
|
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
|
+
}
|