@digilogiclabs/create-saas-app 1.17.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/README.md +153 -12
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/cli/commands/create.d.ts.map +1 -1
  5. package/dist/cli/commands/create.js +6 -2
  6. package/dist/cli/commands/create.js.map +1 -1
  7. package/dist/cli/index.js +1 -1
  8. package/dist/cli/index.js.map +1 -1
  9. package/dist/cli/prompts/project-setup.d.ts.map +1 -1
  10. package/dist/cli/prompts/project-setup.js +4 -0
  11. package/dist/cli/prompts/project-setup.js.map +1 -1
  12. package/dist/generators/template-generator.d.ts.map +1 -1
  13. package/dist/generators/template-generator.js +13 -7
  14. package/dist/generators/template-generator.js.map +1 -1
  15. package/dist/templates/mobile/base/template/App.tsx +2 -0
  16. package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/index.tsx +85 -4
  17. package/dist/templates/mobile/ui-auth-payments/template/app/_layout.tsx +2 -0
  18. package/dist/templates/mobile/ui-auth-payments-ai/template/.env.example +23 -0
  19. package/dist/templates/mobile/ui-auth-payments-ai/template/README.md +254 -0
  20. package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/_layout.tsx +169 -0
  21. package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/ai.tsx +522 -0
  22. package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/analytics.tsx +668 -0
  23. package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/billing.tsx +743 -0
  24. package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/index.tsx +676 -0
  25. package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/orders.tsx +402 -0
  26. package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/profile.tsx +580 -0
  27. package/dist/templates/mobile/ui-auth-payments-ai/template/app/_layout.tsx +127 -0
  28. package/dist/templates/mobile/ui-auth-payments-ai/template/app/auth/login.tsx +246 -0
  29. package/dist/templates/mobile/ui-auth-payments-ai/template/app/auth/signup.tsx +362 -0
  30. package/dist/templates/mobile/ui-auth-payments-ai/template/app/onboarding/index.tsx +193 -0
  31. package/dist/templates/mobile/ui-auth-payments-ai/template/app/tour/index.tsx +272 -0
  32. package/dist/templates/mobile/ui-auth-payments-ai/template/app.json +93 -0
  33. package/dist/templates/mobile/ui-auth-payments-ai/template/babel.config.js +23 -0
  34. package/dist/templates/mobile/ui-auth-payments-ai/template/eas.json +45 -0
  35. package/dist/templates/mobile/ui-auth-payments-ai/template/expo-env.d.ts +3 -0
  36. package/dist/templates/mobile/ui-auth-payments-ai/template/jest-setup.ts +74 -0
  37. package/dist/templates/mobile/ui-auth-payments-ai/template/metro.config.js +11 -0
  38. package/dist/templates/mobile/ui-auth-payments-ai/template/package.json +108 -0
  39. package/dist/templates/mobile/ui-auth-payments-ai/template/tsconfig.json +31 -0
  40. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/README.md +655 -0
  41. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/app/(tabs)/ai.tsx +683 -0
  42. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/docs/MOBILE-SETUP.md +787 -0
  43. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +346 -0
  44. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/lib/rag/config.ts +180 -0
  45. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/package.json +113 -0
  46. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +599 -0
  47. package/dist/templates/web/base/template/src/app/loading.tsx +45 -27
  48. package/dist/templates/web/base/template/src/components/providers/app-providers.tsx +2 -0
  49. package/dist/templates/web/ui-auth/template/src/app/loading.tsx +30 -12
  50. package/dist/templates/web/ui-auth/template/src/components/providers/app-providers.tsx +2 -0
  51. package/dist/templates/web/ui-auth/template/src/components/shared/header.tsx +43 -2
  52. package/dist/templates/web/ui-auth-ai/template/package.json +1 -1
  53. package/dist/templates/web/ui-auth-payments/template/src/components/providers/app-providers.tsx +2 -0
  54. package/dist/templates/web/ui-auth-payments-ai/template/src/components/providers/app-providers.tsx +2 -0
  55. package/dist/templates/web/ui-auth-payments-ai-rag/template/README.md +434 -0
  56. package/dist/templates/web/ui-auth-payments-ai-rag/template/components/rag/KnowledgeManager.tsx +642 -0
  57. package/dist/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGAnalytics.tsx +466 -0
  58. package/dist/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGChatInterface.tsx +393 -0
  59. package/dist/templates/web/ui-auth-payments-ai-rag/template/docs/GETTING-STARTED.md +457 -0
  60. package/dist/templates/web/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +478 -0
  61. package/dist/templates/web/ui-auth-payments-ai-rag/template/lib/rag/config.ts +250 -0
  62. package/dist/templates/web/ui-auth-payments-ai-rag/template/package.json +74 -0
  63. package/dist/templates/web/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +622 -0
  64. package/dist/templates/web/ui-auth-payments-ai-rag/template/src/app/ai/page.tsx +396 -0
  65. package/dist/templates/web/ui-auth-payments-audio/template/src/components/providers/app-providers.tsx +2 -0
  66. package/dist/templates/web/ui-auth-payments-video/template/src/components/providers/app-providers.tsx +2 -0
  67. package/package.json +1 -1
  68. package/src/templates/mobile/base/template/App.tsx +2 -0
  69. package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/index.tsx +85 -4
  70. package/src/templates/mobile/ui-auth-payments/template/app/_layout.tsx +2 -0
  71. package/src/templates/mobile/ui-auth-payments-ai/template/.env.example +23 -0
  72. package/src/templates/mobile/ui-auth-payments-ai/template/README.md +254 -0
  73. package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/_layout.tsx +169 -0
  74. package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/ai.tsx +522 -0
  75. package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/analytics.tsx +668 -0
  76. package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/billing.tsx +743 -0
  77. package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/index.tsx +676 -0
  78. package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/orders.tsx +402 -0
  79. package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/profile.tsx +580 -0
  80. package/src/templates/mobile/ui-auth-payments-ai/template/app/_layout.tsx +127 -0
  81. package/src/templates/mobile/ui-auth-payments-ai/template/app/auth/login.tsx +246 -0
  82. package/src/templates/mobile/ui-auth-payments-ai/template/app/auth/signup.tsx +362 -0
  83. package/src/templates/mobile/ui-auth-payments-ai/template/app/onboarding/index.tsx +193 -0
  84. package/src/templates/mobile/ui-auth-payments-ai/template/app/tour/index.tsx +272 -0
  85. package/src/templates/mobile/ui-auth-payments-ai/template/app.json +93 -0
  86. package/src/templates/mobile/ui-auth-payments-ai/template/babel.config.js +23 -0
  87. package/src/templates/mobile/ui-auth-payments-ai/template/eas.json +45 -0
  88. package/src/templates/mobile/ui-auth-payments-ai/template/expo-env.d.ts +3 -0
  89. package/src/templates/mobile/ui-auth-payments-ai/template/jest-setup.ts +74 -0
  90. package/src/templates/mobile/ui-auth-payments-ai/template/metro.config.js +11 -0
  91. package/src/templates/mobile/ui-auth-payments-ai/template/package.json +108 -0
  92. package/src/templates/mobile/ui-auth-payments-ai/template/tsconfig.json +31 -0
  93. package/src/templates/mobile/ui-auth-payments-ai-rag/template/README.md +655 -0
  94. package/src/templates/mobile/ui-auth-payments-ai-rag/template/app/(tabs)/ai.tsx +683 -0
  95. package/src/templates/mobile/ui-auth-payments-ai-rag/template/docs/MOBILE-SETUP.md +787 -0
  96. package/src/templates/mobile/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +346 -0
  97. package/src/templates/mobile/ui-auth-payments-ai-rag/template/lib/rag/config.ts +180 -0
  98. package/src/templates/mobile/ui-auth-payments-ai-rag/template/package.json +113 -0
  99. package/src/templates/mobile/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +599 -0
  100. package/src/templates/web/base/template/src/app/loading.tsx +45 -27
  101. package/src/templates/web/base/template/src/components/providers/app-providers.tsx +2 -0
  102. package/src/templates/web/ui-auth/template/src/app/loading.tsx +30 -12
  103. package/src/templates/web/ui-auth/template/src/components/providers/app-providers.tsx +2 -0
  104. package/src/templates/web/ui-auth/template/src/components/shared/header.tsx +43 -2
  105. package/src/templates/web/ui-auth-ai/template/package.json +1 -1
  106. package/src/templates/web/ui-auth-payments/template/src/components/providers/app-providers.tsx +2 -0
  107. package/src/templates/web/ui-auth-payments-ai/template/src/components/providers/app-providers.tsx +2 -0
  108. package/src/templates/web/ui-auth-payments-ai-rag/template/README.md +434 -0
  109. package/src/templates/web/ui-auth-payments-ai-rag/template/components/rag/KnowledgeManager.tsx +642 -0
  110. package/src/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGAnalytics.tsx +466 -0
  111. package/src/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGChatInterface.tsx +393 -0
  112. package/src/templates/web/ui-auth-payments-ai-rag/template/docs/GETTING-STARTED.md +457 -0
  113. package/src/templates/web/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +478 -0
  114. package/src/templates/web/ui-auth-payments-ai-rag/template/lib/rag/config.ts +250 -0
  115. package/src/templates/web/ui-auth-payments-ai-rag/template/package.json +74 -0
  116. package/src/templates/web/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +622 -0
  117. package/src/templates/web/ui-auth-payments-ai-rag/template/src/app/ai/page.tsx +396 -0
  118. package/src/templates/web/ui-auth-payments-audio/template/src/components/providers/app-providers.tsx +2 -0
  119. package/src/templates/web/ui-auth-payments-video/template/src/components/providers/app-providers.tsx +2 -0
@@ -0,0 +1,668 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { View, Text, StyleSheet, ScrollView, Dimensions, RefreshControl, Animated } from 'react-native';
3
+ import { LinearGradient } from 'expo-linear-gradient';
4
+ import { BlurView } from 'expo-blur';
5
+ import * as Haptics from 'expo-haptics';
6
+
7
+ // UI Components
8
+ import {
9
+ NativeCard as Card,
10
+ NativeMobileContainer as MobileContainer,
11
+ NativeChart as Chart,
12
+ NativeStatCard as StatCard,
13
+ NativeButton as Button,
14
+ NativeSegmentedControl as SegmentedControl,
15
+ NativePageTransition as PageTransition,
16
+ NativeMobileHero as MobileHero,
17
+ NativePullToRefresh as PullToRefresh,
18
+ useTheme
19
+ } from '@digilogiclabs/saas-factory-ui/native';
20
+
21
+ // Icons
22
+ import {
23
+ TrendingUp,
24
+ TrendingDown,
25
+ Users,
26
+ ShoppingBag,
27
+ DollarSign,
28
+ Eye,
29
+ BarChart3,
30
+ PieChart,
31
+ Calendar
32
+ } from 'react-native-heroicons/outline';
33
+
34
+ const { width } = Dimensions.get('window');
35
+
36
+ interface AnalyticsData {
37
+ overview: {
38
+ revenue: { current: number; previous: number; change: number };
39
+ orders: { current: number; previous: number; change: number };
40
+ customers: { current: number; previous: number; change: number };
41
+ conversionRate: { current: number; previous: number; change: number };
42
+ };
43
+ chartData: {
44
+ revenue: Array<{ date: string; value: number }>;
45
+ orders: Array<{ date: string; value: number }>;
46
+ traffic: Array<{ date: string; value: number }>;
47
+ };
48
+ topProducts: Array<{
49
+ id: string;
50
+ name: string;
51
+ sales: number;
52
+ revenue: number;
53
+ }>;
54
+ }
55
+
56
+ const mockAnalyticsData: AnalyticsData = {
57
+ overview: {
58
+ revenue: { current: 12450, previous: 11200, change: 11.2 },
59
+ orders: { current: 156, previous: 142, change: 9.9 },
60
+ customers: { current: 1249, previous: 1180, change: 5.8 },
61
+ conversionRate: { current: 3.2, previous: 2.8, change: 14.3 }
62
+ },
63
+ chartData: {
64
+ revenue: [
65
+ { date: 'Jan 1', value: 1200 },
66
+ { date: 'Jan 8', value: 1800 },
67
+ { date: 'Jan 15', value: 2100 },
68
+ { date: 'Jan 22', value: 1600 },
69
+ { date: 'Jan 29', value: 2400 },
70
+ { date: 'Feb 5', value: 2800 },
71
+ { date: 'Feb 12', value: 1900 }
72
+ ],
73
+ orders: [
74
+ { date: 'Jan 1', value: 15 },
75
+ { date: 'Jan 8', value: 22 },
76
+ { date: 'Jan 15', value: 28 },
77
+ { date: 'Jan 22', value: 18 },
78
+ { date: 'Jan 29', value: 32 },
79
+ { date: 'Feb 5', value: 38 },
80
+ { date: 'Feb 12', value: 25 }
81
+ ],
82
+ traffic: [
83
+ { date: 'Jan 1', value: 450 },
84
+ { date: 'Jan 8', value: 680 },
85
+ { date: 'Jan 15', value: 820 },
86
+ { date: 'Jan 22', value: 590 },
87
+ { date: 'Jan 29', value: 920 },
88
+ { date: 'Feb 5', value: 1100 },
89
+ { date: 'Feb 12', value: 750 }
90
+ ]
91
+ },
92
+ topProducts: [
93
+ { id: '1', name: 'Premium Widget', sales: 45, revenue: 2250 },
94
+ { id: '2', name: 'Starter Kit', sales: 38, revenue: 1520 },
95
+ { id: '3', name: 'Pro Bundle', sales: 29, revenue: 1450 },
96
+ { id: '4', name: 'Basic Plan', sales: 52, revenue: 1040 }
97
+ ]
98
+ };
99
+
100
+ export default function AnalyticsScreen() {
101
+ const [data, setData] = useState<AnalyticsData>(mockAnalyticsData);
102
+ const [selectedPeriod, setSelectedPeriod] = useState<string>('7d');
103
+ const [selectedChart, setSelectedChart] = useState<string>('revenue');
104
+ const [loading, setLoading] = useState(false);
105
+ const [refreshing, setRefreshing] = useState(false);
106
+ const { theme, isDark } = useTheme();
107
+
108
+ // Animation values
109
+ const fadeAnim = useState(new Animated.Value(0))[0];
110
+ const slideAnim = useState(new Animated.Value(50))[0];
111
+
112
+ const periodOptions = [
113
+ { label: '7D', value: '7d' },
114
+ { label: '30D', value: '30d' },
115
+ { label: '90D', value: '90d' }
116
+ ];
117
+
118
+ const chartOptions = [
119
+ { label: 'Revenue', value: 'revenue' },
120
+ { label: 'Orders', value: 'orders' },
121
+ { label: 'Traffic', value: 'traffic' }
122
+ ];
123
+
124
+ useEffect(() => {
125
+ // Fetch analytics data based on selected period
126
+ fetchAnalyticsData();
127
+
128
+ // Entrance animations
129
+ Animated.parallel([
130
+ Animated.timing(fadeAnim, {
131
+ toValue: 1,
132
+ duration: 600,
133
+ useNativeDriver: true,
134
+ }),
135
+ Animated.spring(slideAnim, {
136
+ toValue: 0,
137
+ tension: 50,
138
+ friction: 8,
139
+ useNativeDriver: true,
140
+ }),
141
+ ]).start();
142
+ }, [selectedPeriod]);
143
+
144
+ const fetchAnalyticsData = async () => {
145
+ setLoading(true);
146
+ Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
147
+ // Simulate API call
148
+ await new Promise(resolve => setTimeout(resolve, 1000));
149
+ setLoading(false);
150
+ };
151
+
152
+ const onRefresh = async () => {
153
+ setRefreshing(true);
154
+ Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium);
155
+ await fetchAnalyticsData();
156
+ setRefreshing(false);
157
+ };
158
+
159
+ const renderStatCard = (
160
+ title: string,
161
+ icon: React.ReactNode,
162
+ current: number,
163
+ change: number,
164
+ format: 'currency' | 'number' | 'percentage' = 'number'
165
+ ) => {
166
+ const formatValue = (value: number) => {
167
+ switch (format) {
168
+ case 'currency':
169
+ return `$${value.toLocaleString()}`;
170
+ case 'percentage':
171
+ return `${value}%`;
172
+ default:
173
+ return value.toLocaleString();
174
+ }
175
+ };
176
+
177
+ const isPositive = change >= 0;
178
+ const TrendIcon = isPositive ? TrendingUp : TrendingDown;
179
+
180
+ return (
181
+ <StatCard
182
+ title={title}
183
+ value={formatValue(current)}
184
+ icon={icon}
185
+ change={`${isPositive ? '+' : ''}${change.toFixed(1)}%`}
186
+ changeType={isPositive ? 'positive' : 'negative'}
187
+ style={styles.statCard}
188
+ />
189
+ );
190
+ };
191
+
192
+ return (
193
+ <PageTransition type="fade">
194
+ <View style={styles.mainContainer}>
195
+ {/* Enhanced gradient background with floating elements */}
196
+ <LinearGradient
197
+ colors={isDark
198
+ ? ['#0F172A', '#1E293B', '#334155']
199
+ : ['#F8FAFC', '#E2E8F0', '#CBD5E1']
200
+ }
201
+ style={styles.gradientBackground}
202
+ />
203
+
204
+ {/* Floating animated elements */}
205
+ <Animated.View style={[styles.floatingElement, styles.element1, {
206
+ opacity: fadeAnim,
207
+ transform: [{ translateY: slideAnim }]
208
+ }]}>
209
+ <LinearGradient
210
+ colors={['rgba(139, 92, 246, 0.3)', 'rgba(79, 70, 229, 0.3)']}
211
+ style={styles.gradientOrb}
212
+ />
213
+ </Animated.View>
214
+
215
+ <Animated.View style={[styles.floatingElement, styles.element2, {
216
+ opacity: fadeAnim,
217
+ transform: [{ translateY: slideAnim }]
218
+ }]}>
219
+ <LinearGradient
220
+ colors={['rgba(16, 185, 129, 0.3)', 'rgba(5, 150, 105, 0.3)']}
221
+ style={styles.gradientOrb}
222
+ />
223
+ </Animated.View>
224
+
225
+ <Animated.View style={[styles.floatingElement, styles.element3, {
226
+ opacity: fadeAnim,
227
+ transform: [{ translateY: slideAnim }]
228
+ }]}>
229
+ <LinearGradient
230
+ colors={['rgba(59, 130, 246, 0.3)', 'rgba(37, 99, 235, 0.3)']}
231
+ style={styles.gradientOrb}
232
+ />
233
+ </Animated.View>
234
+
235
+ <PullToRefresh
236
+ onRefresh={onRefresh}
237
+ refreshing={refreshing}
238
+ >
239
+ <ScrollView
240
+ style={styles.scrollView}
241
+ showsVerticalScrollIndicator={false}
242
+ refreshControl={
243
+ <RefreshControl refreshing={refreshing} onRefresh={onRefresh} />
244
+ }
245
+ >
246
+ <MobileContainer style={styles.container}>
247
+ {/* Hero Section */}
248
+ <Animated.View style={{
249
+ opacity: fadeAnim,
250
+ transform: [{ translateY: slideAnim }]
251
+ }}>
252
+ <MobileHero
253
+ badge={{
254
+ text: "📊 Analytics Dashboard",
255
+ variant: "secondary"
256
+ }}
257
+ title={{
258
+ text: "Business Insights",
259
+ size: "lg"
260
+ }}
261
+ description="Track your performance with real-time analytics and detailed reports."
262
+ className="text-center mb-6"
263
+ />
264
+ </Animated.View>
265
+ {/* Period Selector with Glass Effect */}
266
+ <Animated.View style={[styles.periodSelector, {
267
+ opacity: fadeAnim,
268
+ transform: [{ translateY: slideAnim }]
269
+ }]}>
270
+ <BlurView intensity={20} style={styles.periodSelectorBlur}>
271
+ <SegmentedControl
272
+ options={periodOptions}
273
+ selectedValue={selectedPeriod}
274
+ onValueChange={setSelectedPeriod}
275
+ />
276
+ </BlurView>
277
+ </Animated.View>
278
+
279
+ {/* Overview Stats with Glass Cards */}
280
+ <Animated.View style={[styles.statsSection, {
281
+ opacity: fadeAnim,
282
+ transform: [{ translateY: slideAnim }]
283
+ }]}>
284
+ <Text style={styles.sectionTitle}>Overview</Text>
285
+ <View style={styles.statsGrid}>
286
+ {renderStatCard(
287
+ 'Revenue',
288
+ <DollarSign width={24} height={24} color="#10b981" />,
289
+ data.overview.revenue.current,
290
+ data.overview.revenue.change,
291
+ 'currency'
292
+ )}
293
+ {renderStatCard(
294
+ 'Orders',
295
+ <ShoppingBag width={24} height={24} color="#3b82f6" />,
296
+ data.overview.orders.current,
297
+ data.overview.orders.change
298
+ )}
299
+ {renderStatCard(
300
+ 'Customers',
301
+ <Users width={24} height={24} color="#f59e0b" />,
302
+ data.overview.customers.current,
303
+ data.overview.customers.change
304
+ )}
305
+ {renderStatCard(
306
+ 'Conversion',
307
+ <TrendingUp width={24} height={24} color="#ef4444" />,
308
+ data.overview.conversionRate.current,
309
+ data.overview.conversionRate.change,
310
+ 'percentage'
311
+ )}
312
+ </View>
313
+ </Animated.View>
314
+
315
+ {/* Chart Section with Glass Effect */}
316
+ <Animated.View style={{
317
+ opacity: fadeAnim,
318
+ transform: [{ translateY: slideAnim }]
319
+ }}>
320
+ <BlurView intensity={30} style={styles.chartCardBlur}>
321
+ <Card style={styles.chartCard}>
322
+ <View style={styles.chartHeader}>
323
+ <Text style={styles.chartTitle}>
324
+ {chartOptions.find(opt => opt.value === selectedChart)?.label} Trends
325
+ </Text>
326
+ <SegmentedControl
327
+ options={chartOptions}
328
+ selectedValue={selectedChart}
329
+ onValueChange={setSelectedChart}
330
+ size="sm"
331
+ />
332
+ </View>
333
+
334
+ <Chart
335
+ data={data.chartData[selectedChart as keyof typeof data.chartData]}
336
+ type="line"
337
+ xKey="date"
338
+ yKey="value"
339
+ height={200}
340
+ style={styles.chart}
341
+ loading={loading}
342
+ />
343
+ </Card>
344
+ </BlurView>
345
+ </Animated.View>
346
+
347
+ {/* Top Products with Glass Effect */}
348
+ <Animated.View style={{
349
+ opacity: fadeAnim,
350
+ transform: [{ translateY: slideAnim }]
351
+ }}>
352
+ <BlurView intensity={25} style={styles.topProductsBlur}>
353
+ <Card style={styles.topProductsCard}>
354
+ <View style={styles.cardHeader}>
355
+ <Text style={styles.cardTitle}>Top Products</Text>
356
+ <Button variant="ghost" size="sm">
357
+ <Eye width={16} height={16} />
358
+ <Text>View All</Text>
359
+ </Button>
360
+ </View>
361
+
362
+ <View style={styles.productsList}>
363
+ {data.topProducts.map((product, index) => (
364
+ <View key={product.id} style={styles.productItem}>
365
+ <View style={styles.productRank}>
366
+ <Text style={styles.rankNumber}>{index + 1}</Text>
367
+ </View>
368
+ <View style={styles.productInfo}>
369
+ <Text style={styles.productName}>{product.name}</Text>
370
+ <View style={styles.productStats}>
371
+ <Text style={styles.productSales}>{product.sales} sales</Text>
372
+ <Text style={styles.productRevenue}>
373
+ ${product.revenue.toLocaleString()}
374
+ </Text>
375
+ </View>
376
+ </View>
377
+ <View style={styles.productChart}>
378
+ <BarChart3 width={20} height={20} color="#64748b" />
379
+ </View>
380
+ </View>
381
+ ))}
382
+ </View>
383
+ </Card>
384
+ </BlurView>
385
+ </Animated.View>
386
+
387
+ {/* Additional Metrics with Glass Effect */}
388
+ <Animated.View style={[styles.additionalMetrics, {
389
+ opacity: fadeAnim,
390
+ transform: [{ translateY: slideAnim }]
391
+ }]}>
392
+ <BlurView intensity={20} style={[styles.metricCardBlur, { marginRight: 6 }]}>
393
+ <Card style={styles.metricCard}>
394
+ <View style={styles.metricHeader}>
395
+ <PieChart width={20} height={20} color="#3b82f6" />
396
+ <Text style={styles.metricTitle}>Traffic Sources</Text>
397
+ </View>
398
+ <View style={styles.metricValue}>
399
+ <Text style={styles.metricNumber}>68%</Text>
400
+ <Text style={styles.metricLabel}>Direct</Text>
401
+ </View>
402
+ </Card>
403
+ </BlurView>
404
+
405
+ <BlurView intensity={20} style={[styles.metricCardBlur, { marginLeft: 6 }]}>
406
+ <Card style={styles.metricCard}>
407
+ <View style={styles.metricHeader}>
408
+ <Calendar width={20} height={20} color="#10b981" />
409
+ <Text style={styles.metricTitle}>Avg. Order Value</Text>
410
+ </View>
411
+ <View style={styles.metricValue}>
412
+ <Text style={styles.metricNumber}>$79.85</Text>
413
+ <Text style={styles.metricLabel}>+12.5%</Text>
414
+ </View>
415
+ </Card>
416
+ </BlurView>
417
+ </Animated.View>
418
+
419
+ {/* Export Button with Glass Effect */}
420
+ <Animated.View style={{
421
+ opacity: fadeAnim,
422
+ transform: [{ translateY: slideAnim }]
423
+ }}>
424
+ <BlurView intensity={15} style={styles.exportButtonBlur}>
425
+ <Button
426
+ variant="outline"
427
+ style={styles.exportButton}
428
+ onPress={() => {
429
+ Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
430
+ }}
431
+ >
432
+ Export Analytics Report
433
+ </Button>
434
+ </BlurView>
435
+ </Animated.View>
436
+ </MobileContainer>
437
+ </ScrollView>
438
+ </PullToRefresh>
439
+ </View>
440
+ </PageTransition>
441
+ );
442
+ }
443
+
444
+ const styles = StyleSheet.create({
445
+ mainContainer: {
446
+ flex: 1,
447
+ backgroundColor: 'transparent',
448
+ },
449
+ gradientBackground: {
450
+ position: 'absolute',
451
+ left: 0,
452
+ right: 0,
453
+ top: 0,
454
+ bottom: 0,
455
+ },
456
+ floatingElement: {
457
+ position: 'absolute',
458
+ borderRadius: 100,
459
+ },
460
+ element1: {
461
+ top: 100,
462
+ right: 50,
463
+ width: 120,
464
+ height: 120,
465
+ },
466
+ element2: {
467
+ top: 300,
468
+ left: 30,
469
+ width: 80,
470
+ height: 80,
471
+ },
472
+ element3: {
473
+ bottom: 200,
474
+ right: 80,
475
+ width: 100,
476
+ height: 100,
477
+ },
478
+ gradientOrb: {
479
+ flex: 1,
480
+ borderRadius: 100,
481
+ },
482
+ scrollView: {
483
+ flex: 1,
484
+ backgroundColor: 'transparent',
485
+ },
486
+ container: {
487
+ padding: 16,
488
+ paddingBottom: 100,
489
+ },
490
+ periodSelector: {
491
+ marginBottom: 24,
492
+ },
493
+ periodSelectorBlur: {
494
+ borderRadius: 16,
495
+ overflow: 'hidden',
496
+ padding: 16,
497
+ backgroundColor: 'rgba(255, 255, 255, 0.1)',
498
+ },
499
+ statsSection: {
500
+ marginBottom: 24,
501
+ },
502
+ sectionTitle: {
503
+ fontSize: 20,
504
+ fontWeight: '700',
505
+ color: '#1e293b',
506
+ marginBottom: 16,
507
+ textAlign: 'center',
508
+ },
509
+ statsGrid: {
510
+ flexDirection: 'row',
511
+ flexWrap: 'wrap',
512
+ marginHorizontal: -8,
513
+ },
514
+ statCard: {
515
+ width: (width - 48) / 2,
516
+ marginHorizontal: 8,
517
+ marginBottom: 16,
518
+ },
519
+ chartCardBlur: {
520
+ borderRadius: 20,
521
+ overflow: 'hidden',
522
+ backgroundColor: 'rgba(255, 255, 255, 0.1)',
523
+ marginBottom: 16,
524
+ },
525
+ chartCard: {
526
+ padding: 20,
527
+ backgroundColor: 'transparent',
528
+ shadowOpacity: 0,
529
+ elevation: 0,
530
+ },
531
+ chartHeader: {
532
+ flexDirection: 'row',
533
+ justifyContent: 'space-between',
534
+ alignItems: 'center',
535
+ marginBottom: 20,
536
+ },
537
+ chartTitle: {
538
+ fontSize: 18,
539
+ fontWeight: '700',
540
+ color: '#1e293b',
541
+ },
542
+ chart: {
543
+ marginTop: 12,
544
+ },
545
+ topProductsBlur: {
546
+ borderRadius: 20,
547
+ overflow: 'hidden',
548
+ backgroundColor: 'rgba(255, 255, 255, 0.1)',
549
+ marginBottom: 16,
550
+ },
551
+ topProductsCard: {
552
+ padding: 20,
553
+ backgroundColor: 'transparent',
554
+ shadowOpacity: 0,
555
+ elevation: 0,
556
+ },
557
+ cardHeader: {
558
+ flexDirection: 'row',
559
+ justifyContent: 'space-between',
560
+ alignItems: 'center',
561
+ marginBottom: 20,
562
+ },
563
+ cardTitle: {
564
+ fontSize: 18,
565
+ fontWeight: '700',
566
+ color: '#1e293b',
567
+ },
568
+ productsList: {
569
+ gap: 12,
570
+ },
571
+ productItem: {
572
+ flexDirection: 'row',
573
+ alignItems: 'center',
574
+ paddingVertical: 8,
575
+ },
576
+ productRank: {
577
+ width: 32,
578
+ height: 32,
579
+ backgroundColor: '#f1f5f9',
580
+ borderRadius: 16,
581
+ alignItems: 'center',
582
+ justifyContent: 'center',
583
+ marginRight: 12,
584
+ },
585
+ rankNumber: {
586
+ fontSize: 14,
587
+ fontWeight: '600',
588
+ color: '#475569',
589
+ },
590
+ productInfo: {
591
+ flex: 1,
592
+ },
593
+ productName: {
594
+ fontSize: 14,
595
+ fontWeight: '500',
596
+ color: '#1e293b',
597
+ marginBottom: 2,
598
+ },
599
+ productStats: {
600
+ flexDirection: 'row',
601
+ gap: 12,
602
+ },
603
+ productSales: {
604
+ fontSize: 12,
605
+ color: '#64748b',
606
+ },
607
+ productRevenue: {
608
+ fontSize: 12,
609
+ fontWeight: '500',
610
+ color: '#10b981',
611
+ },
612
+ productChart: {
613
+ marginLeft: 12,
614
+ },
615
+ additionalMetrics: {
616
+ flexDirection: 'row',
617
+ gap: 12,
618
+ marginBottom: 24,
619
+ },
620
+ metricCardBlur: {
621
+ flex: 1,
622
+ borderRadius: 16,
623
+ overflow: 'hidden',
624
+ backgroundColor: 'rgba(255, 255, 255, 0.1)',
625
+ },
626
+ metricCard: {
627
+ flex: 1,
628
+ padding: 20,
629
+ backgroundColor: 'transparent',
630
+ shadowOpacity: 0,
631
+ elevation: 0,
632
+ },
633
+ metricHeader: {
634
+ flexDirection: 'row',
635
+ alignItems: 'center',
636
+ gap: 8,
637
+ marginBottom: 16,
638
+ },
639
+ metricTitle: {
640
+ fontSize: 14,
641
+ fontWeight: '600',
642
+ color: '#64748b',
643
+ },
644
+ metricValue: {
645
+ alignItems: 'flex-start',
646
+ },
647
+ metricNumber: {
648
+ fontSize: 24,
649
+ fontWeight: '800',
650
+ color: '#1e293b',
651
+ marginBottom: 4,
652
+ },
653
+ metricLabel: {
654
+ fontSize: 12,
655
+ fontWeight: '600',
656
+ color: '#10b981',
657
+ },
658
+ exportButtonBlur: {
659
+ borderRadius: 16,
660
+ overflow: 'hidden',
661
+ backgroundColor: 'rgba(255, 255, 255, 0.1)',
662
+ marginTop: 8,
663
+ },
664
+ exportButton: {
665
+ margin: 16,
666
+ backgroundColor: 'transparent',
667
+ },
668
+ });