@katajere/recap 1.0.2 → 1.0.9

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 (68) hide show
  1. package/README.md +27 -1
  2. package/dist/App.css +156 -120
  3. package/dist/FloatingFrames.css +55 -55
  4. package/dist/LoginScreen.css +146 -146
  5. package/dist/OtpScreen.css +133 -133
  6. package/dist/RecapStory.css +105 -105
  7. package/dist/StoryProgress.css +47 -47
  8. package/dist/assets/huxxle-blue-logo.svg +14 -14
  9. package/dist/assets/login-logo.svg +14 -14
  10. package/dist/assets/slide-logo.svg +14 -14
  11. package/dist/components/Header.css +46 -46
  12. package/dist/index.d.ts +2 -2
  13. package/dist/index.js +2 -2
  14. package/dist/slides/Slide10Final.css +101 -101
  15. package/dist/slides/Slide1Intro.css +235 -261
  16. package/dist/slides/Slide2Days.css +209 -209
  17. package/dist/slides/Slide3Revenue.css +89 -89
  18. package/dist/slides/Slide4Orders.css +135 -135
  19. package/dist/slides/Slide5Buyers.css +140 -140
  20. package/dist/slides/Slide6Customer.css +92 -92
  21. package/dist/slides/Slide7Products.css +144 -144
  22. package/dist/slides/Slide8Months.css +148 -148
  23. package/dist/slides/Slide9Year.css +93 -93
  24. package/package.json +17 -32
  25. package/src/App.css +156 -120
  26. package/src/FloatingFrames.css +55 -55
  27. package/src/FloatingFrames.tsx +27 -27
  28. package/src/LoginScreen.css +146 -146
  29. package/src/LoginScreen.tsx +70 -70
  30. package/src/OtpScreen.css +133 -133
  31. package/src/OtpScreen.tsx +109 -109
  32. package/src/RecapApp.tsx +34 -34
  33. package/src/RecapStory.css +105 -105
  34. package/src/RecapStory.tsx +269 -269
  35. package/src/StoryProgress.css +47 -47
  36. package/src/StoryProgress.tsx +60 -60
  37. package/src/assets.d.ts +41 -41
  38. package/src/components/Header.css +46 -46
  39. package/src/components/Header.tsx +41 -41
  40. package/src/data/mock.ts +62 -62
  41. package/src/data/recapCopy.ts +33 -33
  42. package/src/hooks/useBackgroundMusic.ts +79 -79
  43. package/src/index.ts +70 -70
  44. package/src/react-app-env.d.ts +26 -26
  45. package/src/slides/Slide10Final.css +101 -101
  46. package/src/slides/Slide10Final.tsx +105 -105
  47. package/src/slides/Slide1Intro.css +235 -261
  48. package/src/slides/Slide1Intro.tsx +141 -141
  49. package/src/slides/Slide2Days.css +209 -209
  50. package/src/slides/Slide2Days.tsx +92 -92
  51. package/src/slides/Slide3Revenue.css +89 -89
  52. package/src/slides/Slide3Revenue.tsx +76 -76
  53. package/src/slides/Slide4Orders.css +135 -135
  54. package/src/slides/Slide4Orders.tsx +63 -63
  55. package/src/slides/Slide5Buyers.css +140 -140
  56. package/src/slides/Slide5Buyers.tsx +74 -74
  57. package/src/slides/Slide6Customer.css +92 -92
  58. package/src/slides/Slide6Customer.tsx +27 -27
  59. package/src/slides/Slide7Products.css +144 -144
  60. package/src/slides/Slide7Products.tsx +81 -81
  61. package/src/slides/Slide8Months.css +148 -148
  62. package/src/slides/Slide8Months.tsx +63 -63
  63. package/src/slides/Slide9Year.css +93 -93
  64. package/src/slides/Slide9Year.tsx +35 -35
  65. package/src/types.ts +39 -39
  66. package/src/utils/format.ts +18 -18
  67. package/src/utils/index.ts +3 -3
  68. 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;