@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
|
@@ -1,141 +1,141 @@
|
|
|
1
|
-
import React, { useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
-
import { motion } from 'framer-motion';
|
|
3
|
-
import { delayedFadeIn } from '../utils';
|
|
4
|
-
import { BUSINESS_CATEGORIES, BusinessCategory } from '../types';
|
|
5
|
-
import { recapCopy } from '../data/recapCopy';
|
|
6
|
-
import './Slide1Intro.css';
|
|
7
|
-
|
|
8
|
-
interface Slide1IntroProps {
|
|
9
|
-
businessName: string;
|
|
10
|
-
businessCategory: BusinessCategory;
|
|
11
|
-
onDurationCalculated?: (duration: number) => void;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Slide1Intro - Identity slide with business name and category-based messaging
|
|
16
|
-
*/
|
|
17
|
-
function Slide1Intro({ businessName, businessCategory, onDurationCalculated }: Slide1IntroProps) {
|
|
18
|
-
// Dynamic messaging based on category
|
|
19
|
-
const copy = recapCopy[businessCategory] ?? recapCopy[BUSINESS_CATEGORIES.THRIVING];
|
|
20
|
-
const headline = copy.introHeadline;
|
|
21
|
-
const [brandWidth, setBrandWidth] = useState(0);
|
|
22
|
-
const [headlineWidth, setHeadlineWidth] = useState(0);
|
|
23
|
-
const brandRef = useRef<HTMLDivElement | null>(null);
|
|
24
|
-
const headlineRef = useRef<HTMLHeadingElement | null>(null);
|
|
25
|
-
|
|
26
|
-
useLayoutEffect(() => {
|
|
27
|
-
if (brandRef.current) {
|
|
28
|
-
// Add extra buffer to account for hidden characters (approximately 3 character widths)
|
|
29
|
-
const extraBuffer = brandRef.current.scrollWidth * 0.25; // ~25% extra space
|
|
30
|
-
setBrandWidth(brandRef.current.scrollWidth + extraBuffer);
|
|
31
|
-
}
|
|
32
|
-
}, [businessName]);
|
|
33
|
-
|
|
34
|
-
useLayoutEffect(() => {
|
|
35
|
-
if (headlineRef.current) {
|
|
36
|
-
setHeadlineWidth(headlineRef.current.scrollWidth);
|
|
37
|
-
}
|
|
38
|
-
}, [headline]);
|
|
39
|
-
|
|
40
|
-
// Get actual viewport width for calculation
|
|
41
|
-
const viewportWidth = typeof window !== 'undefined' ? window.innerWidth : 390;
|
|
42
|
-
const containerWidth = Math.min(viewportWidth, 430); // max-width from App.css
|
|
43
|
-
const sidePadding = Math.max(16, containerWidth * 0.041); // clamp(16px, 4.1vw, 20px)
|
|
44
|
-
const availableWidth = containerWidth - (sidePadding * 2);
|
|
45
|
-
|
|
46
|
-
const brandShift = Math.max(brandWidth - availableWidth, 0);
|
|
47
|
-
const headlineShift = Math.max(headlineWidth - availableWidth, 0);
|
|
48
|
-
|
|
49
|
-
// Calculate dynamic slide duration based on brand name length
|
|
50
|
-
// Tested with real data: 26-75 character business names
|
|
51
|
-
const baseAnimationDuration = 6; // seconds minimum for short names
|
|
52
|
-
const pixelsPerSecond = 65; // animation speed (constant across all names)
|
|
53
|
-
|
|
54
|
-
// Calculate animation duration for brand name
|
|
55
|
-
const brandAnimationDuration =
|
|
56
|
-
brandShift > 0
|
|
57
|
-
? Math.max(baseAnimationDuration, brandShift / pixelsPerSecond)
|
|
58
|
-
: baseAnimationDuration;
|
|
59
|
-
|
|
60
|
-
// Calculate animation duration for headline
|
|
61
|
-
const headlineAnimationDuration = headlineShift > 0
|
|
62
|
-
? Math.max(baseAnimationDuration, headlineShift / pixelsPerSecond)
|
|
63
|
-
: baseAnimationDuration;
|
|
64
|
-
|
|
65
|
-
// Use the longer of the two animations, plus buffer time
|
|
66
|
-
const dynamicSlideDuration = Math.max(
|
|
67
|
-
brandAnimationDuration,
|
|
68
|
-
headlineAnimationDuration
|
|
69
|
-
) + 2; // +2 second buffer for user to read the final position
|
|
70
|
-
|
|
71
|
-
// Notify parent of calculated duration
|
|
72
|
-
React.useEffect(() => {
|
|
73
|
-
if (onDurationCalculated && brandWidth > 0 && headlineWidth > 0) {
|
|
74
|
-
onDurationCalculated(dynamicSlideDuration);
|
|
75
|
-
}
|
|
76
|
-
}, [dynamicSlideDuration, brandWidth, headlineWidth, onDurationCalculated]);
|
|
77
|
-
|
|
78
|
-
const slideClass = `slide1-intro slide1-intro--${copy.introVariant}`;
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<div className={slideClass}>
|
|
82
|
-
{/* Brand name container with HEY text and business name */}
|
|
83
|
-
<div className="slide1-intro__brand-container">
|
|
84
|
-
{/* Background "HEY" text */}
|
|
85
|
-
<div className="slide1-intro__bg-text">HEY</div>
|
|
86
|
-
|
|
87
|
-
{/* Business name (animated scroll left) */}
|
|
88
|
-
<motion.div
|
|
89
|
-
className="slide1-intro__brand"
|
|
90
|
-
ref={brandRef}
|
|
91
|
-
animate={{ x: [0, -brandShift] }}
|
|
92
|
-
transition={{ duration: brandAnimationDuration, repeat: 0, ease: 'linear' }}
|
|
93
|
-
>
|
|
94
|
-
{businessName}
|
|
95
|
-
</motion.div>
|
|
96
|
-
</div>
|
|
97
|
-
|
|
98
|
-
{/* Top floating frames (slow horizontal drift) */}
|
|
99
|
-
<motion.div
|
|
100
|
-
className="slide1-intro__frames-top"
|
|
101
|
-
animate={{ x: [-30, 30] }}
|
|
102
|
-
transition={{ duration: 15, repeat: Infinity, repeatType: 'reverse', ease: 'linear' }}
|
|
103
|
-
>
|
|
104
|
-
<div className="frame-rect" />
|
|
105
|
-
<div className="frame-rect" />
|
|
106
|
-
<div className="frame-rect" />
|
|
107
|
-
</motion.div>
|
|
108
|
-
|
|
109
|
-
{/* Headline and subtitle */}
|
|
110
|
-
<motion.div
|
|
111
|
-
className="slide1-intro__text"
|
|
112
|
-
variants={delayedFadeIn(0.5)}
|
|
113
|
-
initial="initial"
|
|
114
|
-
animate="animate"
|
|
115
|
-
>
|
|
116
|
-
<motion.h2
|
|
117
|
-
className="slide1-intro__headline"
|
|
118
|
-
ref={headlineRef}
|
|
119
|
-
animate={{ x: [0, -headlineShift] }}
|
|
120
|
-
transition={{ duration: headlineAnimationDuration, repeat: 1, repeatType: 'reverse', ease: 'linear' }}
|
|
121
|
-
>
|
|
122
|
-
{headline}
|
|
123
|
-
</motion.h2>
|
|
124
|
-
<p className="slide1-intro__subtitle">{copy.introSubtitle}</p>
|
|
125
|
-
</motion.div>
|
|
126
|
-
|
|
127
|
-
{/* Bottom floating frames (slow horizontal drift) */}
|
|
128
|
-
<motion.div
|
|
129
|
-
className="slide1-intro__frames-bottom"
|
|
130
|
-
animate={{ x: [-30, 30] }}
|
|
131
|
-
transition={{ duration: 15, repeat: Infinity, repeatType: 'reverse', ease: 'linear' }}
|
|
132
|
-
>
|
|
133
|
-
<div className="frame-rect" />
|
|
134
|
-
<div className="frame-rect" />
|
|
135
|
-
<div className="frame-rect" />
|
|
136
|
-
</motion.div>
|
|
137
|
-
</div>
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export default Slide1Intro;
|
|
1
|
+
import React, { useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
+
import { motion } from 'framer-motion';
|
|
3
|
+
import { delayedFadeIn } from '../utils';
|
|
4
|
+
import { BUSINESS_CATEGORIES, BusinessCategory } from '../types';
|
|
5
|
+
import { recapCopy } from '../data/recapCopy';
|
|
6
|
+
import './Slide1Intro.css';
|
|
7
|
+
|
|
8
|
+
interface Slide1IntroProps {
|
|
9
|
+
businessName: string;
|
|
10
|
+
businessCategory: BusinessCategory;
|
|
11
|
+
onDurationCalculated?: (duration: number) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Slide1Intro - Identity slide with business name and category-based messaging
|
|
16
|
+
*/
|
|
17
|
+
function Slide1Intro({ businessName, businessCategory, onDurationCalculated }: Slide1IntroProps) {
|
|
18
|
+
// Dynamic messaging based on category
|
|
19
|
+
const copy = recapCopy[businessCategory] ?? recapCopy[BUSINESS_CATEGORIES.THRIVING];
|
|
20
|
+
const headline = copy.introHeadline;
|
|
21
|
+
const [brandWidth, setBrandWidth] = useState(0);
|
|
22
|
+
const [headlineWidth, setHeadlineWidth] = useState(0);
|
|
23
|
+
const brandRef = useRef<HTMLDivElement | null>(null);
|
|
24
|
+
const headlineRef = useRef<HTMLHeadingElement | null>(null);
|
|
25
|
+
|
|
26
|
+
useLayoutEffect(() => {
|
|
27
|
+
if (brandRef.current) {
|
|
28
|
+
// Add extra buffer to account for hidden characters (approximately 3 character widths)
|
|
29
|
+
const extraBuffer = brandRef.current.scrollWidth * 0.25; // ~25% extra space
|
|
30
|
+
setBrandWidth(brandRef.current.scrollWidth + extraBuffer);
|
|
31
|
+
}
|
|
32
|
+
}, [businessName]);
|
|
33
|
+
|
|
34
|
+
useLayoutEffect(() => {
|
|
35
|
+
if (headlineRef.current) {
|
|
36
|
+
setHeadlineWidth(headlineRef.current.scrollWidth);
|
|
37
|
+
}
|
|
38
|
+
}, [headline]);
|
|
39
|
+
|
|
40
|
+
// Get actual viewport width for calculation
|
|
41
|
+
const viewportWidth = typeof window !== 'undefined' ? window.innerWidth : 390;
|
|
42
|
+
const containerWidth = Math.min(viewportWidth, 430); // max-width from App.css
|
|
43
|
+
const sidePadding = Math.max(16, containerWidth * 0.041); // clamp(16px, 4.1vw, 20px)
|
|
44
|
+
const availableWidth = containerWidth - (sidePadding * 2);
|
|
45
|
+
|
|
46
|
+
const brandShift = Math.max(brandWidth - availableWidth, 0);
|
|
47
|
+
const headlineShift = Math.max(headlineWidth - availableWidth, 0);
|
|
48
|
+
|
|
49
|
+
// Calculate dynamic slide duration based on brand name length
|
|
50
|
+
// Tested with real data: 26-75 character business names
|
|
51
|
+
const baseAnimationDuration = 6; // seconds minimum for short names
|
|
52
|
+
const pixelsPerSecond = 65; // animation speed (constant across all names)
|
|
53
|
+
|
|
54
|
+
// Calculate animation duration for brand name
|
|
55
|
+
const brandAnimationDuration =
|
|
56
|
+
brandShift > 0
|
|
57
|
+
? Math.max(baseAnimationDuration, brandShift / pixelsPerSecond)
|
|
58
|
+
: baseAnimationDuration;
|
|
59
|
+
|
|
60
|
+
// Calculate animation duration for headline
|
|
61
|
+
const headlineAnimationDuration = headlineShift > 0
|
|
62
|
+
? Math.max(baseAnimationDuration, headlineShift / pixelsPerSecond)
|
|
63
|
+
: baseAnimationDuration;
|
|
64
|
+
|
|
65
|
+
// Use the longer of the two animations, plus buffer time
|
|
66
|
+
const dynamicSlideDuration = Math.max(
|
|
67
|
+
brandAnimationDuration,
|
|
68
|
+
headlineAnimationDuration
|
|
69
|
+
) + 2; // +2 second buffer for user to read the final position
|
|
70
|
+
|
|
71
|
+
// Notify parent of calculated duration
|
|
72
|
+
React.useEffect(() => {
|
|
73
|
+
if (onDurationCalculated && brandWidth > 0 && headlineWidth > 0) {
|
|
74
|
+
onDurationCalculated(dynamicSlideDuration);
|
|
75
|
+
}
|
|
76
|
+
}, [dynamicSlideDuration, brandWidth, headlineWidth, onDurationCalculated]);
|
|
77
|
+
|
|
78
|
+
const slideClass = `slide1-intro slide1-intro--${copy.introVariant}`;
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<div className={slideClass}>
|
|
82
|
+
{/* Brand name container with HEY text and business name */}
|
|
83
|
+
<div className="slide1-intro__brand-container">
|
|
84
|
+
{/* Background "HEY" text */}
|
|
85
|
+
<div className="slide1-intro__bg-text">HEY</div>
|
|
86
|
+
|
|
87
|
+
{/* Business name (animated scroll left) */}
|
|
88
|
+
<motion.div
|
|
89
|
+
className="slide1-intro__brand"
|
|
90
|
+
ref={brandRef}
|
|
91
|
+
animate={{ x: [0, -brandShift] }}
|
|
92
|
+
transition={{ duration: brandAnimationDuration, repeat: 0, ease: 'linear' }}
|
|
93
|
+
>
|
|
94
|
+
{businessName}
|
|
95
|
+
</motion.div>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
{/* Top floating frames (slow horizontal drift) */}
|
|
99
|
+
<motion.div
|
|
100
|
+
className="slide1-intro__frames-top"
|
|
101
|
+
animate={{ x: [-30, 30] }}
|
|
102
|
+
transition={{ duration: 15, repeat: Infinity, repeatType: 'reverse', ease: 'linear' }}
|
|
103
|
+
>
|
|
104
|
+
<div className="frame-rect" />
|
|
105
|
+
<div className="frame-rect" />
|
|
106
|
+
<div className="frame-rect" />
|
|
107
|
+
</motion.div>
|
|
108
|
+
|
|
109
|
+
{/* Headline and subtitle */}
|
|
110
|
+
<motion.div
|
|
111
|
+
className="slide1-intro__text"
|
|
112
|
+
variants={delayedFadeIn(0.5)}
|
|
113
|
+
initial="initial"
|
|
114
|
+
animate="animate"
|
|
115
|
+
>
|
|
116
|
+
<motion.h2
|
|
117
|
+
className="slide1-intro__headline"
|
|
118
|
+
ref={headlineRef}
|
|
119
|
+
animate={{ x: [0, -headlineShift] }}
|
|
120
|
+
transition={{ duration: headlineAnimationDuration, repeat: 1, repeatType: 'reverse', ease: 'linear' }}
|
|
121
|
+
>
|
|
122
|
+
{headline}
|
|
123
|
+
</motion.h2>
|
|
124
|
+
<p className="slide1-intro__subtitle">{copy.introSubtitle}</p>
|
|
125
|
+
</motion.div>
|
|
126
|
+
|
|
127
|
+
{/* Bottom floating frames (slow horizontal drift) */}
|
|
128
|
+
<motion.div
|
|
129
|
+
className="slide1-intro__frames-bottom"
|
|
130
|
+
animate={{ x: [-30, 30] }}
|
|
131
|
+
transition={{ duration: 15, repeat: Infinity, repeatType: 'reverse', ease: 'linear' }}
|
|
132
|
+
>
|
|
133
|
+
<div className="frame-rect" />
|
|
134
|
+
<div className="frame-rect" />
|
|
135
|
+
<div className="frame-rect" />
|
|
136
|
+
</motion.div>
|
|
137
|
+
</div>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export default Slide1Intro;
|