@digilogiclabs/create-saas-app 1.14.1 → 1.17.1

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 (147) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +285 -39
  3. package/bin/index.js +1 -1
  4. package/dist/.tsbuildinfo +1 -1
  5. package/dist/cli/prompts/project-setup.d.ts.map +1 -1
  6. package/dist/cli/prompts/project-setup.js +49 -12
  7. package/dist/cli/prompts/project-setup.js.map +1 -1
  8. package/dist/generators/template-generator.d.ts.map +1 -1
  9. package/dist/generators/template-generator.js +27 -4
  10. package/dist/generators/template-generator.js.map +1 -1
  11. package/dist/templates/mobile/base/template/App.tsx +2 -0
  12. package/dist/templates/mobile/ui-auth-payments/template/.env.example +20 -0
  13. package/dist/templates/mobile/ui-auth-payments/template/README.md +218 -0
  14. package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/_layout.tsx +153 -0
  15. package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/analytics.tsx +668 -0
  16. package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/billing.tsx +743 -0
  17. package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/index.tsx +757 -0
  18. package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/orders.tsx +402 -0
  19. package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/profile.tsx +580 -0
  20. package/dist/templates/mobile/ui-auth-payments/template/app/_layout.tsx +127 -0
  21. package/dist/templates/mobile/ui-auth-payments/template/app/auth/login.tsx +246 -0
  22. package/dist/templates/mobile/ui-auth-payments/template/app/auth/signup.tsx +362 -0
  23. package/dist/templates/mobile/ui-auth-payments/template/app/onboarding/index.tsx +193 -0
  24. package/dist/templates/mobile/ui-auth-payments/template/app/tour/index.tsx +272 -0
  25. package/dist/templates/mobile/ui-auth-payments/template/app.json +93 -0
  26. package/dist/templates/mobile/ui-auth-payments/template/babel.config.js +23 -0
  27. package/dist/templates/mobile/ui-auth-payments/template/eas.json +45 -0
  28. package/dist/templates/mobile/ui-auth-payments/template/expo-env.d.ts +3 -0
  29. package/dist/templates/mobile/ui-auth-payments/template/jest-setup.ts +74 -0
  30. package/dist/templates/mobile/ui-auth-payments/template/metro.config.js +11 -0
  31. package/dist/templates/mobile/ui-auth-payments/template/package.json +106 -0
  32. package/dist/templates/mobile/ui-auth-payments/template/tsconfig.json +31 -0
  33. package/dist/templates/mobile/ui-auth-payments-ai/template/.env.example +23 -0
  34. package/dist/templates/mobile/ui-auth-payments-ai/template/README.md +254 -0
  35. package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/_layout.tsx +169 -0
  36. package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/ai.tsx +522 -0
  37. package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/analytics.tsx +668 -0
  38. package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/billing.tsx +743 -0
  39. package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/index.tsx +676 -0
  40. package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/orders.tsx +402 -0
  41. package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/profile.tsx +580 -0
  42. package/dist/templates/mobile/ui-auth-payments-ai/template/app/_layout.tsx +127 -0
  43. package/dist/templates/mobile/ui-auth-payments-ai/template/app/auth/login.tsx +246 -0
  44. package/dist/templates/mobile/ui-auth-payments-ai/template/app/auth/signup.tsx +362 -0
  45. package/dist/templates/mobile/ui-auth-payments-ai/template/app/onboarding/index.tsx +193 -0
  46. package/dist/templates/mobile/ui-auth-payments-ai/template/app/tour/index.tsx +272 -0
  47. package/dist/templates/mobile/ui-auth-payments-ai/template/app.json +93 -0
  48. package/dist/templates/mobile/ui-auth-payments-ai/template/babel.config.js +23 -0
  49. package/dist/templates/mobile/ui-auth-payments-ai/template/eas.json +45 -0
  50. package/dist/templates/mobile/ui-auth-payments-ai/template/expo-env.d.ts +3 -0
  51. package/dist/templates/mobile/ui-auth-payments-ai/template/jest-setup.ts +74 -0
  52. package/dist/templates/mobile/ui-auth-payments-ai/template/metro.config.js +11 -0
  53. package/dist/templates/mobile/ui-auth-payments-ai/template/package.json +108 -0
  54. package/dist/templates/mobile/ui-auth-payments-ai/template/tsconfig.json +31 -0
  55. package/dist/templates/web/base/template/src/app/dashboard/page.tsx +62 -20
  56. package/dist/templates/web/base/template/src/app/loading.tsx +45 -27
  57. package/dist/templates/web/base/template/src/components/providers/app-providers.tsx +2 -0
  58. package/dist/templates/web/ui-auth/template/package.json +1 -1
  59. package/dist/templates/web/ui-auth/template/src/app/loading.tsx +30 -12
  60. package/dist/templates/web/ui-auth/template/src/components/providers/app-providers.tsx +2 -0
  61. package/dist/templates/web/ui-auth/template/src/components/shared/header.tsx +43 -2
  62. package/dist/templates/web/ui-auth-ai/template/package.json +1 -1
  63. package/dist/templates/web/ui-auth-payments/template/package.json +1 -1
  64. package/dist/templates/web/ui-auth-payments/template/src/app/dashboard/page.tsx +69 -17
  65. package/dist/templates/web/ui-auth-payments/template/src/components/providers/app-providers.tsx +2 -0
  66. package/dist/templates/web/ui-auth-payments-ai/template/package.json +1 -1
  67. package/dist/templates/web/ui-auth-payments-ai/template/src/app/billing/page.tsx +218 -7
  68. package/dist/templates/web/ui-auth-payments-ai/template/src/app/dashboard/page.tsx +62 -9
  69. package/dist/templates/web/ui-auth-payments-ai/template/src/app/onboarding/page.tsx +364 -0
  70. package/dist/templates/web/ui-auth-payments-ai/template/src/app/settings/page.tsx +532 -0
  71. package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/login-form.tsx +70 -51
  72. package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/signup-form.tsx +76 -60
  73. package/dist/templates/web/ui-auth-payments-ai/template/src/components/providers/app-providers.tsx +2 -0
  74. package/dist/templates/web/ui-auth-payments-audio/template/package.json +1 -1
  75. package/dist/templates/web/ui-auth-payments-audio/template/src/app/dashboard/page.tsx +71 -17
  76. package/dist/templates/web/ui-auth-payments-audio/template/src/components/providers/app-providers.tsx +2 -0
  77. package/dist/templates/web/ui-auth-payments-video/template/package.json +1 -1
  78. package/dist/templates/web/ui-auth-payments-video/template/src/components/providers/app-providers.tsx +2 -0
  79. package/package.json +1 -1
  80. package/src/templates/mobile/base/template/App.tsx +2 -0
  81. package/src/templates/mobile/ui-auth-payments/template/.env.example +20 -0
  82. package/src/templates/mobile/ui-auth-payments/template/README.md +218 -0
  83. package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/_layout.tsx +153 -0
  84. package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/analytics.tsx +668 -0
  85. package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/billing.tsx +743 -0
  86. package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/index.tsx +757 -0
  87. package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/orders.tsx +402 -0
  88. package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/profile.tsx +580 -0
  89. package/src/templates/mobile/ui-auth-payments/template/app/_layout.tsx +127 -0
  90. package/src/templates/mobile/ui-auth-payments/template/app/auth/login.tsx +246 -0
  91. package/src/templates/mobile/ui-auth-payments/template/app/auth/signup.tsx +362 -0
  92. package/src/templates/mobile/ui-auth-payments/template/app/onboarding/index.tsx +193 -0
  93. package/src/templates/mobile/ui-auth-payments/template/app/tour/index.tsx +272 -0
  94. package/src/templates/mobile/ui-auth-payments/template/app.json +93 -0
  95. package/src/templates/mobile/ui-auth-payments/template/babel.config.js +23 -0
  96. package/src/templates/mobile/ui-auth-payments/template/eas.json +45 -0
  97. package/src/templates/mobile/ui-auth-payments/template/expo-env.d.ts +3 -0
  98. package/src/templates/mobile/ui-auth-payments/template/jest-setup.ts +74 -0
  99. package/src/templates/mobile/ui-auth-payments/template/metro.config.js +11 -0
  100. package/src/templates/mobile/ui-auth-payments/template/package.json +106 -0
  101. package/src/templates/mobile/ui-auth-payments/template/tsconfig.json +31 -0
  102. package/src/templates/mobile/ui-auth-payments-ai/template/.env.example +23 -0
  103. package/src/templates/mobile/ui-auth-payments-ai/template/README.md +254 -0
  104. package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/_layout.tsx +169 -0
  105. package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/ai.tsx +522 -0
  106. package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/analytics.tsx +668 -0
  107. package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/billing.tsx +743 -0
  108. package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/index.tsx +676 -0
  109. package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/orders.tsx +402 -0
  110. package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/profile.tsx +580 -0
  111. package/src/templates/mobile/ui-auth-payments-ai/template/app/_layout.tsx +127 -0
  112. package/src/templates/mobile/ui-auth-payments-ai/template/app/auth/login.tsx +246 -0
  113. package/src/templates/mobile/ui-auth-payments-ai/template/app/auth/signup.tsx +362 -0
  114. package/src/templates/mobile/ui-auth-payments-ai/template/app/onboarding/index.tsx +193 -0
  115. package/src/templates/mobile/ui-auth-payments-ai/template/app/tour/index.tsx +272 -0
  116. package/src/templates/mobile/ui-auth-payments-ai/template/app.json +93 -0
  117. package/src/templates/mobile/ui-auth-payments-ai/template/babel.config.js +23 -0
  118. package/src/templates/mobile/ui-auth-payments-ai/template/eas.json +45 -0
  119. package/src/templates/mobile/ui-auth-payments-ai/template/expo-env.d.ts +3 -0
  120. package/src/templates/mobile/ui-auth-payments-ai/template/jest-setup.ts +74 -0
  121. package/src/templates/mobile/ui-auth-payments-ai/template/metro.config.js +11 -0
  122. package/src/templates/mobile/ui-auth-payments-ai/template/package.json +108 -0
  123. package/src/templates/mobile/ui-auth-payments-ai/template/tsconfig.json +31 -0
  124. package/src/templates/web/base/template/src/app/dashboard/page.tsx +62 -20
  125. package/src/templates/web/base/template/src/app/loading.tsx +45 -27
  126. package/src/templates/web/base/template/src/components/providers/app-providers.tsx +2 -0
  127. package/src/templates/web/ui-auth/template/package.json +1 -1
  128. package/src/templates/web/ui-auth/template/src/app/loading.tsx +30 -12
  129. package/src/templates/web/ui-auth/template/src/components/providers/app-providers.tsx +2 -0
  130. package/src/templates/web/ui-auth/template/src/components/shared/header.tsx +43 -2
  131. package/src/templates/web/ui-auth-ai/template/package.json +1 -1
  132. package/src/templates/web/ui-auth-payments/template/package.json +1 -1
  133. package/src/templates/web/ui-auth-payments/template/src/app/dashboard/page.tsx +69 -17
  134. package/src/templates/web/ui-auth-payments/template/src/components/providers/app-providers.tsx +2 -0
  135. package/src/templates/web/ui-auth-payments-ai/template/package.json +1 -1
  136. package/src/templates/web/ui-auth-payments-ai/template/src/app/billing/page.tsx +218 -7
  137. package/src/templates/web/ui-auth-payments-ai/template/src/app/dashboard/page.tsx +62 -9
  138. package/src/templates/web/ui-auth-payments-ai/template/src/app/onboarding/page.tsx +364 -0
  139. package/src/templates/web/ui-auth-payments-ai/template/src/app/settings/page.tsx +532 -0
  140. package/src/templates/web/ui-auth-payments-ai/template/src/components/client/login-form.tsx +70 -51
  141. package/src/templates/web/ui-auth-payments-ai/template/src/components/client/signup-form.tsx +76 -60
  142. package/src/templates/web/ui-auth-payments-ai/template/src/components/providers/app-providers.tsx +2 -0
  143. package/src/templates/web/ui-auth-payments-audio/template/package.json +1 -1
  144. package/src/templates/web/ui-auth-payments-audio/template/src/app/dashboard/page.tsx +71 -17
  145. package/src/templates/web/ui-auth-payments-audio/template/src/components/providers/app-providers.tsx +2 -0
  146. package/src/templates/web/ui-auth-payments-video/template/package.json +1 -1
  147. package/src/templates/web/ui-auth-payments-video/template/src/components/providers/app-providers.tsx +2 -0
@@ -0,0 +1,757 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { View, Text, StyleSheet, ScrollView, RefreshControl, Dimensions, Animated } from 'react-native';
3
+ import { useAuth } from '@digilogiclabs/saas-factory-auth/native';
4
+ import { LinearGradient } from 'expo-linear-gradient';
5
+ import { BlurView } from 'expo-blur';
6
+ import * as Haptics from 'expo-haptics';
7
+
8
+ // UI Components - Updated for v0.22.0
9
+ import {
10
+ NativeCard as Card,
11
+ NativeMobileContainer as MobileContainer,
12
+ NativeButton as Button,
13
+ NativeProgressRing as ProgressRing,
14
+ NativeChart as Chart,
15
+ NativeStatCard as StatCard,
16
+ NativeSkeletonCard as SkeletonCard,
17
+ NativeSkeletonText as SkeletonText,
18
+ PageTransition,
19
+ NetworkAwareContent,
20
+ NativeMobileHero as MobileHero,
21
+ VirtualScrollList,
22
+ LazyImage,
23
+ ProgressiveImage,
24
+ SwipeableCard,
25
+ NativeTour,
26
+ NativeFeatureHighlight,
27
+ NativeTooltip,
28
+ PullToRefresh,
29
+ useNetworkInfo,
30
+ useOfflineState,
31
+ useTheme
32
+ } from '@digilogiclabs/saas-factory-ui/native';
33
+
34
+ // Icons
35
+ import {
36
+ TrendingUp,
37
+ ShoppingBag,
38
+ CreditCard,
39
+ Users,
40
+ Bell,
41
+ Plus,
42
+ ArrowRight
43
+ } from 'react-native-heroicons/outline';
44
+
45
+ const { width } = Dimensions.get('window');
46
+
47
+ interface DashboardData {
48
+ stats: {
49
+ totalOrders: number;
50
+ totalRevenue: number;
51
+ activeUsers: number;
52
+ conversionRate: number;
53
+ };
54
+ recentActivity: Array<{
55
+ id: string;
56
+ type: 'order' | 'user' | 'payment';
57
+ message: string;
58
+ timestamp: string;
59
+ }>;
60
+ chartData: Array<{
61
+ date: string;
62
+ revenue: number;
63
+ orders: number;
64
+ }>;
65
+ }
66
+
67
+ export default function HomeScreen() {
68
+ const { user } = useAuth();
69
+ const { colors, isDark } = useTheme();
70
+ const [data, setData] = useState<DashboardData | null>(null);
71
+ const [loading, setLoading] = useState(true);
72
+ const [refreshing, setRefreshing] = useState(false);
73
+ const [showTour, setShowTour] = useState(false);
74
+ const networkInfo = useNetworkInfo();
75
+ const isOnline = useOfflineState();
76
+
77
+ // Animation values
78
+ const fadeAnim = useState(new Animated.Value(0))[0];
79
+ const slideAnim = useState(new Animated.Value(50))[0];
80
+
81
+ // Tour configuration for new users
82
+ const tourSteps = [
83
+ {
84
+ target: 'stats-section',
85
+ title: 'Your Business Stats',
86
+ content: 'Track key metrics like orders, revenue, and user growth at a glance.',
87
+ placement: 'bottom'
88
+ },
89
+ {
90
+ target: 'chart-section',
91
+ title: 'Performance Charts',
92
+ content: 'Visualize your business trends with interactive charts and analytics.',
93
+ placement: 'top'
94
+ },
95
+ {
96
+ target: 'activity-section',
97
+ title: 'Recent Activity',
98
+ content: 'Stay updated with real-time notifications about orders, users, and payments.',
99
+ placement: 'top'
100
+ }
101
+ ];
102
+
103
+ const fetchDashboardData = async (isRefresh = false) => {
104
+ try {
105
+ if (isRefresh) setRefreshing(true);
106
+
107
+ // Simulate API call
108
+ await new Promise(resolve => setTimeout(resolve, 1000));
109
+
110
+ const mockData: DashboardData = {
111
+ stats: {
112
+ totalOrders: 156,
113
+ totalRevenue: 12450,
114
+ activeUsers: 1249,
115
+ conversionRate: 3.2
116
+ },
117
+ recentActivity: [
118
+ {
119
+ id: '1',
120
+ type: 'order',
121
+ message: 'New order #1234 received',
122
+ timestamp: '2 minutes ago'
123
+ },
124
+ {
125
+ id: '2',
126
+ type: 'user',
127
+ message: 'New user registered',
128
+ timestamp: '5 minutes ago'
129
+ },
130
+ {
131
+ id: '3',
132
+ type: 'payment',
133
+ message: 'Payment of $299 processed',
134
+ timestamp: '10 minutes ago'
135
+ }
136
+ ],
137
+ chartData: [
138
+ { date: 'Mon', revenue: 1200, orders: 15 },
139
+ { date: 'Tue', revenue: 1800, orders: 22 },
140
+ { date: 'Wed', revenue: 2100, orders: 28 },
141
+ { date: 'Thu', revenue: 1600, orders: 18 },
142
+ { date: 'Fri', revenue: 2400, orders: 32 },
143
+ { date: 'Sat', revenue: 2800, orders: 38 },
144
+ { date: 'Sun', revenue: 1900, orders: 25 }
145
+ ]
146
+ };
147
+
148
+ setData(mockData);
149
+ } catch (error) {
150
+ console.error('Failed to fetch dashboard data:', error);
151
+ } finally {
152
+ setLoading(false);
153
+ setRefreshing(false);
154
+ }
155
+ };
156
+
157
+ useEffect(() => {
158
+ fetchDashboardData();
159
+
160
+ // Check if user is new and should see the tour
161
+ const checkForTour = async () => {
162
+ // In a real app, check AsyncStorage or user preferences
163
+ const hasSeenTour = false; // Replace with actual storage check
164
+ if (!hasSeenTour) {
165
+ setTimeout(() => setShowTour(true), 1500);
166
+ }
167
+ };
168
+
169
+ // Entrance animations
170
+ Animated.parallel([
171
+ Animated.timing(fadeAnim, {
172
+ toValue: 1,
173
+ duration: 800,
174
+ useNativeDriver: true,
175
+ }),
176
+ Animated.timing(slideAnim, {
177
+ toValue: 0,
178
+ duration: 600,
179
+ useNativeDriver: true,
180
+ }),
181
+ ]).start();
182
+
183
+ checkForTour();
184
+ }, []);
185
+
186
+ const onRefresh = async () => {
187
+ await Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
188
+ fetchDashboardData(true);
189
+ };
190
+
191
+ if (loading && !data) {
192
+ return (
193
+ <PageTransition type="fade">
194
+ <View style={styles.container}>
195
+ <LinearGradient
196
+ colors={
197
+ isDark
198
+ ? ['#0F172A', '#1E293B', '#334155']
199
+ : ['#F8FAFC', '#E2E8F0', '#CBD5E1']
200
+ }
201
+ style={styles.gradientBackground}
202
+ />
203
+
204
+ <ScrollView style={styles.scrollView} contentContainerStyle={styles.scrollContent}>
205
+ <MobileContainer style={styles.content}>
206
+ {/* Hero skeleton */}
207
+ <View style={styles.heroSkeleton}>
208
+ <SkeletonText style={{ width: '60%', height: 24, marginBottom: 16 }} />
209
+ <SkeletonText style={{ width: '80%', height: 16, marginBottom: 24 }} />
210
+ <View style={styles.buttonSkeletonRow}>
211
+ <SkeletonCard style={styles.buttonSkeleton} />
212
+ <SkeletonCard style={styles.buttonSkeleton} />
213
+ </View>
214
+ </View>
215
+
216
+ {/* Stats skeleton */}
217
+ <View style={styles.statsGrid}>
218
+ {Array.from({ length: 4 }).map((_, i) => (
219
+ <SkeletonCard key={i} style={styles.statCard} />
220
+ ))}
221
+ </View>
222
+
223
+ {/* Chart skeleton */}
224
+ <SkeletonCard style={styles.chartCard} />
225
+
226
+ {/* Actions skeleton */}
227
+ <SkeletonCard style={styles.actionsCard} />
228
+
229
+ {/* Activity skeleton */}
230
+ <View style={styles.activitySkeleton}>
231
+ <SkeletonCard style={styles.activityCard} />
232
+ {Array.from({ length: 3 }).map((_, i) => (
233
+ <View key={i} style={styles.activityItemSkeleton}>
234
+ <SkeletonCard style={styles.activityIconSkeleton} />
235
+ <View style={styles.activityContentSkeleton}>
236
+ <SkeletonText style={{ width: '70%', height: 14, marginBottom: 4 }} />
237
+ <SkeletonText style={{ width: '40%', height: 12 }} />
238
+ </View>
239
+ </View>
240
+ ))}
241
+ </View>
242
+ </MobileContainer>
243
+ </ScrollView>
244
+ </View>
245
+ </PageTransition>
246
+ );
247
+ }
248
+
249
+ return (
250
+ <PageTransition type="fade">
251
+ <View style={styles.container}>
252
+ {/* Dynamic gradient background */}
253
+ <LinearGradient
254
+ colors={
255
+ isDark
256
+ ? ['#0F172A', '#1E293B', '#334155']
257
+ : ['#F8FAFC', '#E2E8F0', '#CBD5E1']
258
+ }
259
+ style={styles.gradientBackground}
260
+ />
261
+
262
+ {/* Animated background elements */}
263
+ <View style={styles.backgroundElements}>
264
+ <Animated.View
265
+ style={[
266
+ styles.floatingElement,
267
+ {
268
+ opacity: fadeAnim,
269
+ transform: [
270
+ { translateY: slideAnim },
271
+ { scale: fadeAnim }
272
+ ]
273
+ }
274
+ ]}
275
+ >
276
+ <LinearGradient
277
+ colors={[colors.primary + '40', colors.secondary + '20']}
278
+ style={[styles.gradientCircle, styles.circle1]}
279
+ />
280
+ </Animated.View>
281
+
282
+ <Animated.View
283
+ style={[
284
+ styles.floatingElement,
285
+ {
286
+ opacity: fadeAnim.interpolate({
287
+ inputRange: [0, 1],
288
+ outputRange: [0, 0.6]
289
+ }),
290
+ transform: [
291
+ { translateY: slideAnim },
292
+ { scale: fadeAnim }
293
+ ]
294
+ }
295
+ ]}
296
+ >
297
+ <LinearGradient
298
+ colors={[colors.accent + '30', colors.primary + '10']}
299
+ style={[styles.gradientCircle, styles.circle2]}
300
+ />
301
+ </Animated.View>
302
+ </View>
303
+
304
+ <ScrollView
305
+ style={styles.scrollView}
306
+ contentContainerStyle={styles.scrollContent}
307
+ showsVerticalScrollIndicator={false}
308
+ refreshControl={
309
+ <RefreshControl
310
+ refreshing={refreshing}
311
+ onRefresh={onRefresh}
312
+ tintColor={colors.primary}
313
+ colors={[colors.primary]}
314
+ />
315
+ }
316
+ >
317
+ <Animated.View
318
+ style={[
319
+ styles.content,
320
+ {
321
+ opacity: fadeAnim,
322
+ transform: [{ translateY: slideAnim }]
323
+ }
324
+ ]}
325
+ >
326
+ {/* Hero Section */}
327
+ <MobileHero
328
+ badge={{
329
+ text: "🚀 Dashboard",
330
+ variant: "secondary" as const,
331
+ }}
332
+ title={{
333
+ text: `Welcome back, ${user?.name || user?.email?.split('@')[0] || 'User'}!`,
334
+ size: "lg" as const
335
+ }}
336
+ description="Here's your business overview and key metrics for today."
337
+ actions={[
338
+ {
339
+ label: "View Analytics",
340
+ variant: "default",
341
+ size: "md",
342
+ onPress: () => {/* Navigate to analytics */}
343
+ },
344
+ {
345
+ label: "Add Order",
346
+ variant: "outline",
347
+ size: "md",
348
+ onPress: () => {/* Navigate to new order */}
349
+ }
350
+ ]}
351
+ className="mb-8"
352
+ />
353
+
354
+ {/* Network Status (when offline) */}
355
+ {!isOnline && (
356
+ <BlurView intensity={80} style={styles.offlineCard}>
357
+ <LinearGradient
358
+ colors={['rgba(251, 191, 36, 0.1)', 'rgba(245, 158, 11, 0.05)']}
359
+ style={styles.gradientOverlay}
360
+ />
361
+ <Text style={styles.offlineText}>
362
+ 🔴 You're offline. Some features may be limited.
363
+ </Text>
364
+ </BlurView>
365
+ )}
366
+
367
+ {/* Quick Stats */}
368
+ <NetworkAwareContent
369
+ showOnSlow={
370
+ <View style={styles.statsGrid}>
371
+ <StatCard
372
+ title="Orders"
373
+ value={data?.stats.totalOrders.toString() || '0'}
374
+ icon={<ShoppingBag width={24} height={24} color="#3b82f6" />}
375
+ change="+12%"
376
+ changeType="positive"
377
+ style={styles.statCard}
378
+ />
379
+ <StatCard
380
+ title="Revenue"
381
+ value={`$${data?.stats.totalRevenue.toLocaleString() || '0'}`}
382
+ icon={<CreditCard width={24} height={24} color="#10b981" />}
383
+ change="+8%"
384
+ changeType="positive"
385
+ style={styles.statCard}
386
+ />
387
+ </View>
388
+ }
389
+ >
390
+ <View style={styles.statsGrid}>
391
+ <StatCard
392
+ title="Orders"
393
+ value={data?.stats.totalOrders.toString() || '0'}
394
+ icon={<ShoppingBag width={24} height={24} color="#3b82f6" />}
395
+ change="+12%"
396
+ changeType="positive"
397
+ style={styles.statCard}
398
+ />
399
+ <StatCard
400
+ title="Revenue"
401
+ value={`$${data?.stats.totalRevenue.toLocaleString() || '0'}`}
402
+ icon={<CreditCard width={24} height={24} color="#10b981" />}
403
+ change="+8%"
404
+ changeType="positive"
405
+ style={styles.statCard}
406
+ />
407
+ <StatCard
408
+ title="Users"
409
+ value={data?.stats.activeUsers.toLocaleString() || '0'}
410
+ icon={<Users width={24} height={24} color="#f59e0b" />}
411
+ change="+15%"
412
+ changeType="positive"
413
+ style={styles.statCard}
414
+ />
415
+ <StatCard
416
+ title="Conversion"
417
+ value={`${data?.stats.conversionRate || '0'}%`}
418
+ icon={<TrendingUp width={24} height={24} color="#ef4444" />}
419
+ change="+2.1%"
420
+ changeType="positive"
421
+ style={styles.statCard}
422
+ />
423
+ </View>
424
+ </NetworkAwareContent>
425
+
426
+ {/* Chart Section */}
427
+ <Card style={styles.chartCard}>
428
+ <View style={styles.cardHeader}>
429
+ <Text style={styles.cardTitle}>Revenue This Week</Text>
430
+ <Button variant="ghost" size="sm">
431
+ View All
432
+ </Button>
433
+ </View>
434
+ <Chart
435
+ data={data?.chartData || []}
436
+ type="line"
437
+ xKey="date"
438
+ yKey="revenue"
439
+ height={200}
440
+ style={styles.chart}
441
+ />
442
+ </Card>
443
+
444
+ {/* Quick Actions */}
445
+ <Card style={styles.actionsCard}>
446
+ <Text style={styles.cardTitle}>Quick Actions</Text>
447
+ <View style={styles.actionsGrid}>
448
+ <Button
449
+ variant="outline"
450
+ style={styles.actionButton}
451
+ onPress={() => {/* Navigate to add product */}}
452
+ >
453
+ <Plus width={20} height={20} />
454
+ <Text style={styles.actionButtonText}>Add Product</Text>
455
+ </Button>
456
+ <Button
457
+ variant="outline"
458
+ style={styles.actionButton}
459
+ onPress={() => {/* Navigate to orders */}}
460
+ >
461
+ <ShoppingBag width={20} height={20} />
462
+ <Text style={styles.actionButtonText}>View Orders</Text>
463
+ </Button>
464
+ <Button
465
+ variant="outline"
466
+ style={styles.actionButton}
467
+ onPress={() => {/* Navigate to analytics */}}
468
+ >
469
+ <TrendingUp width={20} height={20} />
470
+ <Text style={styles.actionButtonText}>Analytics</Text>
471
+ </Button>
472
+ </View>
473
+ </Card>
474
+
475
+ {/* Recent Activity */}
476
+ <Card style={styles.activityCard}>
477
+ <View style={styles.cardHeader}>
478
+ <Text style={styles.cardTitle}>Recent Activity</Text>
479
+ <Button
480
+ variant="ghost"
481
+ size="sm"
482
+ onPress={() => {/* Navigate to full activity */}}
483
+ >
484
+ <ArrowRight width={16} height={16} />
485
+ </Button>
486
+ </View>
487
+ <View style={styles.activityList}>
488
+ {data?.recentActivity.map((activity) => (
489
+ <View key={activity.id} style={styles.activityItem}>
490
+ <View style={[
491
+ styles.activityIcon,
492
+ { backgroundColor:
493
+ activity.type === 'order' ? '#dbeafe' :
494
+ activity.type === 'user' ? '#dcfce7' : '#fef3c7'
495
+ }
496
+ ]}>
497
+ {activity.type === 'order' && <ShoppingBag width={16} height={16} color="#3b82f6" />}
498
+ {activity.type === 'user' && <Users width={16} height={16} color="#10b981" />}
499
+ {activity.type === 'payment' && <CreditCard width={16} height={16} color="#f59e0b" />}
500
+ </View>
501
+ <View style={styles.activityContent}>
502
+ <Text style={styles.activityMessage}>{activity.message}</Text>
503
+ <Text style={styles.activityTime}>{activity.timestamp}</Text>
504
+ </View>
505
+ </View>
506
+ ))}
507
+ </View>
508
+ </Card>
509
+ </Animated.View>
510
+ </ScrollView>
511
+
512
+ {/* Native Tour Overlay */}
513
+ {showTour && (
514
+ <NativeTour
515
+ steps={tourSteps}
516
+ isActive={showTour}
517
+ onComplete={() => {
518
+ setShowTour(false);
519
+ Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success);
520
+ }}
521
+ onSkip={() => {
522
+ setShowTour(false);
523
+ Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
524
+ }}
525
+ maskColor="rgba(0, 0, 0, 0.7)"
526
+ borderRadius={12}
527
+ enableHaptics={true}
528
+ showStepNumber={true}
529
+ showProgress={true}
530
+ animated={true}
531
+ />
532
+ )}
533
+ </View>
534
+ </PageTransition>
535
+ );
536
+ }
537
+
538
+ const styles = StyleSheet.create({
539
+ container: {
540
+ flex: 1,
541
+ },
542
+ gradientBackground: {
543
+ position: 'absolute',
544
+ left: 0,
545
+ right: 0,
546
+ top: 0,
547
+ bottom: 0,
548
+ },
549
+ backgroundElements: {
550
+ position: 'absolute',
551
+ width: '100%',
552
+ height: '100%',
553
+ },
554
+ floatingElement: {
555
+ position: 'absolute',
556
+ },
557
+ gradientCircle: {
558
+ borderRadius: 150,
559
+ },
560
+ circle1: {
561
+ width: 300,
562
+ height: 300,
563
+ top: -100,
564
+ right: -150,
565
+ },
566
+ circle2: {
567
+ width: 200,
568
+ height: 200,
569
+ bottom: 100,
570
+ left: -100,
571
+ },
572
+ scrollView: {
573
+ flex: 1,
574
+ },
575
+ scrollContent: {
576
+ paddingBottom: 120, // Account for floating tab bar
577
+ },
578
+ content: {
579
+ paddingHorizontal: 20,
580
+ paddingTop: 20,
581
+ },
582
+ loadingContainer: {
583
+ flex: 1,
584
+ justifyContent: 'center',
585
+ alignItems: 'center',
586
+ },
587
+ loadingText: {
588
+ fontSize: 16,
589
+ color: '#64748b',
590
+ },
591
+ header: {
592
+ flexDirection: 'row',
593
+ justifyContent: 'space-between',
594
+ alignItems: 'center',
595
+ marginBottom: 24,
596
+ },
597
+ welcomeSection: {
598
+ flex: 1,
599
+ },
600
+ greeting: {
601
+ fontSize: 16,
602
+ color: '#64748b',
603
+ },
604
+ userName: {
605
+ fontSize: 24,
606
+ fontWeight: 'bold',
607
+ color: '#1e293b',
608
+ marginTop: 4,
609
+ },
610
+ notificationButton: {
611
+ width: 44,
612
+ height: 44,
613
+ },
614
+ offlineCard: {
615
+ padding: 20,
616
+ marginBottom: 20,
617
+ marginHorizontal: 20,
618
+ borderRadius: 16,
619
+ overflow: 'hidden',
620
+ borderWidth: 1,
621
+ borderColor: 'rgba(245, 158, 11, 0.2)',
622
+ },
623
+ gradientOverlay: {
624
+ position: 'absolute',
625
+ left: 0,
626
+ right: 0,
627
+ top: 0,
628
+ bottom: 0,
629
+ },
630
+ offlineText: {
631
+ color: '#92400e',
632
+ textAlign: 'center',
633
+ fontWeight: '600',
634
+ fontSize: 16,
635
+ },
636
+ chartCard: {
637
+ padding: 20,
638
+ marginBottom: 20,
639
+ marginHorizontal: 20,
640
+ borderRadius: 20,
641
+ overflow: 'hidden',
642
+ borderWidth: 1,
643
+ borderColor: 'rgba(255, 255, 255, 0.2)',
644
+ },
645
+ statsGrid: {
646
+ flexDirection: 'row',
647
+ flexWrap: 'wrap',
648
+ marginHorizontal: -8,
649
+ marginBottom: 24,
650
+ },
651
+ statCard: {
652
+ width: (width - 48) / 2, // Account for container padding and gaps
653
+ marginHorizontal: 8,
654
+ marginBottom: 16,
655
+ },
656
+ chartCard: {
657
+ padding: 16,
658
+ marginBottom: 16,
659
+ },
660
+ cardHeader: {
661
+ flexDirection: 'row',
662
+ justifyContent: 'space-between',
663
+ alignItems: 'center',
664
+ marginBottom: 16,
665
+ },
666
+ cardTitle: {
667
+ fontSize: 18,
668
+ fontWeight: '600',
669
+ color: '#1e293b',
670
+ },
671
+ chart: {
672
+ marginTop: 8,
673
+ },
674
+ actionsCard: {
675
+ padding: 16,
676
+ marginBottom: 16,
677
+ },
678
+ actionsGrid: {
679
+ flexDirection: 'row',
680
+ justifyContent: 'space-between',
681
+ marginTop: 16,
682
+ gap: 12,
683
+ },
684
+ actionButton: {
685
+ flex: 1,
686
+ flexDirection: 'column',
687
+ alignItems: 'center',
688
+ paddingVertical: 16,
689
+ gap: 8,
690
+ },
691
+ actionButtonText: {
692
+ fontSize: 14,
693
+ fontWeight: '500',
694
+ },
695
+ activityCard: {
696
+ padding: 16,
697
+ },
698
+ activityList: {
699
+ gap: 16,
700
+ },
701
+ activityItem: {
702
+ flexDirection: 'row',
703
+ alignItems: 'center',
704
+ gap: 12,
705
+ },
706
+ activityIcon: {
707
+ width: 32,
708
+ height: 32,
709
+ borderRadius: 16,
710
+ alignItems: 'center',
711
+ justifyContent: 'center',
712
+ },
713
+ activityContent: {
714
+ flex: 1,
715
+ },
716
+ activityMessage: {
717
+ fontSize: 14,
718
+ fontWeight: '500',
719
+ color: '#1e293b',
720
+ },
721
+ activityTime: {
722
+ fontSize: 12,
723
+ color: '#64748b',
724
+ marginTop: 2,
725
+ },
726
+ // Skeleton styles
727
+ heroSkeleton: {
728
+ marginBottom: 32,
729
+ paddingHorizontal: 20,
730
+ },
731
+ buttonSkeletonRow: {
732
+ flexDirection: 'row',
733
+ gap: 12,
734
+ },
735
+ buttonSkeleton: {
736
+ flex: 1,
737
+ height: 44,
738
+ borderRadius: 22,
739
+ },
740
+ activitySkeleton: {
741
+ padding: 16,
742
+ },
743
+ activityItemSkeleton: {
744
+ flexDirection: 'row',
745
+ alignItems: 'center',
746
+ gap: 12,
747
+ marginBottom: 16,
748
+ },
749
+ activityIconSkeleton: {
750
+ width: 32,
751
+ height: 32,
752
+ borderRadius: 16,
753
+ },
754
+ activityContentSkeleton: {
755
+ flex: 1,
756
+ },
757
+ });