@katajere/recap 1.0.14 → 2.1.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.
Files changed (98) hide show
  1. package/dist/App.css +22 -2
  2. package/dist/LoginScreen.css +22 -21
  3. package/dist/OtpScreen.css +20 -17
  4. package/dist/RecapStory.css +148 -0
  5. package/dist/RecapStory.d.ts.map +1 -1
  6. package/dist/RecapStory.js +63 -29
  7. package/dist/StoryProgress.css +3 -3
  8. package/dist/assets/huxxle-login-blue-logo.svg +14 -0
  9. package/dist/assets/noisy-background.svg +23 -0
  10. package/dist/assets/search-icon.svg +4 -0
  11. package/dist/assets/share-button.svg +5 -0
  12. package/dist/assets/web-icon.png +0 -0
  13. package/dist/assets/web-icon.svg +14 -0
  14. package/dist/components/Header.css +12 -1
  15. package/dist/components/Header.js +2 -2
  16. package/dist/data/mock.d.ts.map +1 -1
  17. package/dist/data/mock.js +19 -7
  18. package/dist/index.d.ts +0 -1
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +0 -1
  21. package/dist/slides/Slide10Final.css +73 -35
  22. package/dist/slides/Slide1Intro.css +204 -56
  23. package/dist/slides/Slide1Intro.d.ts +2 -1
  24. package/dist/slides/Slide1Intro.d.ts.map +1 -1
  25. package/dist/slides/Slide1Intro.js +41 -47
  26. package/dist/slides/Slide2Days.css +121 -34
  27. package/dist/slides/Slide2Days.d.ts +2 -1
  28. package/dist/slides/Slide2Days.d.ts.map +1 -1
  29. package/dist/slides/Slide2Days.js +45 -4
  30. package/dist/slides/Slide3Revenue.css +80 -38
  31. package/dist/slides/Slide3Revenue.d.ts.map +1 -1
  32. package/dist/slides/Slide3Revenue.js +33 -4
  33. package/dist/slides/Slide4Orders.css +93 -34
  34. package/dist/slides/Slide4Orders.d.ts +2 -1
  35. package/dist/slides/Slide4Orders.d.ts.map +1 -1
  36. package/dist/slides/Slide4Orders.js +45 -3
  37. package/dist/slides/Slide5Buyers.css +124 -67
  38. package/dist/slides/Slide5Buyers.d.ts +2 -1
  39. package/dist/slides/Slide5Buyers.d.ts.map +1 -1
  40. package/dist/slides/Slide5Buyers.js +43 -3
  41. package/dist/slides/Slide6Customer.css +294 -52
  42. package/dist/slides/Slide6Customer.d.ts +6 -3
  43. package/dist/slides/Slide6Customer.d.ts.map +1 -1
  44. package/dist/slides/Slide6Customer.js +25 -4
  45. package/dist/slides/Slide7Products.css +8 -7
  46. package/dist/slides/Slide7Products.js +3 -3
  47. package/dist/slides/Slide8Months.css +6 -6
  48. package/dist/slides/Slide9Year.css +4 -2
  49. package/dist/slides/Slide9Year.d.ts +2 -1
  50. package/dist/slides/Slide9Year.d.ts.map +1 -1
  51. package/dist/slides/Slide9Year.js +23 -2
  52. package/dist/types.d.ts +5 -0
  53. package/dist/types.d.ts.map +1 -1
  54. package/dist/utils/slideScreenshot.d.ts +27 -0
  55. package/dist/utils/slideScreenshot.d.ts.map +1 -0
  56. package/dist/utils/slideScreenshot.js +274 -0
  57. package/package.json +2 -1
  58. package/src/App.css +22 -2
  59. package/src/LoginScreen.css +22 -21
  60. package/src/LoginScreen.tsx +1 -1
  61. package/src/OtpScreen.css +20 -17
  62. package/src/OtpScreen.tsx +1 -1
  63. package/src/RecapStory.css +148 -0
  64. package/src/RecapStory.tsx +134 -58
  65. package/src/StoryProgress.css +3 -3
  66. package/src/components/Header.css +12 -1
  67. package/src/components/Header.tsx +2 -2
  68. package/src/data/mock.ts +19 -7
  69. package/src/index.ts +0 -1
  70. package/src/slides/Slide10Final.css +73 -35
  71. package/src/slides/Slide1Intro.css +204 -56
  72. package/src/slides/Slide1Intro.tsx +89 -81
  73. package/src/slides/Slide2Days.css +121 -34
  74. package/src/slides/Slide2Days.tsx +67 -19
  75. package/src/slides/Slide3Revenue.css +80 -38
  76. package/src/slides/Slide3Revenue.tsx +45 -7
  77. package/src/slides/Slide4Orders.css +93 -34
  78. package/src/slides/Slide4Orders.tsx +71 -10
  79. package/src/slides/Slide5Buyers.css +124 -67
  80. package/src/slides/Slide5Buyers.tsx +97 -38
  81. package/src/slides/Slide6Customer.css +294 -52
  82. package/src/slides/Slide6Customer.tsx +68 -10
  83. package/src/slides/Slide7Products.css +8 -7
  84. package/src/slides/Slide7Products.tsx +3 -3
  85. package/src/slides/Slide8Months.css +6 -6
  86. package/src/slides/Slide9Year.css +4 -2
  87. package/src/slides/Slide9Year.tsx +35 -7
  88. package/src/types.ts +5 -0
  89. package/src/utils/slideScreenshot.ts +324 -0
  90. package/dist/FloatingFrames.css +0 -55
  91. package/dist/FloatingFrames.d.ts +0 -11
  92. package/dist/FloatingFrames.d.ts.map +0 -1
  93. package/dist/FloatingFrames.js +0 -12
  94. package/dist/assets/money-rain.png +0 -0
  95. package/dist/assets/raining-money.gif +0 -0
  96. package/dist/assets/recap-music.mp3 +0 -0
  97. package/src/FloatingFrames.css +0 -55
  98. package/src/FloatingFrames.tsx +0 -27
@@ -1,30 +1,27 @@
1
+ /* Slide3Revenue - Figma exact specifications with blue/purple scheme */
2
+
1
3
  .slide3-revenue {
2
4
  position: relative;
3
5
  width: 100%;
4
- min-height: 100%;
6
+ height: 100%;
5
7
  overflow: hidden;
6
8
  display: flex;
7
9
  align-items: center;
8
10
  justify-content: center;
9
- padding: 9.48% 6.15% 7.11%;
10
- }
11
-
12
- @media (max-height: 720px), (orientation: landscape) {
13
- .slide3-revenue {
14
- padding: clamp(24px, 5vh, 40px) 6.15% clamp(24px, 4vh, 32px);
15
- }
16
11
  }
17
12
 
18
13
  .slide3-revenue__overlay {
19
14
  position: absolute;
20
- inset: 0;
15
+ width: 100%;
16
+ height: 100%;
17
+ left: 0;
18
+ top: 0;
21
19
  background-size: cover;
22
20
  background-repeat: no-repeat;
23
21
  background-position: center;
24
- opacity: 0.05;
25
- mix-blend-mode: screen;
22
+ opacity: 0.1;
26
23
  z-index: 0;
27
- filter: brightness(0.75);
24
+ pointer-events: none;
28
25
  }
29
26
 
30
27
  .slide3-revenue__content {
@@ -35,55 +32,100 @@
35
32
  flex-direction: column;
36
33
  align-items: center;
37
34
  justify-content: center;
38
- gap: 2.84vh;
35
+ gap: clamp(12px, 2dvh, 24px);
39
36
  text-align: center;
40
- }
41
-
42
- .gradient-text {
43
- background: linear-gradient(90deg, #FFFFFF 0%, #FFCC80 100%);
44
- -webkit-background-clip: text;
45
- -webkit-text-fill-color: transparent;
46
- background-clip: text;
47
- color: transparent;
37
+ padding: 0 calc(16px + env(safe-area-inset-left)) 0 calc(16px + env(safe-area-inset-right));
48
38
  }
49
39
 
50
40
  .slide3-revenue__title {
51
- font-family: 'Lora', 'Georgia', serif;
52
- font-size: 2.84vh;
53
- font-weight: 500;
54
- letter-spacing: 0.04em;
41
+ font-family: 'Lora', serif;
42
+ font-style: normal;
43
+ font-weight: 600;
44
+ font-size: clamp(16px, 4.1vw, 20px);
45
+ line-height: 1.25;
46
+ color: #3734D3;
55
47
  margin: 0;
56
48
  }
57
49
 
58
50
  .slide3-revenue__amount {
59
- font-family: 'Lora', 'Georgia', serif;
60
- font-size: 7.58vh;
51
+ font-family: 'Lora', serif;
52
+ font-style: normal;
61
53
  font-weight: 700;
54
+ font-size: clamp(40px, 12vh, 60px);
62
55
  line-height: 1;
56
+ /* color: #4F4CD8; */
57
+ background: var(--bg-gradient);
58
+ -webkit-background-clip: text;
59
+ -webkit-text-fill-color: transparent;
60
+ background-clip: text;
63
61
  margin: 0;
62
+ display: flex;
63
+ align-items: baseline;
64
+ justify-content: center;
64
65
  }
65
66
 
66
67
  .slide3-revenue__subline {
67
- font-family: 'Lora', 'Georgia', serif;
68
- font-size: 1.9vh;
68
+ font-family: 'Lora', serif;
69
+ font-style: normal;
69
70
  font-weight: 400;
71
+ font-size: clamp(14px, 4.1vw, 16px);
72
+ line-height: 1.5;
73
+ color: #3734D3;
70
74
  margin: 0;
71
75
  }
72
76
 
73
77
  .slide3-revenue__footer {
74
78
  position: absolute;
75
- bottom: 4.74%;
76
- left: 4.1%;
77
- transform: translateX(0);
78
- font-family: 'Lora', 'Georgia', serif;
79
- font-size: clamp(14px, 4.1vw, 16px);
79
+ bottom: calc(100px + env(safe-area-inset-bottom));
80
+ left: 0;
81
+ right: 0;
82
+ padding: 0 calc(16px + env(safe-area-inset-left)) 0 calc(16px + env(safe-area-inset-right));
83
+ font-family: 'Lora', serif;
84
+ font-style: normal;
80
85
  font-weight: 400;
81
- letter-spacing: 0.03em;
86
+ font-size: clamp(14px, 4.1vw, 16px);
87
+ line-height: 1.5;
88
+ color: #3734D3;
89
+ text-align: left;
82
90
  z-index: 1;
83
91
  }
84
92
 
85
- @media (max-width: 480px) {
86
- .slide3-revenue {
87
- padding: 7.11% 4.1% 5.69%;
93
+ /* Media queries for landscape and short screens */
94
+ @media (max-height: 720px), (orientation: landscape) {
95
+ .slide3-revenue__amount {
96
+ font-size: clamp(36px, 10dvh, 60px);
97
+ }
98
+
99
+ .slide3-revenue__title {
100
+ font-size: clamp(14px, 3.5vw, 18px);
101
+ }
102
+ }
103
+
104
+ /* Small/Short screens - handles browser chrome taking space */
105
+ @media (max-height: 700px) {
106
+ .slide3-revenue__amount {
107
+ font-size: clamp(32px, 9dvh, 56px);
108
+ }
109
+
110
+ .slide3-revenue__footer {
111
+ bottom: calc(90px + env(safe-area-inset-bottom));
112
+ font-size: clamp(12px, 3.5vw, 14px);
113
+ }
114
+ }
115
+
116
+ /* Extra short screens (under 600px) - more aggressive adjustments */
117
+ @media (max-height: 600px) {
118
+ .slide3-revenue__amount {
119
+ font-size: clamp(28px, 8dvh, 52px);
120
+ }
121
+
122
+ .slide3-revenue__title,
123
+ .slide3-revenue__subline {
124
+ font-size: clamp(12px, 3vw, 14px);
125
+ }
126
+
127
+ .slide3-revenue__footer {
128
+ bottom: calc(80px + env(safe-area-inset-bottom));
129
+ font-size: clamp(11px, 3vw, 13px);
88
130
  }
89
131
  }
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
- import { motion } from 'framer-motion';
2
+ import { motion, useMotionValue, useTransform, animate } from 'framer-motion';
3
3
  import { formatCurrency } from '../utils';
4
4
  import { BUSINESS_CATEGORIES, BusinessCategory } from '../types';
5
5
  import { recapCopy } from '../data/recapCopy';
6
6
  import './Slide3Revenue.css';
7
7
 
8
- import moneyRainGif from '../assets/raining-money.gif';
8
+ // External CDN URL for raining money GIF (reduces package size)
9
+ const moneyRainGif = "https://katajereassets.blob.core.windows.net/recap-videos/raining-money.gif";
9
10
 
10
11
  interface Slide3RevenueProps {
11
12
  revenue: number;
@@ -13,12 +14,48 @@ interface Slide3RevenueProps {
13
14
  currency?: string;
14
15
  }
15
16
 
17
+ /**
18
+ * Custom hook for number counter animation with formatting
19
+ */
20
+ function useCountAnimation(target: number, duration: number = 2, delay: number = 0) {
21
+ const count = useMotionValue(0);
22
+ const formatted = useTransform(count, (latest) =>
23
+ Math.round(latest).toLocaleString()
24
+ );
25
+
26
+ React.useEffect(() => {
27
+ const controls = animate(count, target, {
28
+ duration,
29
+ delay,
30
+ ease: 'easeOut',
31
+ });
32
+
33
+ return controls.stop;
34
+ }, [count, target, duration, delay]);
35
+
36
+ return formatted;
37
+ }
38
+
16
39
  /**
17
40
  * Slide3Revenue - Revenue display with money rain overlay
18
41
  */
19
42
  function Slide3Revenue({ revenue, businessCategory, currency }: Slide3RevenueProps) {
20
43
  const copy = recapCopy[businessCategory] ?? recapCopy[BUSINESS_CATEGORIES.THRIVING];
21
44
  const footerText = copy.revenueFooter;
45
+
46
+ // Counter animation for revenue
47
+ const revenueCount = useCountAnimation(revenue, 1.6, 0.4); // 1.6s + 0.4s delay = 2s total
48
+
49
+ // Get currency symbol
50
+ const getCurrencySymbol = (curr?: string) => {
51
+ const symbols: Record<string, string> = {
52
+ GBP: '£',
53
+ USD: '$',
54
+ EUR: '€',
55
+ NGN: '₦',
56
+ };
57
+ return symbols[curr ?? 'GBP'] ?? '£';
58
+ };
22
59
 
23
60
  return (
24
61
  <div className="slide3-revenue">
@@ -32,7 +69,7 @@ function Slide3Revenue({ revenue, businessCategory, currency }: Slide3RevenuePro
32
69
  <div className="slide3-revenue__content">
33
70
  {/* Title */}
34
71
  <motion.h2
35
- className="slide3-revenue__title gradient-text"
72
+ className="slide3-revenue__title"
36
73
  initial={{ opacity: 0, y: 20 }}
37
74
  animate={{ opacity: 1, y: 0 }}
38
75
  transition={{ duration: 0.5 }}
@@ -42,17 +79,18 @@ function Slide3Revenue({ revenue, businessCategory, currency }: Slide3RevenuePro
42
79
 
43
80
  {/* Big amount with counter animation */}
44
81
  <motion.div
45
- className="slide3-revenue__amount gradient-text"
82
+ className="slide3-revenue__amount"
46
83
  initial={{ opacity: 0, scale: 0.9 }}
47
84
  animate={{ opacity: 1, scale: 1 }}
48
85
  transition={{ duration: 0.8, delay: 0.3 }}
49
86
  >
50
- {formatCurrency(revenue, currency)}
87
+ <span className="slide3-revenue__currency">{getCurrencySymbol(currency)}</span>
88
+ <motion.span>{revenueCount}</motion.span>
51
89
  </motion.div>
52
90
 
53
91
  {/* Subline */}
54
92
  <motion.p
55
- className="slide3-revenue__subline gradient-text"
93
+ className="slide3-revenue__subline"
56
94
  initial={{ opacity: 0, y: 20 }}
57
95
  animate={{ opacity: 1, y: 0 }}
58
96
  transition={{ duration: 0.5, delay: 0.6 }}
@@ -63,7 +101,7 @@ function Slide3Revenue({ revenue, businessCategory, currency }: Slide3RevenuePro
63
101
 
64
102
  {/* Footer message */}
65
103
  <motion.div
66
- className="slide3-revenue__footer gradient-text"
104
+ className="slide3-revenue__footer"
67
105
  initial={{ opacity: 0, y: 20 }}
68
106
  animate={{ opacity: 1, y: 0 }}
69
107
  transition={{ duration: 0.5, delay: 0.9 }}
@@ -1,20 +1,16 @@
1
+ /* Slide4Orders - Figma exact specifications with blue/purple scheme */
2
+
1
3
  .slide4-orders {
2
4
  position: relative;
3
5
  width: 100%;
4
- min-height: 100%;
6
+ height: 100%;
5
7
  display: flex;
6
8
  align-items: flex-start;
7
9
  justify-content: center;
8
- padding: 0 6.15%;
10
+ padding: 0 calc(16px + env(safe-area-inset-left)) 0 calc(16px + env(safe-area-inset-right));
9
11
  overflow: hidden;
10
12
  }
11
13
 
12
- /* @media (max-height: 720px), (orientation: landscape) {
13
- .slide4-orders {
14
- padding: clamp(24px, 5vh, 40px) 6.15% clamp(24px, 4vh, 32px);
15
- }
16
- } */
17
-
18
14
  .slide4-orders__grid {
19
15
  position: absolute;
20
16
  width: 1117px;
@@ -31,13 +27,13 @@
31
27
  position: absolute;
32
28
  inset: 0;
33
29
  }
30
+
34
31
  .slide4-orders__rect {
35
32
  position: absolute;
36
33
  width: 180px;
37
34
  height: 240px;
38
35
  box-sizing: border-box;
39
- border: 1px solid #FFFFFF;
40
- /* transform-origin: 0 0; */
36
+ border: 1px solid var(--rect-border);
41
37
  transform: rotate(28.8631deg);
42
38
  flex: none;
43
39
  }
@@ -50,7 +46,6 @@
50
46
  .slide4-orders__rect.r6 { left: 831.705px; top: 371.446px; }
51
47
  .slide4-orders__rect.r7 { left: 710.06px; top: 592.142px; }
52
48
  .slide4-orders__rect.r8 { left: 588.415px; top: 812.837px; }
53
- /* .slide4-orders__rect.r9 { left: 480.984px; top: 208.701px; } */
54
49
  .slide4-orders__rect.r10 { left: 359.339px; top: 429.397px; }
55
50
  .slide4-orders__rect.r11 { left: 237.694px; top: 650.092px; }
56
51
  .slide4-orders__rect.r12 { left: 116.049px; top: 870.788px; }
@@ -86,50 +81,114 @@
86
81
  }
87
82
 
88
83
  .slide4-orders__content {
89
- position: relative;
84
+ position: absolute;
90
85
  z-index: 1;
91
- width: 100%;
92
- max-width: 360px;
86
+ width: calc(100% - 32px - env(safe-area-inset-left) - env(safe-area-inset-right));
87
+ max-width: 358px;
93
88
  display: flex;
94
89
  flex-direction: column;
95
90
  align-items: flex-start;
96
- gap: 2.84dvh;
97
- margin-top: 18.6vh;
91
+ gap: 32px;
92
+ left: calc(16px + env(safe-area-inset-left));
93
+ top: calc(50% - 137px/2 - 189.5px);
98
94
  }
99
- .slide4-orders__label,
100
- .slide4-orders__number,
101
- .slide4-orders__caption {
102
- font-family: 'Lora', 'Georgia', serif;
103
- background: linear-gradient(90deg, #FFFFFF 0%, #FFCC80 100%);
104
- -webkit-background-clip: text;
105
- -webkit-text-fill-color: transparent;
106
- background-clip: text;
107
- color: transparent;
95
+
96
+ /* Large/Tall screens - position content higher for better balance */
97
+ @media (min-height: 800px) {
98
+ .slide4-orders__content {
99
+ top: calc(50% - 137px/2 - 230px);
100
+ }
101
+ }
102
+
103
+ @media (min-height: 900px) {
104
+ .slide4-orders__content {
105
+ top: calc(50% - 137px/2 - 260px);
106
+ }
108
107
  }
109
108
 
110
109
  .slide4-orders__label {
111
- font-size: 2.84vh;
110
+ width: 100%;
111
+ font-family: 'Lora', serif;
112
+ font-style: normal;
112
113
  font-weight: 500;
113
- letter-spacing: 0.02em;
114
+ font-size: clamp(14px, 4.1vw, 16px);
115
+ line-height: 1.5;
116
+ color: var(--text-primary);
117
+ /* background: var(--bg-gradient);
118
+ -webkit-background-clip: text;
119
+ -webkit-text-fill-color: transparent;
120
+ background-clip: text; */
121
+ margin: 0;
114
122
  }
115
123
 
116
124
  .slide4-orders__number {
117
- font-size: 11.37vh;
125
+ width: 100%;
126
+ font-family: 'Lora', serif;
127
+ font-style: normal;
118
128
  font-weight: 700;
129
+ font-size: 10vh;
119
130
  line-height: 1;
131
+ /* color: #4F4CD8; */
132
+ background: var(--bg-gradient);
133
+ -webkit-background-clip: text;
134
+ -webkit-text-fill-color: transparent;
135
+ background-clip: text;
136
+ margin: 0;
120
137
  }
121
138
 
122
139
  .slide4-orders__caption {
123
- font-size: 1.9vh;
140
+ width: 100%;
141
+ font-family: 'Lora', serif;
142
+ font-style: normal;
124
143
  font-weight: 400;
144
+ font-size: clamp(14px, 4.1vw, 16px);
145
+ line-height: 1.5;
146
+ color: #3734D3;
147
+ margin: 0;
148
+ }
149
+
150
+ /* Media queries for landscape and short screens */
151
+ @media (max-height: 720px), (orientation: landscape) {
152
+ .slide4-orders__content {
153
+ /* top: calc(50% - 120px/2 - 150px); */
154
+ gap: 24px;
155
+ }
156
+
157
+ .slide4-orders__number {
158
+ font-size: 9dvh;
159
+ }
125
160
  }
126
161
 
127
- /* @media (max-width: 480px) {
128
- .slide4-orders {
129
- padding: 8.29% 4.1% 5.92%;
162
+ /* Small/Short screens - handles browser chrome taking space */
163
+ @media (max-height: 700px) {
164
+ .slide4-orders__content {
165
+ top: calc(50% - 100px/2 - 130px);
166
+ gap: 20px;
167
+ }
168
+
169
+ .slide4-orders__number {
170
+ font-size: 8dvh;
171
+ }
172
+
173
+ .slide4-orders__label,
174
+ .slide4-orders__caption {
175
+ font-size: clamp(12px, 3.5vw, 14px);
130
176
  }
177
+ }
131
178
 
179
+ /* Extra short screens (under 600px) - more aggressive adjustments */
180
+ @media (max-height: 600px) {
181
+ .slide4-orders__content {
182
+ top: calc(50% - 80px/2 - 100px);
183
+ gap: 16px;
184
+ }
185
+
132
186
  .slide4-orders__number {
133
- font-size: clamp(56px, 26vw, 72px);
187
+ font-size: 7dvh;
134
188
  }
135
- } */
189
+
190
+ .slide4-orders__label,
191
+ .slide4-orders__caption {
192
+ font-size: clamp(11px, 3vw, 13px);
193
+ }
194
+ }
@@ -1,31 +1,92 @@
1
1
  import React from 'react';
2
- import { motion } from 'framer-motion';
2
+ import { motion, useMotionValue, useTransform, animate } from 'framer-motion';
3
3
  import './Slide4Orders.css';
4
4
 
5
5
  interface Slide4OrdersProps {
6
6
  orders: number;
7
+ frameImages?: string[];
8
+ }
9
+
10
+ /**
11
+ * Custom hook for number counter animation
12
+ */
13
+ function useCountAnimation(target: number, duration: number = 2, delay: number = 0) {
14
+ const count = useMotionValue(0);
15
+ const rounded = useTransform(count, (latest) => Math.round(latest));
16
+
17
+ React.useEffect(() => {
18
+ const controls = animate(count, target, {
19
+ duration,
20
+ delay,
21
+ ease: 'easeOut',
22
+ });
23
+
24
+ return controls.stop;
25
+ }, [count, target, duration, delay]);
26
+
27
+ return rounded;
7
28
  }
8
29
 
9
30
  /**
10
31
  * Slide4Orders - Emphasizes the order volume with rotated card outlines in the background
11
32
  */
12
- function Slide4Orders({ orders }: Slide4OrdersProps) {
33
+ function Slide4Orders({ orders, frameImages }: Slide4OrdersProps) {
34
+ const ordersCount = useCountAnimation(orders, 1.6, 0.4); // 1.6s + 0.4s delay = 2s total
13
35
  const rectGroups = [
14
36
  { id: 'group-1', rects: ['r5', 'r6', 'r7', 'r8'], groupClass: 'group-1' },
15
37
  { id: 'group-2', rects: ['r1', 'r2', 'r3', 'r4'], groupClass: 'group-2' },
16
38
  { id: 'group-3', rects: ['r10', 'r11', 'r12'], groupClass: 'group-3' }
17
39
  ];
18
40
 
41
+ const frameImagePool = React.useMemo(() => {
42
+ return frameImages && frameImages.length > 0 ? frameImages : [];
43
+ }, [frameImages]);
44
+
45
+ const totalRects = rectGroups.reduce((sum, group) => sum + group.rects.length, 0);
46
+
47
+ const rectImageAssignments = React.useMemo(() => {
48
+ if (!frameImagePool.length) {
49
+ return [];
50
+ }
51
+
52
+ return Array.from({ length: totalRects }, () =>
53
+ frameImagePool[Math.floor(Math.random() * frameImagePool.length)]
54
+ );
55
+ }, [frameImagePool, totalRects]);
56
+
19
57
  return (
20
58
  <div className="slide4-orders">
21
59
  <div className="slide4-orders__grid" aria-hidden="true">
22
- {rectGroups.map(group => (
23
- <React.Fragment key={group.id}>
24
- {group.rects.map(rect => (
25
- <span key={rect} className={`slide4-orders__rect ${rect} ${group.groupClass}`} />
26
- ))}
27
- </React.Fragment>
28
- ))}
60
+ {rectGroups.map((group, groupIndex) => {
61
+ const groupStartIndex = rectGroups
62
+ .slice(0, groupIndex)
63
+ .reduce((sum, current) => sum + current.rects.length, 0);
64
+
65
+ return (
66
+ <React.Fragment key={group.id}>
67
+ {group.rects.map((rect, rectIndex) => {
68
+ const rectIndexOverall = groupStartIndex + rectIndex;
69
+ const image = rectImageAssignments[rectIndexOverall];
70
+
71
+ return (
72
+ <span
73
+ key={rect}
74
+ className={`slide4-orders__rect ${rect} ${group.groupClass}`}
75
+ style={
76
+ image
77
+ ? {
78
+ backgroundImage: `url('${image}')`,
79
+ backgroundSize: 'cover',
80
+ backgroundPosition: 'center',
81
+ }
82
+ : undefined
83
+ }
84
+ />
85
+ );
86
+ })}
87
+ </React.Fragment>
88
+ );
89
+ })}
29
90
  </div>
30
91
 
31
92
  <div className="slide4-orders__content">
@@ -44,7 +105,7 @@ function Slide4Orders({ orders }: Slide4OrdersProps) {
44
105
  animate={{ opacity: 1, scale: 1 }}
45
106
  transition={{ duration: 0.8, delay: 0.3 }}
46
107
  >
47
- {orders.toLocaleString()}
108
+ <motion.span>{ordersCount}</motion.span>
48
109
  </motion.div>
49
110
 
50
111
  <motion.p