create-bluecopa-react-app 1.0.4 → 1.0.5

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 (31) hide show
  1. package/package.json +1 -1
  2. package/templates/latest/AGENT.md +13 -15
  3. package/templates/latest/README.md +2 -2
  4. package/templates/latest/clean.sh +1 -0
  5. package/templates/latest/setup.sh +5 -4
  6. package/templates/latest/src/App.tsx +11 -7
  7. package/templates/latest/src/components/charts/AreaChart.tsx +80 -0
  8. package/templates/latest/src/components/charts/DonutChart.tsx +73 -0
  9. package/templates/latest/src/components/charts/SparkAreaChart.tsx +52 -0
  10. package/templates/latest/src/components/layout/dashboard-header.tsx +1 -1
  11. package/templates/latest/src/components/layout/dashboard-layout.tsx +19 -11
  12. package/templates/latest/src/components/{page → layout}/navbar.tsx +2 -0
  13. package/templates/latest/src/components/layout/sidebar.tsx +2 -1
  14. package/templates/latest/src/components/page/dashboard/DashboardMetrics.tsx +97 -0
  15. package/templates/latest/src/components/page/dashboard/PaymentMethodsAnalysis.tsx +182 -0
  16. package/templates/latest/src/components/page/dashboard/RevenueAnalytics.tsx +505 -0
  17. package/templates/latest/src/components/page/dashboard/SalesAnalytics.tsx +313 -0
  18. package/templates/latest/src/components/page/dashboard/TransactionsTable.tsx +256 -0
  19. package/templates/latest/src/components/page/dashboard/dashboard-utils.ts +147 -0
  20. package/templates/latest/src/components/page/dashboard/dashboard.tsx +185 -0
  21. package/templates/latest/src/components/ui/bluecopa-logo.tsx +3 -0
  22. package/templates/latest/src/components/ui/label.tsx +0 -2
  23. package/templates/latest/src/components/ui/select.tsx +0 -2
  24. package/templates/latest/src/pages/Dashboard.tsx +1 -1
  25. package/templates/latest/src/single-spa.tsx +38 -28
  26. package/templates/latest/tailwind.config.js +1 -2
  27. package/templates/latest/tsconfig.app.json +6 -0
  28. package/templates/latest/tsconfig.json +6 -6
  29. package/templates/latest/tsconfig.node.json +5 -1
  30. package/templates/latest/vite.config.ts +1 -1
  31. package/templates/latest/src/components/page/dashboard.tsx +0 -1506
@@ -0,0 +1,182 @@
1
+ import React from 'react';
2
+ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
3
+ import { Badge } from '@/components/ui/badge';
4
+ import { DollarSign } from 'lucide-react';
5
+ import {
6
+ ResponsiveContainer,
7
+ PieChart,
8
+ Pie,
9
+ Cell,
10
+ Tooltip,
11
+ Legend
12
+ } from 'recharts';
13
+ import { DonutChart } from '@/components/charts/DonutChart';
14
+
15
+ interface PaymentMethodsAnalysisProps {
16
+ paymentMethodData: any[];
17
+ }
18
+
19
+ export const PaymentMethodsAnalysis: React.FC<PaymentMethodsAnalysisProps> = ({
20
+ paymentMethodData
21
+ }) => {
22
+ // Process data for charts
23
+ const donutChartData = paymentMethodData.map((item: any) => ({
24
+ method: item.method,
25
+ count: item.count
26
+ }));
27
+
28
+ const pieChartData = paymentMethodData.map((item: any) => ({
29
+ name: item.method,
30
+ value: item.total,
31
+ count: item.count,
32
+ percentage: Math.round((item.total / paymentMethodData.reduce((sum: number, m: any) => sum + m.total, 0)) * 100)
33
+ }));
34
+
35
+ return (
36
+ <div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
37
+ {/* Enhanced Payment Method Distribution */}
38
+ <Card>
39
+ <CardHeader className="pb-4">
40
+ <div className="flex items-center justify-between">
41
+ <div>
42
+ <CardTitle className="text-lg font-bold">Payment Methods</CardTitle>
43
+ <CardDescription className="text-sm text-gray-600">
44
+ Transaction distribution by payment type
45
+ </CardDescription>
46
+ </div>
47
+ <Badge variant="outline" className="text-blue-600 border-blue-200">
48
+ {paymentMethodData.length} Methods
49
+ </Badge>
50
+ </div>
51
+ </CardHeader>
52
+ <CardContent>
53
+ {paymentMethodData.length > 0 ? (
54
+ <div className="space-y-6">
55
+ {/* Enhanced Payment Method Donut Chart */}
56
+ <div className="relative bg-gradient-to-br from-blue-50 to-indigo-50 p-6 rounded-lg border border-blue-100">
57
+ <h3 className="text-sm font-semibold text-blue-800 mb-4 text-center">Payment Distribution</h3>
58
+ <div className="h-80">
59
+ <ResponsiveContainer width="100%" height="100%">
60
+ <PieChart>
61
+ <defs>
62
+ <filter id="shadow" height="130%">
63
+ <feDropShadow dx="2" dy="2" stdDeviation="3" floodOpacity="0.2"/>
64
+ </filter>
65
+ </defs>
66
+ <Pie
67
+ data={pieChartData}
68
+ cx="50%"
69
+ cy="50%"
70
+ labelLine={false}
71
+ label={({ name, percentage }: any) => `${name}: ${percentage}%`}
72
+ outerRadius={100}
73
+ innerRadius={60}
74
+ paddingAngle={5}
75
+ dataKey="value"
76
+ filter="url(#shadow)"
77
+ >
78
+ {paymentMethodData.map((_entry: any, index: number) => {
79
+ const colors = ['#3B82F6', '#10B981', '#8B5CF6', '#F59E0B', '#F43F5E', '#06B6D4'];
80
+ return (
81
+ <Cell
82
+ key={`cell-${index}`}
83
+ fill={colors[index % colors.length]}
84
+ stroke="#fff"
85
+ strokeWidth={2}
86
+ />
87
+ );
88
+ })}
89
+ </Pie>
90
+ <Tooltip
91
+ formatter={(value: any, name: string, props: any) => [
92
+ `$${value.toLocaleString()}`,
93
+ `${name} (${props.payload.count} transactions)`
94
+ ]}
95
+ labelStyle={{ color: '#374151', fontWeight: 'bold' }}
96
+ contentStyle={{
97
+ backgroundColor: '#fff',
98
+ border: '1px solid #e5e7eb',
99
+ borderRadius: '8px',
100
+ boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1)'
101
+ }}
102
+ />
103
+ <Legend
104
+ verticalAlign="bottom"
105
+ height={36}
106
+ iconType="circle"
107
+ wrapperStyle={{ fontSize: '12px', paddingTop: '20px' }}
108
+ />
109
+ </PieChart>
110
+ </ResponsiveContainer>
111
+ </div>
112
+ </div>
113
+
114
+ {/* Enhanced Payment Method Details */}
115
+ <div className="space-y-3">
116
+ <h3 className="text-sm font-semibold text-gray-700">Payment Method Breakdown</h3>
117
+ {paymentMethodData.map((method: any, index: number) => {
118
+ const colors = ['bg-blue-500', 'bg-emerald-500', 'bg-violet-500', 'bg-amber-500', 'bg-rose-500', 'bg-cyan-500'];
119
+ const textColors = ['text-blue-600', 'text-emerald-600', 'text-violet-600', 'text-amber-600', 'text-rose-600', 'text-cyan-600'];
120
+ const bgColors = ['bg-blue-50', 'bg-emerald-50', 'bg-violet-50', 'bg-amber-50', 'bg-rose-50', 'bg-cyan-50'];
121
+ const percentage = Math.round((method.total / paymentMethodData.reduce((sum: number, m: any) => sum + m.total, 0)) * 100);
122
+
123
+ return (
124
+ <div key={index} className={`flex items-center justify-between p-4 rounded-lg border hover:shadow-sm transition-all ${bgColors[index] || 'bg-gray-50'}`}>
125
+ <div className="flex items-center space-x-4">
126
+ <div className={`w-4 h-4 rounded-full ${colors[index] || 'bg-gray-400'}`} />
127
+ <div>
128
+ <div className="font-semibold text-gray-900">{method.method}</div>
129
+ <div className="text-sm text-gray-500">{method.count} transactions</div>
130
+ </div>
131
+ </div>
132
+ <div className="text-right">
133
+ <div className={`text-lg font-bold ${textColors[index] || 'text-gray-600'}`}>
134
+ ${method.total.toLocaleString()}
135
+ </div>
136
+ <div className="text-sm text-gray-500">{percentage}% of total</div>
137
+ <div className="w-20 bg-gray-200 rounded-full h-1.5 mt-1">
138
+ <div
139
+ className={`h-1.5 rounded-full ${colors[index] || 'bg-gray-400'}`}
140
+ style={{ width: `${percentage}%` }}
141
+ />
142
+ </div>
143
+ </div>
144
+ </div>
145
+ );
146
+ })}
147
+ </div>
148
+ </div>
149
+ ) : (
150
+ <div className="text-center text-gray-500 py-12">
151
+ <DollarSign className="h-12 w-12 mx-auto text-gray-300 mb-4" />
152
+ <p className="text-lg font-medium">No payment data available</p>
153
+ <p className="text-sm">Process payments to see distribution</p>
154
+ </div>
155
+ )}
156
+ </CardContent>
157
+ </Card>
158
+
159
+ {/* Payment Method Distribution */}
160
+ <Card>
161
+ <CardHeader>
162
+ <CardTitle>Payment Method Distribution</CardTitle>
163
+ <CardDescription>
164
+ Transaction count by payment method
165
+ </CardDescription>
166
+ </CardHeader>
167
+ <CardContent>
168
+ <DonutChart
169
+ className="h-64"
170
+ data={donutChartData}
171
+ category="count"
172
+ index="method"
173
+ valueFormatter={(number: number) =>
174
+ `${number} transactions`
175
+ }
176
+ colors={["emerald", "blue", "violet", "rose", "amber"]}
177
+ />
178
+ </CardContent>
179
+ </Card>
180
+ </div>
181
+ );
182
+ };