@xetwa/design-system 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.
Files changed (168) hide show
  1. package/.github/workflows/publish.yml +30 -0
  2. package/.storybook/main.ts +17 -0
  3. package/.storybook/preview.tsx +65 -0
  4. package/eslint.config.js +22 -0
  5. package/index.html +13 -0
  6. package/package.json +55 -0
  7. package/public/favicon.svg +1 -0
  8. package/public/icons.svg +24 -0
  9. package/src/App.css +184 -0
  10. package/src/App.tsx +122 -0
  11. package/src/BordasSombras.mdx +343 -0
  12. package/src/Colors.mdx +393 -0
  13. package/src/GrelhaLayout.mdx +375 -0
  14. package/src/Icons.mdx +42 -0
  15. package/src/MovimentoBreakpoints.mdx +379 -0
  16. package/src/Spacing.mdx +231 -0
  17. package/src/Typography.mdx +321 -0
  18. package/src/assets/Mascots/vava/estaticos/vava-acenar.svg +3 -0
  19. package/src/assets/Mascots/vava/estaticos/vava-acertou.svg +3 -0
  20. package/src/assets/Mascots/vava/estaticos/vava-celebrar.svg +3 -0
  21. package/src/assets/Mascots/vava/estaticos/vava-com-autocolantes.svg +3 -0
  22. package/src/assets/Mascots/vava/estaticos/vava-dormir.svg +3 -0
  23. package/src/assets/Mascots/vava/estaticos/vava-errou.svg +3 -0
  24. package/src/assets/Mascots/vava/estaticos/vava-feliz.svg +3 -0
  25. package/src/assets/Mascots/vava/estaticos/vava-neutra.svg +3 -0
  26. package/src/assets/Mascots/vava/estaticos/vava-original.svg +3 -0
  27. package/src/assets/Mascots/vava/estaticos/vava-pensar.svg +3 -0
  28. package/src/assets/Mascots/vava/estaticos/vava-surpresa.svg +3 -0
  29. package/src/assets/Mascots/yaya/avatar/yaya-avatar-falar.svg +7 -0
  30. package/src/assets/Mascots/yaya/avatar/yaya-avatar-feliz.svg +7 -0
  31. package/src/assets/Mascots/yaya/avatar/yaya-avatar-transparente.svg +6 -0
  32. package/src/assets/Mascots/yaya/estaticos/yaya-acertou.svg +13 -0
  33. package/src/assets/Mascots/yaya/estaticos/yaya-celebrar.svg +13 -0
  34. package/src/assets/Mascots/yaya/estaticos/yaya-dormir.svg +13 -0
  35. package/src/assets/Mascots/yaya/estaticos/yaya-errou.svg +13 -0
  36. package/src/assets/Mascots/yaya/estaticos/yaya-falar.svg +13 -0
  37. package/src/assets/Mascots/yaya/estaticos/yaya-feliz.svg +13 -0
  38. package/src/assets/Mascots/yaya/estaticos/yaya-neutra.svg +13 -0
  39. package/src/assets/Mascots/yaya/estaticos/yaya-pensar.svg +13 -0
  40. package/src/assets/Mascots/yaya/estaticos/yaya-surpresa.svg +13 -0
  41. package/src/assets/hero.png +0 -0
  42. package/src/assets/react.svg +1 -0
  43. package/src/assets/vite.svg +1 -0
  44. package/src/components/Buttons/BackButton/BackButton.stories.tsx +86 -0
  45. package/src/components/Buttons/BackButton/BackButton.tsx +107 -0
  46. package/src/components/Buttons/FabButton/FabButton.stories.tsx +74 -0
  47. package/src/components/Buttons/FabButton/FabButton.tsx +161 -0
  48. package/src/components/Buttons/IconButton/IconButton.stories.tsx +99 -0
  49. package/src/components/Buttons/IconButton/IconButton.tsx +189 -0
  50. package/src/components/Buttons/JourneyButton/JourneyButton.stories.tsx +80 -0
  51. package/src/components/Buttons/JourneyButton/JourneyButton.tsx +194 -0
  52. package/src/components/Buttons/MainButton/MainButton.stories.tsx +144 -0
  53. package/src/components/Buttons/MainButton/MainButton.tsx +258 -0
  54. package/src/components/Buttons/WordChip/WordChip.stories.tsx +84 -0
  55. package/src/components/Buttons/WordChip/WordChip.tsx +157 -0
  56. package/src/components/Buttons/WordChip/index.ts +1 -0
  57. package/src/components/Cards/AnswerOptionCard/AnswerOptionCard.stories.tsx +181 -0
  58. package/src/components/Cards/AnswerOptionCard/AnswerOptionCard.tsx +201 -0
  59. package/src/components/Cards/BaseCard/BaseCard.stories.tsx +148 -0
  60. package/src/components/Cards/BaseCard/BaseCard.tsx +181 -0
  61. package/src/components/Cards/BoardingPassCard/BoardingPassCard.stories.tsx +205 -0
  62. package/src/components/Cards/BoardingPassCard/BoardingPassCard.tsx +384 -0
  63. package/src/components/Cards/BoardingPassCard/FlightIcon.tsx +21 -0
  64. package/src/components/Cards/BoardingPassCard/FlightIcon.web.tsx +18 -0
  65. package/src/components/Cards/CountryCard/CountryCard.stories.tsx +97 -0
  66. package/src/components/Cards/CountryCard/CountryCard.tsx +185 -0
  67. package/src/components/Cards/LevelProgressCard/LevelProgressCard.stories.tsx +61 -0
  68. package/src/components/Cards/LevelProgressCard/LevelProgressCard.tsx +143 -0
  69. package/src/components/Cards/ModuleCard/ModuleCard.stories.tsx +108 -0
  70. package/src/components/Cards/ModuleCard/ModuleCard.tsx +304 -0
  71. package/src/components/Cards/ModuleCompletionCard/ModuleCompletionCard.stories.tsx +53 -0
  72. package/src/components/Cards/ModuleCompletionCard/ModuleCompletionCard.tsx +167 -0
  73. package/src/components/Cards/Passport/PassportCover.tsx +114 -0
  74. package/src/components/Cards/Passport/PassportIDPage.tsx +217 -0
  75. package/src/components/Cards/Passport/PassportStampPage.tsx +253 -0
  76. package/src/components/Cards/Passport/PassportViewer.stories.tsx +95 -0
  77. package/src/components/Cards/Passport/PassportViewer.tsx +328 -0
  78. package/src/components/Cards/PlanCard/PlanCard.stories.tsx +159 -0
  79. package/src/components/Cards/PlanCard/PlanCard.tsx +317 -0
  80. package/src/components/Cards/PricingCard/PricingCard.stories.tsx +83 -0
  81. package/src/components/Cards/PricingCard/PricingCard.tsx +144 -0
  82. package/src/components/Cards/SelectionCard/SelectionCard.stories.tsx +77 -0
  83. package/src/components/Cards/SelectionCard/SelectionCard.tsx +111 -0
  84. package/src/components/Cards/TeacherCard/TeacherCard.stories.tsx +126 -0
  85. package/src/components/Cards/TeacherCard/TeacherCard.tsx +236 -0
  86. package/src/components/Charts/WeeklyProgressChart/WeeklyProgressChart.stories.tsx +89 -0
  87. package/src/components/Charts/WeeklyProgressChart/WeeklyProgressChart.tsx +179 -0
  88. package/src/components/Charts/WeeklyProgressChart/index.ts +1 -0
  89. package/src/components/DataDisplay/Avatar/Avatar.stories.tsx +85 -0
  90. package/src/components/DataDisplay/Avatar/Avatar.tsx +118 -0
  91. package/src/components/DataDisplay/Avatar/index.ts +1 -0
  92. package/src/components/DataDisplay/Badge/Badge.stories.tsx +62 -0
  93. package/src/components/DataDisplay/Badge/Badge.tsx +146 -0
  94. package/src/components/DataDisplay/Flag/Flag.stories.tsx +98 -0
  95. package/src/components/DataDisplay/Flag/Flag.tsx +347 -0
  96. package/src/components/DataDisplay/Flag/Flag.web.tsx +334 -0
  97. package/src/components/DataDisplay/InstructionBubble/InstructionBubble.stories.tsx +80 -0
  98. package/src/components/DataDisplay/InstructionBubble/InstructionBubble.tsx +86 -0
  99. package/src/components/DataDisplay/LevelBadge/LevelBadge.stories.tsx +99 -0
  100. package/src/components/DataDisplay/LevelBadge/LevelBadge.tsx +118 -0
  101. package/src/components/DataDisplay/ProgressBar/ProgressBar.stories.tsx +95 -0
  102. package/src/components/DataDisplay/ProgressBar/ProgressBar.tsx +117 -0
  103. package/src/components/DataDisplay/StatBadge/StatBadge.stories.tsx +82 -0
  104. package/src/components/DataDisplay/StatBadge/StatBadge.tsx +135 -0
  105. package/src/components/DataDisplay/StatBadge/index.ts +1 -0
  106. package/src/components/DataDisplay/Tag/Tag.stories.tsx +63 -0
  107. package/src/components/DataDisplay/Tag/Tag.tsx +148 -0
  108. package/src/components/Feedback/FeedbackBottomSheet/FeedbackBottomSheet.stories.tsx +74 -0
  109. package/src/components/Feedback/FeedbackBottomSheet/FeedbackBottomSheet.tsx +200 -0
  110. package/src/components/Forms/Checkbox/Checkbox.stories.tsx +60 -0
  111. package/src/components/Forms/Checkbox/Checkbox.tsx +127 -0
  112. package/src/components/Forms/Checkbox/index.ts +1 -0
  113. package/src/components/Forms/DaySelector/DaySelector.stories.tsx +62 -0
  114. package/src/components/Forms/DaySelector/DaySelector.tsx +133 -0
  115. package/src/components/Forms/Radio/Radio.stories.tsx +61 -0
  116. package/src/components/Forms/Radio/Radio.tsx +141 -0
  117. package/src/components/Forms/Radio/index.ts +1 -0
  118. package/src/components/Forms/SegmentedToggle/SegmentedToggle.stories.tsx +67 -0
  119. package/src/components/Forms/SegmentedToggle/SegmentedToggle.tsx +150 -0
  120. package/src/components/Forms/SegmentedToggle/index.ts +1 -0
  121. package/src/components/Forms/Select/Select.stories.tsx +59 -0
  122. package/src/components/Forms/Select/Select.tsx +255 -0
  123. package/src/components/Forms/Select/index.ts +1 -0
  124. package/src/components/Forms/Switch/Switch.stories.tsx +57 -0
  125. package/src/components/Forms/Switch/Switch.tsx +120 -0
  126. package/src/components/Forms/Switch/index.ts +1 -0
  127. package/src/components/Forms/TimeSlot/TimeSlot.stories.tsx +62 -0
  128. package/src/components/Forms/TimeSlot/TimeSlot.tsx +116 -0
  129. package/src/components/Headers/CountryHeader/CountryHeader.stories.tsx +114 -0
  130. package/src/components/Headers/CountryHeader/CountryHeader.tsx +147 -0
  131. package/src/components/Headers/ProfileHeader/ProfileHeader.stories.tsx +141 -0
  132. package/src/components/Headers/ProfileHeader/ProfileHeader.tsx +233 -0
  133. package/src/components/Inputs/FillInTheBlank/FillInTheBlank.stories.tsx +333 -0
  134. package/src/components/Inputs/FillInTheBlank/FillInTheBlank.tsx +287 -0
  135. package/src/components/Inputs/FillInTheBlank/index.ts +1 -0
  136. package/src/components/Inputs/TextInput/TextInput.stories.tsx +103 -0
  137. package/src/components/Inputs/TextInput/TextInput.tsx +187 -0
  138. package/src/components/Mascots/Vava/Vava.stories.tsx +114 -0
  139. package/src/components/Mascots/Vava/Vava.tsx +276 -0
  140. package/src/components/Mascots/Yaya/Yaya.stories.tsx +98 -0
  141. package/src/components/Mascots/Yaya/Yaya.tsx +233 -0
  142. package/src/components/Navigation/BottomTabBar/BottomTabBar.stories.tsx +68 -0
  143. package/src/components/Navigation/BottomTabBar/BottomTabBar.tsx +85 -0
  144. package/src/components/Navigation/BottomTabBar/BottomTabBarItem.tsx +68 -0
  145. package/src/components/Navigation/BottomTabBar/index.ts +2 -0
  146. package/src/components/Navigation/PaginationDots/PaginationDots.stories.tsx +62 -0
  147. package/src/components/Navigation/PaginationDots/PaginationDots.tsx +81 -0
  148. package/src/components/Navigation/PaginationDots/index.ts +1 -0
  149. package/src/components/Navigation/ProgressMap/ProgressMap.stories.tsx +116 -0
  150. package/src/components/Navigation/ProgressMap/ProgressMap.tsx +827 -0
  151. package/src/components/Navigation/WorldProgressMap/WorldProgressMap.stories.tsx +169 -0
  152. package/src/components/Navigation/WorldProgressMap/WorldProgressMap.tsx +790 -0
  153. package/src/components/Typography/Typography.stories.tsx +127 -0
  154. package/src/components/Typography/Typography.tsx +53 -0
  155. package/src/hooks/useResponsive.ts +41 -0
  156. package/src/hooks/useTheme.ts +32 -0
  157. package/src/index.css +355 -0
  158. package/src/index.ts +28 -0
  159. package/src/main.tsx +10 -0
  160. package/src/mocks/codegenNativeComponent.ts +5 -0
  161. package/src/styles/countryThemes.ts +79 -0
  162. package/src/styles/theme.ts +297 -0
  163. package/src/utils/iconMap.ts +23 -0
  164. package/tsconfig.app.json +25 -0
  165. package/tsconfig.json +7 -0
  166. package/tsconfig.node.json +24 -0
  167. package/vite.config.ts +51 -0
  168. package/vitest.shims.d.ts +1 -0
@@ -0,0 +1,790 @@
1
+ import { useEffect, useRef, useState } from 'react';
2
+ import { View, StyleSheet, ScrollView, TouchableOpacity, Animated, Easing, Platform } from 'react-native';
3
+ import type { ViewStyle } from 'react-native';
4
+ import Svg, { Circle, Line, Path } from 'react-native-svg';
5
+ import { theme } from '../../../styles/theme';
6
+ import { useResponsive } from '../../../hooks/useResponsive';
7
+ import { Flag } from '../../DataDisplay/Flag/Flag';
8
+ import { BackButton } from '../../Buttons/BackButton/BackButton';
9
+ import { JourneyButton } from '../../Buttons/JourneyButton/JourneyButton';
10
+ import { FlightIcon } from '../../Cards/BoardingPassCard/FlightIcon';
11
+ import { Typography } from '../../Typography/Typography';
12
+
13
+ export interface WorldMapStation {
14
+ id: number;
15
+ label: string;
16
+ levelCode: 'A1' | 'A2' | 'B1' | 'B2' | 'C1';
17
+ countryCode: string; // E.g., 'FR', 'BE', 'CH', 'CA', 'SN', 'CI', etc.
18
+ status: 'visited' | 'current' | 'locked';
19
+ x: number; // 0 to 1200 coordinates
20
+ y: number; // 0 to 800 coordinates
21
+ }
22
+
23
+ export interface WorldProgressMapProps {
24
+ title?: string;
25
+ subtitle?: string;
26
+ stations: WorldMapStation[];
27
+ activeStationId: number;
28
+ onStationPress?: (station: WorldMapStation) => void;
29
+ onContinuePress?: (currentStation: WorldMapStation) => void;
30
+ onBackPress?: () => void;
31
+ onFlightPress?: () => void;
32
+ height?: number | string; // Custom height constraint
33
+ style?: ViewStyle | ViewStyle[];
34
+ }
35
+
36
+ export const WorldProgressMap = ({
37
+ title = 'A ROTA DA FRANCOFONIA',
38
+ subtitle,
39
+ stations = [],
40
+ activeStationId,
41
+ onStationPress,
42
+ onContinuePress,
43
+ onBackPress,
44
+ onFlightPress,
45
+ height,
46
+ style,
47
+ }: WorldProgressMapProps) => {
48
+ const { scale, scaleText, width } = useResponsive();
49
+ const [scrollReady, setScrollReady] = useState(false);
50
+ const scrollViewRefH = useRef<ScrollView>(null);
51
+ const scrollViewRefV = useRef<ScrollView>(null);
52
+
53
+ // Responsive configurations
54
+ // We define a fixed large canvas for the geographical map so it can be scrolled
55
+ const mapWidth = scale(1200);
56
+ const mapHeight = scale(800);
57
+ let nodeSize = 56;
58
+ let headerTitleSize = 14;
59
+ let headerSubtitleSize = 20;
60
+
61
+ // Animations
62
+ const pathAnim = useRef(new Animated.Value(0)).current;
63
+ const pulseAnim = useRef(new Animated.Value(0)).current;
64
+ const bobAnim = useRef(new Animated.Value(0)).current;
65
+
66
+ useEffect(() => {
67
+ // 1. Path drawing animation
68
+ pathAnim.setValue(0);
69
+ Animated.timing(pathAnim, {
70
+ toValue: 1,
71
+ duration: 1200,
72
+ easing: Easing.out(Easing.quad),
73
+ useNativeDriver: false,
74
+ }).start();
75
+
76
+ // 2. Pulse looping animation
77
+ Animated.loop(
78
+ Animated.sequence([
79
+ Animated.timing(pulseAnim, {
80
+ toValue: 1,
81
+ duration: 1800,
82
+ easing: Easing.out(Easing.ease),
83
+ useNativeDriver: false,
84
+ }),
85
+ Animated.timing(pulseAnim, {
86
+ toValue: 0,
87
+ duration: 0,
88
+ useNativeDriver: false,
89
+ }),
90
+ ])
91
+ ).start();
92
+
93
+ // 3. Airplane bobbing animation
94
+ Animated.loop(
95
+ Animated.sequence([
96
+ Animated.timing(bobAnim, {
97
+ toValue: 1,
98
+ duration: 1200,
99
+ easing: Easing.inOut(Easing.ease),
100
+ useNativeDriver: true,
101
+ }),
102
+ Animated.timing(bobAnim, {
103
+ toValue: 0,
104
+ duration: 1200,
105
+ easing: Easing.inOut(Easing.ease),
106
+ useNativeDriver: true,
107
+ }),
108
+ ])
109
+ ).start();
110
+ }, [stations, pathAnim, pulseAnim, bobAnim]);
111
+
112
+ // Layout positions resolver - scales the 1200x800 coordinate system using useResponsive
113
+ const points = stations.map((station) => ({
114
+ ...station,
115
+ x: scale(station.x),
116
+ y: scale(station.y),
117
+ }));
118
+
119
+ const activeStation = stations.find((s) => s.id === activeStationId) || stations[0];
120
+ const activeIndex = points.findIndex((p) => p.id === activeStationId);
121
+ const activePoint = points[activeIndex] || points[0];
122
+
123
+ // Auto-scroll to active station on load
124
+ useEffect(() => {
125
+ if (activePoint && scrollViewRefH.current && scrollViewRefV.current && scrollReady) {
126
+ setTimeout(() => {
127
+ // Center horizontally
128
+ scrollViewRefH.current?.scrollTo({
129
+ x: Math.max(0, activePoint.x - width / 2),
130
+ animated: true,
131
+ });
132
+ // Center vertically (roughly, we assume typical height is ~800, scale 400 is half)
133
+ scrollViewRefV.current?.scrollTo({
134
+ y: Math.max(0, activePoint.y - scale(400)),
135
+ animated: true,
136
+ });
137
+ }, 300);
138
+ }
139
+ }, [activePoint, scrollReady, width, scale]);
140
+
141
+ // Dynamic curve string builder for connections
142
+ const buildCurveD = () => {
143
+ if (points.length < 2) return '';
144
+ let d = `M ${points[0].x} ${points[0].y}`;
145
+ for (let i = 0; i < points.length - 1; i++) {
146
+ const p0 = points[i];
147
+ const p1 = points[i + 1];
148
+ const cp1x = p0.x + (p1.x - p0.x) * 0.5;
149
+ const cp1y = p0.y - scale(40); // slight upward curve
150
+ const cp2x = p0.x + (p1.x - p0.x) * 0.5;
151
+ const cp2y = p1.y - scale(40);
152
+ d += ` C ${cp1x} ${cp1y}, ${cp2x} ${cp2y}, ${p1.x} ${p1.y}`;
153
+ }
154
+ return d;
155
+ };
156
+
157
+ const pathD = buildCurveD();
158
+
159
+ // Animation values interpolation
160
+ const pulseScale = pulseAnim.interpolate({
161
+ inputRange: [0, 1],
162
+ outputRange: [1, 1.7],
163
+ });
164
+
165
+ const pulseOpacity = pulseAnim.interpolate({
166
+ inputRange: [0, 1],
167
+ outputRange: [0.6, 0],
168
+ });
169
+
170
+ const bobTranslateY = bobAnim.interpolate({
171
+ inputRange: [0, 1],
172
+ outputRange: [0, -6],
173
+ });
174
+
175
+ // Calculate plane placement & rotation angle
176
+ let planeX = mapWidth / 2;
177
+ let planeY = mapHeight / 2;
178
+ let planeAngle = -45;
179
+ let showPlane = false;
180
+
181
+ if (activeIndex < points.length - 1 && points[activeIndex + 1]) {
182
+ const curr = activePoint;
183
+ const next = points[activeIndex + 1];
184
+ planeX = (curr.x + next.x) / 2;
185
+ planeY = (curr.y + next.y) / 2 - scale(30); // account for the curve
186
+ const dx = next.x - curr.x;
187
+ const dy = next.y - curr.y;
188
+ planeAngle = Math.atan2(dy, dx) * (180 / Math.PI) + 90;
189
+ showPlane = true;
190
+ } else if (activeIndex > 0 && points[activeIndex - 1]) {
191
+ const prev = points[activeIndex - 1];
192
+ const curr = activePoint;
193
+ planeX = (prev.x + curr.x) / 2;
194
+ planeY = (prev.y + curr.y) / 2 - scale(30);
195
+ const dx = curr.x - prev.x;
196
+ const dy = curr.y - prev.y;
197
+ planeAngle = Math.atan2(dy, dx) * (180 / Math.PI) + 90;
198
+ showPlane = true;
199
+ }
200
+
201
+ // Draw grid lines
202
+ const renderGrid = () => {
203
+ const lines = [];
204
+ const step = scale(48);
205
+ for (let i = 0; i < mapHeight; i += step) {
206
+ lines.push(
207
+ <Line
208
+ key={`h-grid-${i}`}
209
+ x1={0}
210
+ y1={i}
211
+ x2={mapWidth}
212
+ y2={i}
213
+ stroke={theme.colors.brown[100]}
214
+ strokeWidth={1}
215
+ strokeDasharray="4, 4"
216
+ opacity={0.45}
217
+ />
218
+ );
219
+ }
220
+ for (let i = 0; i < mapWidth; i += step) {
221
+ lines.push(
222
+ <Line
223
+ key={`v-grid-${i}`}
224
+ x1={i}
225
+ y1={0}
226
+ x2={i}
227
+ y2={mapHeight}
228
+ stroke={theme.colors.brown[100]}
229
+ strokeWidth={1}
230
+ strokeDasharray="4, 4"
231
+ opacity={0.45}
232
+ />
233
+ );
234
+ }
235
+ return lines;
236
+ };
237
+
238
+ // Predefined Stylized Continents (Based on a 1200x800 coordinate system)
239
+ // Scaled with `scale()` via template literals below
240
+ const s = (val: number) => scale(val);
241
+
242
+ return (
243
+ <View
244
+ style={[
245
+ styles.outerContainer,
246
+ {
247
+ width: '100%',
248
+ },
249
+ height !== undefined ? { height: height as any } : { flex: 1 },
250
+ style,
251
+ ]}
252
+ >
253
+ {/* Header Container */}
254
+ <View style={styles.header}>
255
+ <View style={styles.headerLeft}>
256
+ <BackButton onPress={onBackPress} variant="default" />
257
+ <View style={styles.headerText}>
258
+ <Typography style={[styles.headerTitle, { fontSize: scaleText(headerTitleSize) }]}>
259
+ {title.toUpperCase()}
260
+ </Typography>
261
+ <Typography style={[styles.headerSubtitle, { fontSize: scaleText(headerSubtitleSize) }]}>
262
+ {subtitle ?? `${stations.length} destinos`}
263
+ </Typography>
264
+ </View>
265
+ </View>
266
+ <TouchableOpacity
267
+ activeOpacity={0.85}
268
+ onPress={onFlightPress}
269
+ style={[styles.flightBtn, { borderRadius: scale(14), paddingHorizontal: scale(16), height: scale(40) }]}
270
+ >
271
+ <FlightIcon color="#ffffff" size={scale(16)} />
272
+ <Typography style={[styles.flightBtnText, { fontSize: scaleText(12) }]}>VOO</Typography>
273
+ </TouchableOpacity>
274
+ </View>
275
+
276
+ {/* Main Canvas Scroll Area */}
277
+ <View style={styles.canvasWrapper}>
278
+ <ScrollView
279
+ ref={scrollViewRefV}
280
+ style={styles.scrollView}
281
+ showsVerticalScrollIndicator={false}
282
+ onLayout={() => setScrollReady(true)}
283
+ >
284
+ <ScrollView
285
+ ref={scrollViewRefH}
286
+ horizontal
287
+ showsHorizontalScrollIndicator={false}
288
+ >
289
+ <View style={{ width: mapWidth, height: mapHeight }}>
290
+ {/* SVG Map Canvas Layer */}
291
+ <Svg style={StyleSheet.absoluteFill} width={mapWidth} height={mapHeight}>
292
+ {/* Grid Overlay */}
293
+ {renderGrid()}
294
+
295
+ {/* --- CONTINENT BACKGROUNDS --- */}
296
+
297
+ {/* Americas Shadow */}
298
+ <Path
299
+ d={`M ${s(150)} ${s(100)}
300
+ C ${s(350)} ${s(100)}, ${s(350)} ${s(300)}, ${s(200)} ${s(400)}
301
+ C ${s(280)} ${s(500)}, ${s(350)} ${s(700)}, ${s(150)} ${s(750)}
302
+ C ${s(50)} ${s(700)}, ${s(80)} ${s(500)}, ${s(50)} ${s(400)}
303
+ C ${s(0)} ${s(300)}, ${s(50)} ${s(100)}, ${s(150)} ${s(100)} Z`}
304
+ fill="#7ba281" // Darker green for shadow
305
+ />
306
+ {/* Americas Surface */}
307
+ <Path
308
+ d={`M ${s(150)} ${s(100)}
309
+ C ${s(350)} ${s(100)}, ${s(350)} ${s(300)}, ${s(200)} ${s(400)}
310
+ C ${s(280)} ${s(500)}, ${s(350)} ${s(700)}, ${s(150)} ${s(750)}
311
+ C ${s(50)} ${s(700)}, ${s(80)} ${s(500)}, ${s(50)} ${s(400)}
312
+ C ${s(0)} ${s(300)}, ${s(50)} ${s(100)}, ${s(150)} ${s(100)} Z`}
313
+ fill="#a3c9a6" // Vibrant soft green
314
+ scale={0.97}
315
+ x={s(6)}
316
+ y={s(12)}
317
+ />
318
+
319
+ {/* Europe & Africa Shadow */}
320
+ <Path
321
+ d={`M ${s(550)} ${s(120)}
322
+ C ${s(700)} ${s(100)}, ${s(800)} ${s(300)}, ${s(650)} ${s(400)}
323
+ C ${s(700)} ${s(550)}, ${s(750)} ${s(700)}, ${s(550)} ${s(750)}
324
+ C ${s(450)} ${s(700)}, ${s(500)} ${s(550)}, ${s(480)} ${s(400)}
325
+ C ${s(420)} ${s(300)}, ${s(450)} ${s(150)}, ${s(550)} ${s(120)} Z`}
326
+ fill="#7ba281"
327
+ />
328
+ {/* Europe & Africa Surface */}
329
+ <Path
330
+ d={`M ${s(550)} ${s(120)}
331
+ C ${s(700)} ${s(100)}, ${s(800)} ${s(300)}, ${s(650)} ${s(400)}
332
+ C ${s(700)} ${s(550)}, ${s(750)} ${s(700)}, ${s(550)} ${s(750)}
333
+ C ${s(450)} ${s(700)}, ${s(500)} ${s(550)}, ${s(480)} ${s(400)}
334
+ C ${s(420)} ${s(300)}, ${s(450)} ${s(150)}, ${s(550)} ${s(120)} Z`}
335
+ fill="#a3c9a6"
336
+ scale={0.97}
337
+ x={s(8)}
338
+ y={s(12)}
339
+ />
340
+
341
+ {/* Asia & Oceania Shadow */}
342
+ <Path
343
+ d={`M ${s(950)} ${s(150)}
344
+ C ${s(1150)} ${s(100)}, ${s(1150)} ${s(400)}, ${s(1050)} ${s(500)}
345
+ C ${s(1100)} ${s(600)}, ${s(1150)} ${s(750)}, ${s(950)} ${s(700)}
346
+ C ${s(850)} ${s(600)}, ${s(900)} ${s(500)}, ${s(850)} ${s(400)}
347
+ C ${s(750)} ${s(300)}, ${s(800)} ${s(150)}, ${s(950)} ${s(150)} Z`}
348
+ fill="#7ba281"
349
+ />
350
+ {/* Asia & Oceania Surface */}
351
+ <Path
352
+ d={`M ${s(950)} ${s(150)}
353
+ C ${s(1150)} ${s(100)}, ${s(1150)} ${s(400)}, ${s(1050)} ${s(500)}
354
+ C ${s(1100)} ${s(600)}, ${s(1150)} ${s(750)}, ${s(950)} ${s(700)}
355
+ C ${s(850)} ${s(600)}, ${s(900)} ${s(500)}, ${s(850)} ${s(400)}
356
+ C ${s(750)} ${s(300)}, ${s(800)} ${s(150)}, ${s(950)} ${s(150)} Z`}
357
+ fill="#a3c9a6"
358
+ scale={0.97}
359
+ x={s(8)}
360
+ y={s(12)}
361
+ />
362
+
363
+ {/* Decorative Islands */}
364
+ <Circle cx={s(320)} cy={s(650)} r={s(20)} fill="#a3c9a6" stroke="#7ba281" strokeWidth={s(4)} />
365
+ <Circle cx={s(850)} cy={s(680)} r={s(30)} fill="#a3c9a6" stroke="#7ba281" strokeWidth={s(4)} />
366
+ <Circle cx={s(400)} cy={s(350)} r={s(15)} fill="#a3c9a6" stroke="#7ba281" strokeWidth={s(3)} />
367
+ <Circle cx={s(780)} cy={s(200)} r={s(25)} fill="#a3c9a6" stroke="#7ba281" strokeWidth={s(3)} />
368
+
369
+ {/* Dotted path connector */}
370
+ {pathD !== '' && (
371
+ <Path
372
+ d={pathD}
373
+ fill="none"
374
+ stroke={theme.colors.primary}
375
+ strokeWidth={scale(4)}
376
+ strokeDasharray="6, 6"
377
+ strokeLinecap="round"
378
+ />
379
+ )}
380
+ </Svg>
381
+
382
+ {/* Canvas Interactive Overlays */}
383
+ {/* Active Node Pulse Ring */}
384
+ <Animated.View
385
+ style={[
386
+ styles.pulseRing,
387
+ {
388
+ left: activePoint.x - scale((nodeSize * 1.4) / 2),
389
+ top: activePoint.y - scale((nodeSize * 1.4) / 2),
390
+ width: scale(nodeSize * 1.4),
391
+ height: scale(nodeSize * 1.4),
392
+ borderRadius: scale((nodeSize * 1.4) / 2),
393
+ borderColor: theme.colors.primary,
394
+ borderWidth: scale(3.5),
395
+ transform: [{ scale: pulseScale }],
396
+ opacity: pulseOpacity,
397
+ },
398
+ ]}
399
+ />
400
+
401
+ {/* Moving Airplane Bobbing Overlay */}
402
+ {showPlane && (
403
+ <Animated.View
404
+ style={[
405
+ styles.planeWrapper,
406
+ {
407
+ left: planeX - scale(14),
408
+ top: planeY - scale(14),
409
+ transform: [{ rotate: `${planeAngle}deg` }, { translateY: bobTranslateY }],
410
+ },
411
+ ]}
412
+ >
413
+ <FlightIcon color={theme.colors.brown[800]} size={scale(28)} />
414
+ </Animated.View>
415
+ )}
416
+
417
+ {/* Station Node Anchors */}
418
+ {points.map((p, idx) => {
419
+ const isVisited = p.status === 'visited';
420
+ const isCurrent = p.status === 'current';
421
+ const isLocked = p.status === 'locked';
422
+
423
+ let nodeBorderColor = theme.colors.brown[100];
424
+ let badgeBgColor = theme.colors.brown[400];
425
+ let shadowStyle = styles.nodeLockedShadow;
426
+
427
+ if (isVisited) {
428
+ nodeBorderColor = theme.colors.success;
429
+ badgeBgColor = theme.colors.success;
430
+ shadowStyle = styles.nodeVisitedShadow;
431
+ } else if (isCurrent) {
432
+ nodeBorderColor = theme.colors.primary;
433
+ badgeBgColor = theme.colors.primary;
434
+ shadowStyle = styles.nodeCurrentShadow;
435
+ }
436
+
437
+ return (
438
+ <View
439
+ key={`node-${p.id}`}
440
+ style={[
441
+ styles.nodeContainer,
442
+ {
443
+ left: p.x - scale(nodeSize / 2),
444
+ top: p.y - scale(nodeSize / 2),
445
+ width: scale(nodeSize),
446
+ height: scale(nodeSize),
447
+ },
448
+ ]}
449
+ >
450
+ <TouchableOpacity
451
+ activeOpacity={0.8}
452
+ onPress={() => onStationPress?.(p)}
453
+ disabled={isLocked}
454
+ style={[
455
+ styles.nodeCircle,
456
+ shadowStyle,
457
+ {
458
+ width: scale(nodeSize),
459
+ height: scale(nodeSize),
460
+ borderRadius: scale(nodeSize / 2),
461
+ borderWidth: scale(3),
462
+ borderColor: nodeBorderColor,
463
+ opacity: isLocked ? 0.65 : 1,
464
+ },
465
+ ]}
466
+ >
467
+ <Flag countryCode={p.countryCode} size={scale(nodeSize - 6)} />
468
+ </TouchableOpacity>
469
+
470
+ {/* Step Index Number Badge */}
471
+ <View
472
+ style={[
473
+ styles.indexBadge,
474
+ {
475
+ backgroundColor: badgeBgColor,
476
+ width: scale(18),
477
+ height: scale(18),
478
+ borderRadius: scale(9),
479
+ top: -scale(3),
480
+ right: -scale(3),
481
+ },
482
+ ]}
483
+ >
484
+ <Typography style={[styles.indexBadgeText, { fontSize: scaleText(9) }]}>
485
+ {idx + 1}
486
+ </Typography>
487
+ </View>
488
+
489
+ {/* Node Text Label Card */}
490
+ <View
491
+ style={[
492
+ isCurrent ? styles.activeLabelBox : styles.labelBox,
493
+ {
494
+ top: scale(nodeSize + 4),
495
+ borderRadius: scale(10),
496
+ paddingHorizontal: scale(10),
497
+ paddingVertical: scale(4),
498
+ },
499
+ ]}
500
+ >
501
+ <Typography
502
+ numberOfLines={1}
503
+ style={[
504
+ isCurrent ? styles.activeLabelText : styles.labelText,
505
+ { fontSize: scaleText(11.5) },
506
+ ]}
507
+ >
508
+ {p.label}{' '}
509
+ <Typography style={{ opacity: isCurrent ? 0.9 : 0.6, fontSize: scaleText(10) }}>
510
+ {p.levelCode}
511
+ </Typography>
512
+ {isCurrent && ' · AQUI'}
513
+ </Typography>
514
+ </View>
515
+ </View>
516
+ );
517
+ })}
518
+ </View>
519
+ </ScrollView>
520
+ </ScrollView>
521
+
522
+ {/* Floating Legend Panel */}
523
+ <View
524
+ style={[
525
+ styles.legendCard,
526
+ {
527
+ borderRadius: scale(16),
528
+ padding: scale(12),
529
+ bottom: scale(112),
530
+ },
531
+ ]}
532
+ >
533
+ <View style={styles.legendRow}>
534
+ <View style={[styles.legendDot, { backgroundColor: theme.colors.success }]} />
535
+ <Typography style={[styles.legendText, { fontSize: scaleText(11) }]}>visitado · rever</Typography>
536
+ </View>
537
+ <View style={styles.legendRow}>
538
+ <View style={[styles.legendDot, { backgroundColor: theme.colors.primary }]} />
539
+ <Typography style={[styles.legendText, { fontSize: scaleText(11) }]}>estás aqui</Typography>
540
+ </View>
541
+ <View style={styles.legendRow}>
542
+ <View style={[styles.legendDot, { backgroundColor: theme.colors.brown[300] }]} />
543
+ <Typography style={[styles.legendText, { fontSize: scaleText(11) }]}>bloqueado</Typography>
544
+ </View>
545
+ </View>
546
+
547
+ {/* Floating Continue CTA Button */}
548
+ <View
549
+ style={[
550
+ styles.floatingFooter,
551
+ {
552
+ left: scale(16),
553
+ right: scale(16),
554
+ bottom: scale(16),
555
+ },
556
+ ]}
557
+ >
558
+ <JourneyButton
559
+ title="Continuar a viagem"
560
+ subtitle={`ESTÁS EM ${activeStation.label} · ${activeStation.levelCode}`}
561
+ iconName="Play"
562
+ variant="primary"
563
+ onPress={() => onContinuePress?.(activeStation)}
564
+ />
565
+ </View>
566
+ </View>
567
+ </View>
568
+ );
569
+ };
570
+
571
+ const styles = StyleSheet.create({
572
+ outerContainer: {
573
+ backgroundColor: '#d9ebec', // Soft ocean blue
574
+ flexDirection: 'column',
575
+ alignSelf: 'center',
576
+ overflow: 'hidden',
577
+ },
578
+ header: {
579
+ backgroundColor: '#d9ebec',
580
+ flexDirection: 'row',
581
+ alignItems: 'center',
582
+ justifyContent: 'space-between',
583
+ paddingHorizontal: 20,
584
+ paddingTop: 16,
585
+ paddingBottom: 16,
586
+ borderBottomWidth: 1.5,
587
+ borderBottomColor: '#b4cfd1',
588
+ },
589
+ headerLeft: {
590
+ flexDirection: 'row',
591
+ alignItems: 'center',
592
+ gap: 12,
593
+ },
594
+ headerText: {
595
+ justifyContent: 'center',
596
+ },
597
+ headerTitle: {
598
+
599
+ color: theme.colors.brown[500],
600
+ letterSpacing: 0.6,
601
+ },
602
+ headerSubtitle: {
603
+
604
+ color: theme.colors.brown[800],
605
+ },
606
+ flightBtn: {
607
+ flexDirection: 'row',
608
+ alignItems: 'center',
609
+ justifyContent: 'center',
610
+ gap: 8,
611
+ backgroundColor: theme.colors.brown[800],
612
+ ...Platform.select({
613
+ web: { boxShadow: `0px 4px 0px ${theme.colors.brown[900]}` },
614
+ default: {
615
+ shadowColor: theme.colors.brown[900],
616
+ shadowOffset: { width: 0, height: 4 },
617
+ shadowOpacity: 1,
618
+ shadowRadius: 0,
619
+ elevation: 3,
620
+ },
621
+ }),
622
+ },
623
+ flightBtnText: {
624
+
625
+ color: '#ffffff',
626
+ letterSpacing: 0.5,
627
+ },
628
+ canvasWrapper: {
629
+ flex: 1,
630
+ position: 'relative',
631
+ overflow: 'hidden',
632
+ },
633
+ scrollView: {
634
+ flex: 1,
635
+ },
636
+ pulseRing: {
637
+ position: 'absolute',
638
+ alignItems: 'center',
639
+ justifyContent: 'center',
640
+ },
641
+ planeWrapper: {
642
+ position: 'absolute',
643
+ zIndex: 10,
644
+ },
645
+ nodeContainer: {
646
+ position: 'absolute',
647
+ alignItems: 'center',
648
+ justifyContent: 'center',
649
+ zIndex: 5,
650
+ },
651
+ nodeCircle: {
652
+ alignItems: 'center',
653
+ justifyContent: 'center',
654
+ backgroundColor: '#ffffff',
655
+ ...Platform.select({
656
+ web: { cursor: 'pointer' },
657
+ }),
658
+ },
659
+ nodeVisitedShadow: {
660
+ ...Platform.select({
661
+ web: { boxShadow: `0px 4px 0px ${theme.colors.success}` },
662
+ default: {
663
+ shadowColor: theme.colors.success,
664
+ shadowOffset: { width: 0, height: 4 },
665
+ shadowOpacity: 1,
666
+ shadowRadius: 0,
667
+ elevation: 3,
668
+ },
669
+ }),
670
+ },
671
+ nodeCurrentShadow: {
672
+ ...Platform.select({
673
+ web: { boxShadow: `0px 4px 0px ${theme.colors.primary}` },
674
+ default: {
675
+ shadowColor: theme.colors.primary,
676
+ shadowOffset: { width: 0, height: 4 },
677
+ shadowOpacity: 1,
678
+ shadowRadius: 0,
679
+ elevation: 4,
680
+ },
681
+ }),
682
+ },
683
+ nodeLockedShadow: {
684
+ ...Platform.select({
685
+ web: { boxShadow: `0px 4px 0px ${theme.colors.brown[100]}` },
686
+ default: {
687
+ shadowColor: theme.colors.brown[100],
688
+ shadowOffset: { width: 0, height: 4 },
689
+ shadowOpacity: 1,
690
+ shadowRadius: 0,
691
+ elevation: 1,
692
+ },
693
+ }),
694
+ },
695
+ indexBadge: {
696
+ position: 'absolute',
697
+ alignItems: 'center',
698
+ justifyContent: 'center',
699
+ zIndex: 8,
700
+ },
701
+ indexBadgeText: {
702
+
703
+ color: '#ffffff',
704
+ textAlign: 'center',
705
+ },
706
+ labelBox: {
707
+ position: 'absolute',
708
+ backgroundColor: '#ffffff',
709
+ borderWidth: 1.5,
710
+ borderColor: '#efe2d6',
711
+ alignSelf: 'center',
712
+ alignItems: 'center',
713
+ justifyContent: 'center',
714
+ ...Platform.select({
715
+ web: { boxShadow: '0px 2px 4px rgba(81, 51, 45, 0.06)' },
716
+ default: {
717
+ shadowColor: '#51332d',
718
+ shadowOffset: { width: 0, height: 2 },
719
+ shadowOpacity: 0.06,
720
+ shadowRadius: 4,
721
+ elevation: 1,
722
+ },
723
+ }),
724
+ },
725
+ labelText: {
726
+
727
+ color: theme.colors.brown[600],
728
+ textAlign: 'center',
729
+ },
730
+ activeLabelBox: {
731
+ position: 'absolute',
732
+ backgroundColor: theme.colors.brown[800],
733
+ alignSelf: 'center',
734
+ alignItems: 'center',
735
+ justifyContent: 'center',
736
+ },
737
+ activeLabelText: {
738
+
739
+ color: '#ffffff',
740
+ textAlign: 'center',
741
+ },
742
+ legendCard: {
743
+ position: 'absolute',
744
+ left: 16,
745
+ bottom: 16,
746
+ backgroundColor: 'rgba(255, 255, 255, 0.9)',
747
+ borderWidth: 1.5,
748
+ borderColor: '#efe2d6',
749
+ zIndex: 10,
750
+ gap: 8,
751
+ ...Platform.select({
752
+ web: { boxShadow: '0px 4px 12px rgba(81, 51, 45, 0.08)' },
753
+ default: {
754
+ shadowColor: '#51332d',
755
+ shadowOffset: { width: 0, height: 4 },
756
+ shadowOpacity: 0.08,
757
+ shadowRadius: 12,
758
+ elevation: 2,
759
+ },
760
+ }),
761
+ },
762
+ legendRow: {
763
+ flexDirection: 'row',
764
+ alignItems: 'center',
765
+ gap: 8,
766
+ },
767
+ legendDot: {
768
+ width: 10,
769
+ height: 10,
770
+ borderRadius: 5,
771
+ },
772
+ legendText: {
773
+
774
+ color: theme.colors.brown[600],
775
+ },
776
+ floatingFooter: {
777
+ position: 'absolute',
778
+ zIndex: 20,
779
+ ...Platform.select({
780
+ web: { filter: 'drop-shadow(0px 8px 16px rgba(81, 51, 45, 0.12))' },
781
+ default: {
782
+ shadowColor: '#51332d',
783
+ shadowOffset: { width: 0, height: 8 },
784
+ shadowOpacity: 0.12,
785
+ shadowRadius: 16,
786
+ elevation: 6,
787
+ },
788
+ }),
789
+ },
790
+ });