create-bluecopa-react-app 1.0.41 → 1.0.43
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.
- package/README.md +7 -5
- package/package.json +1 -1
- package/templates/latest/.claude/settings.local.json +56 -0
- package/templates/latest/.env.example +8 -0
- package/templates/latest/Agent.md +598 -775
- package/templates/latest/CLAUDE.md +759 -0
- package/templates/latest/README.md +11 -2
- package/templates/latest/app/app.css +292 -85
- package/templates/latest/app/app.tsx +48 -39
- package/templates/latest/app/components/bluecopa-logo.tsx +20 -0
- package/templates/latest/app/components/charts/bar-chart.tsx +132 -0
- package/templates/latest/app/components/charts/base-chart.tsx +149 -0
- package/templates/latest/app/components/charts/chart-provider.tsx +71 -0
- package/templates/latest/app/components/charts/chart-theme.ts +262 -0
- package/templates/latest/app/components/charts/chart-utils.ts +142 -0
- package/templates/latest/app/components/charts/donut-chart.tsx +110 -0
- package/templates/latest/app/components/charts/index.ts +5 -0
- package/templates/latest/app/components/layouts/app-layout.tsx +22 -0
- package/templates/latest/app/components/layouts/app-sidebar.tsx +88 -0
- package/templates/latest/app/components/layouts/nav-main.tsx +50 -0
- package/templates/latest/app/components/layouts/nav-user.tsx +38 -0
- package/templates/latest/app/components/layouts/site-header.tsx +93 -0
- package/templates/latest/app/components/loading-screen.tsx +41 -0
- package/templates/latest/app/components/ui/ag-grid-table.tsx +79 -0
- package/templates/latest/app/components/ui/button.tsx +23 -23
- package/templates/latest/app/components/ui/card.tsx +20 -20
- package/templates/latest/app/components/ui/dropdown-menu.tsx +54 -49
- package/templates/latest/app/components/ui/input.tsx +8 -8
- package/templates/latest/app/components/ui/label.tsx +8 -8
- package/templates/latest/app/components/ui/separator.tsx +7 -7
- package/templates/latest/app/components/ui/sheet.tsx +43 -32
- package/templates/latest/app/components/ui/sidebar.tsx +240 -235
- package/templates/latest/app/components/ui/skeleton.tsx +4 -4
- package/templates/latest/app/components/ui/sonner.tsx +6 -9
- package/templates/latest/app/components/ui/tabs.tsx +15 -15
- package/templates/latest/app/components/ui/tooltip.tsx +18 -12
- package/templates/latest/app/constants/index.ts +31 -0
- package/templates/latest/app/contexts/app-context.tsx +201 -0
- package/templates/latest/app/hooks/use-mobile.ts +13 -12
- package/templates/latest/app/main.tsx +1 -1
- package/templates/latest/app/pages/dashboard.tsx +246 -0
- package/templates/latest/app/pages/payments.tsx +182 -0
- package/templates/latest/app/pages/settings.tsx +128 -0
- package/templates/latest/app/routes/index.tsx +19 -0
- package/templates/latest/app/single-spa.tsx +69 -186
- package/templates/latest/app/types/index.ts +37 -0
- package/templates/latest/app/utils/ag-grid-datasource.ts +63 -0
- package/templates/latest/app/utils/ag-grid-license.ts +12 -0
- package/templates/latest/app/utils/ag-grid-theme.ts +9 -0
- package/templates/latest/app/utils/component-style.ts +7 -0
- package/templates/latest/app/utils/style-drivers.ts +24 -0
- package/templates/latest/app/utils/utils.ts +10 -0
- package/templates/latest/components.json +3 -3
- package/templates/latest/index.html +30 -2
- package/templates/latest/package-lock.json +2717 -955
- package/templates/latest/package.json +19 -21
- package/templates/latest/preview/index.html +125 -285
- package/templates/latest/public/favicon.svg +1 -0
- package/templates/latest/vite.config.ts +2 -8
- package/templates/latest/app/components/app-sidebar.tsx +0 -182
- package/templates/latest/app/components/chart-area-interactive.tsx +0 -290
- package/templates/latest/app/components/data-table.tsx +0 -807
- package/templates/latest/app/components/nav-documents.tsx +0 -92
- package/templates/latest/app/components/nav-main.tsx +0 -40
- package/templates/latest/app/components/nav-secondary.tsx +0 -42
- package/templates/latest/app/components/nav-user.tsx +0 -111
- package/templates/latest/app/components/section-cards.tsx +0 -102
- package/templates/latest/app/components/site-header.tsx +0 -28
- package/templates/latest/app/components/ui/avatar.tsx +0 -53
- package/templates/latest/app/components/ui/badge.tsx +0 -46
- package/templates/latest/app/components/ui/breadcrumb.tsx +0 -109
- package/templates/latest/app/components/ui/chart.tsx +0 -352
- package/templates/latest/app/components/ui/checkbox.tsx +0 -30
- package/templates/latest/app/components/ui/drawer.tsx +0 -139
- package/templates/latest/app/components/ui/select.tsx +0 -183
- package/templates/latest/app/components/ui/table.tsx +0 -117
- package/templates/latest/app/components/ui/toggle-group.tsx +0 -73
- package/templates/latest/app/components/ui/toggle.tsx +0 -47
- package/templates/latest/app/data/data.json +0 -614
- package/templates/latest/app/data/mock-payments.json +0 -122
- package/templates/latest/app/data/mock-transactions.json +0 -128
- package/templates/latest/app/hooks/use-bluecopa-user.ts +0 -37
- package/templates/latest/app/lib/utils.ts +0 -6
- package/templates/latest/app/routes/apitest.tsx +0 -2118
- package/templates/latest/app/routes/comments.tsx +0 -588
- package/templates/latest/app/routes/dashboard.tsx +0 -36
- package/templates/latest/app/routes/payments.tsx +0 -342
- package/templates/latest/app/routes/statements.tsx +0 -493
- package/templates/latest/app/routes/websocket.tsx +0 -450
- package/templates/latest/app/routes.tsx +0 -22
- package/templates/latest/dist/assets/__federation_expose_App-D-lv9y21.js +0 -161
- package/templates/latest/dist/assets/__federation_fn_import-CzfA7kmP.js +0 -438
- package/templates/latest/dist/assets/__federation_shared_react-Bp6HVBS4.js +0 -16
- package/templates/latest/dist/assets/__federation_shared_react-dom-BCcRGiYp.js +0 -17
- package/templates/latest/dist/assets/client-Dms8K6Dw.js +0 -78879
- package/templates/latest/dist/assets/index-BrhXrqF7.js +0 -60
- package/templates/latest/dist/assets/index-BzNimew1.js +0 -69
- package/templates/latest/dist/assets/index-DMFtQdNS.js +0 -412
- package/templates/latest/dist/assets/remoteEntry.css +0 -3996
- package/templates/latest/dist/assets/remoteEntry.js +0 -88
- package/templates/latest/dist/favicon.ico +0 -0
- package/templates/latest/dist/index.html +0 -19
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import {
|
|
3
|
-
IconCamera,
|
|
4
|
-
IconChartBar,
|
|
5
|
-
IconCreditCard,
|
|
6
|
-
IconDashboard,
|
|
7
|
-
IconDatabase,
|
|
8
|
-
IconFileAi,
|
|
9
|
-
IconMessageCircle,
|
|
10
|
-
IconPlug,
|
|
11
|
-
IconFileDescription,
|
|
12
|
-
IconFileWord,
|
|
13
|
-
IconFolder,
|
|
14
|
-
IconHelp,
|
|
15
|
-
IconInnerShadowTop,
|
|
16
|
-
IconListDetails,
|
|
17
|
-
IconReport,
|
|
18
|
-
IconSearch,
|
|
19
|
-
IconSettings,
|
|
20
|
-
IconUsers,
|
|
21
|
-
} from "@tabler/icons-react"
|
|
22
|
-
|
|
23
|
-
import { NavDocuments } from "~/components/nav-documents"
|
|
24
|
-
import { NavMain } from "~/components/nav-main"
|
|
25
|
-
import { NavSecondary } from "~/components/nav-secondary"
|
|
26
|
-
import { NavUser } from "~/components/nav-user"
|
|
27
|
-
import {
|
|
28
|
-
Sidebar,
|
|
29
|
-
SidebarContent,
|
|
30
|
-
SidebarFooter,
|
|
31
|
-
SidebarHeader,
|
|
32
|
-
SidebarMenu,
|
|
33
|
-
SidebarMenuButton,
|
|
34
|
-
SidebarMenuItem,
|
|
35
|
-
} from "~/components/ui/sidebar"
|
|
36
|
-
|
|
37
|
-
const data = {
|
|
38
|
-
navMain: [
|
|
39
|
-
{
|
|
40
|
-
title: "Dashboard",
|
|
41
|
-
url: "/",
|
|
42
|
-
icon: IconDashboard,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
title: "Comments",
|
|
46
|
-
url: "/comments",
|
|
47
|
-
icon: IconMessageCircle,
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
title: "WebSocket",
|
|
51
|
-
url: "/websocket",
|
|
52
|
-
icon: IconPlug,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
title: "Payments",
|
|
56
|
-
url: "/payments",
|
|
57
|
-
icon: IconCreditCard,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
title: "Statements",
|
|
61
|
-
url: "/statements",
|
|
62
|
-
icon: IconFileDescription,
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
title: "API Test",
|
|
66
|
-
url: "/apitest",
|
|
67
|
-
icon: IconPlug,
|
|
68
|
-
}
|
|
69
|
-
],
|
|
70
|
-
navClouds: [
|
|
71
|
-
{
|
|
72
|
-
title: "Capture",
|
|
73
|
-
icon: IconCamera,
|
|
74
|
-
isActive: true,
|
|
75
|
-
url: "#",
|
|
76
|
-
items: [
|
|
77
|
-
{
|
|
78
|
-
title: "Active Proposals",
|
|
79
|
-
url: "#",
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
title: "Archived",
|
|
83
|
-
url: "#",
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
title: "Proposal",
|
|
89
|
-
icon: IconFileDescription,
|
|
90
|
-
url: "#",
|
|
91
|
-
items: [
|
|
92
|
-
{
|
|
93
|
-
title: "Active Proposals",
|
|
94
|
-
url: "#",
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
title: "Archived",
|
|
98
|
-
url: "#",
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
title: "Prompts",
|
|
104
|
-
icon: IconFileAi,
|
|
105
|
-
url: "#",
|
|
106
|
-
items: [
|
|
107
|
-
{
|
|
108
|
-
title: "Active Proposals",
|
|
109
|
-
url: "#",
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
title: "Archived",
|
|
113
|
-
url: "#",
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
},
|
|
117
|
-
],
|
|
118
|
-
navSecondary: [
|
|
119
|
-
{
|
|
120
|
-
title: "Settings",
|
|
121
|
-
url: "#",
|
|
122
|
-
icon: IconSettings,
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
title: "Get Help",
|
|
126
|
-
url: "#",
|
|
127
|
-
icon: IconHelp,
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
title: "Search",
|
|
131
|
-
url: "#",
|
|
132
|
-
icon: IconSearch,
|
|
133
|
-
},
|
|
134
|
-
],
|
|
135
|
-
documents: [
|
|
136
|
-
{
|
|
137
|
-
name: "Data Library",
|
|
138
|
-
url: "#",
|
|
139
|
-
icon: IconDatabase,
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
name: "Reports",
|
|
143
|
-
url: "#",
|
|
144
|
-
icon: IconReport,
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
name: "Word Assistant",
|
|
148
|
-
url: "#",
|
|
149
|
-
icon: IconFileWord,
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
|
|
155
|
-
return (
|
|
156
|
-
<Sidebar collapsible="offcanvas" {...props}>
|
|
157
|
-
<SidebarHeader>
|
|
158
|
-
<SidebarMenu>
|
|
159
|
-
<SidebarMenuItem>
|
|
160
|
-
<SidebarMenuButton
|
|
161
|
-
asChild
|
|
162
|
-
className="data-[slot=sidebar-menu-button]:!p-1.5"
|
|
163
|
-
>
|
|
164
|
-
<a href="https://bluecopa.com">
|
|
165
|
-
<IconInnerShadowTop className="!size-5" />
|
|
166
|
-
<span className="text-base font-semibold">Bluecopa</span>
|
|
167
|
-
</a>
|
|
168
|
-
</SidebarMenuButton>
|
|
169
|
-
</SidebarMenuItem>
|
|
170
|
-
</SidebarMenu>
|
|
171
|
-
</SidebarHeader>
|
|
172
|
-
<SidebarContent>
|
|
173
|
-
<NavMain items={data.navMain} />
|
|
174
|
-
<NavDocuments items={data.documents} />
|
|
175
|
-
<NavSecondary items={data.navSecondary} className="mt-auto" />
|
|
176
|
-
</SidebarContent>
|
|
177
|
-
<SidebarFooter>
|
|
178
|
-
<NavUser />
|
|
179
|
-
</SidebarFooter>
|
|
180
|
-
</Sidebar>
|
|
181
|
-
)
|
|
182
|
-
}
|
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import { Area, AreaChart, CartesianGrid, XAxis } from "recharts"
|
|
5
|
-
|
|
6
|
-
import { useIsMobile } from "~/hooks/use-mobile"
|
|
7
|
-
import {
|
|
8
|
-
Card,
|
|
9
|
-
CardAction,
|
|
10
|
-
CardContent,
|
|
11
|
-
CardDescription,
|
|
12
|
-
CardHeader,
|
|
13
|
-
CardTitle,
|
|
14
|
-
} from "~/components/ui/card"
|
|
15
|
-
import {
|
|
16
|
-
ChartContainer,
|
|
17
|
-
ChartTooltip,
|
|
18
|
-
ChartTooltipContent,
|
|
19
|
-
} from "~/components/ui/chart"
|
|
20
|
-
import {
|
|
21
|
-
Select,
|
|
22
|
-
SelectContent,
|
|
23
|
-
SelectItem,
|
|
24
|
-
SelectTrigger,
|
|
25
|
-
SelectValue,
|
|
26
|
-
} from "~/components/ui/select"
|
|
27
|
-
import {
|
|
28
|
-
ToggleGroup,
|
|
29
|
-
ToggleGroupItem,
|
|
30
|
-
} from "~/components/ui/toggle-group"
|
|
31
|
-
|
|
32
|
-
export const description = "An interactive area chart"
|
|
33
|
-
|
|
34
|
-
const chartData = [
|
|
35
|
-
{ date: "2024-04-01", desktop: 222, mobile: 150 },
|
|
36
|
-
{ date: "2024-04-02", desktop: 97, mobile: 180 },
|
|
37
|
-
{ date: "2024-04-03", desktop: 167, mobile: 120 },
|
|
38
|
-
{ date: "2024-04-04", desktop: 242, mobile: 260 },
|
|
39
|
-
{ date: "2024-04-05", desktop: 373, mobile: 290 },
|
|
40
|
-
{ date: "2024-04-06", desktop: 301, mobile: 340 },
|
|
41
|
-
{ date: "2024-04-07", desktop: 245, mobile: 180 },
|
|
42
|
-
{ date: "2024-04-08", desktop: 409, mobile: 320 },
|
|
43
|
-
{ date: "2024-04-09", desktop: 59, mobile: 110 },
|
|
44
|
-
{ date: "2024-04-10", desktop: 261, mobile: 190 },
|
|
45
|
-
{ date: "2024-04-11", desktop: 327, mobile: 350 },
|
|
46
|
-
{ date: "2024-04-12", desktop: 292, mobile: 210 },
|
|
47
|
-
{ date: "2024-04-13", desktop: 342, mobile: 380 },
|
|
48
|
-
{ date: "2024-04-14", desktop: 137, mobile: 220 },
|
|
49
|
-
{ date: "2024-04-15", desktop: 120, mobile: 170 },
|
|
50
|
-
{ date: "2024-04-16", desktop: 138, mobile: 190 },
|
|
51
|
-
{ date: "2024-04-17", desktop: 446, mobile: 360 },
|
|
52
|
-
{ date: "2024-04-18", desktop: 364, mobile: 410 },
|
|
53
|
-
{ date: "2024-04-19", desktop: 243, mobile: 180 },
|
|
54
|
-
{ date: "2024-04-20", desktop: 89, mobile: 150 },
|
|
55
|
-
{ date: "2024-04-21", desktop: 137, mobile: 200 },
|
|
56
|
-
{ date: "2024-04-22", desktop: 224, mobile: 170 },
|
|
57
|
-
{ date: "2024-04-23", desktop: 138, mobile: 230 },
|
|
58
|
-
{ date: "2024-04-24", desktop: 387, mobile: 290 },
|
|
59
|
-
{ date: "2024-04-25", desktop: 215, mobile: 250 },
|
|
60
|
-
{ date: "2024-04-26", desktop: 75, mobile: 130 },
|
|
61
|
-
{ date: "2024-04-27", desktop: 383, mobile: 420 },
|
|
62
|
-
{ date: "2024-04-28", desktop: 122, mobile: 180 },
|
|
63
|
-
{ date: "2024-04-29", desktop: 315, mobile: 240 },
|
|
64
|
-
{ date: "2024-04-30", desktop: 454, mobile: 380 },
|
|
65
|
-
{ date: "2024-05-01", desktop: 165, mobile: 220 },
|
|
66
|
-
{ date: "2024-05-02", desktop: 293, mobile: 310 },
|
|
67
|
-
{ date: "2024-05-03", desktop: 247, mobile: 190 },
|
|
68
|
-
{ date: "2024-05-04", desktop: 385, mobile: 420 },
|
|
69
|
-
{ date: "2024-05-05", desktop: 481, mobile: 390 },
|
|
70
|
-
{ date: "2024-05-06", desktop: 498, mobile: 520 },
|
|
71
|
-
{ date: "2024-05-07", desktop: 388, mobile: 300 },
|
|
72
|
-
{ date: "2024-05-08", desktop: 149, mobile: 210 },
|
|
73
|
-
{ date: "2024-05-09", desktop: 227, mobile: 180 },
|
|
74
|
-
{ date: "2024-05-10", desktop: 293, mobile: 330 },
|
|
75
|
-
{ date: "2024-05-11", desktop: 335, mobile: 270 },
|
|
76
|
-
{ date: "2024-05-12", desktop: 197, mobile: 240 },
|
|
77
|
-
{ date: "2024-05-13", desktop: 197, mobile: 160 },
|
|
78
|
-
{ date: "2024-05-14", desktop: 448, mobile: 490 },
|
|
79
|
-
{ date: "2024-05-15", desktop: 473, mobile: 380 },
|
|
80
|
-
{ date: "2024-05-16", desktop: 338, mobile: 400 },
|
|
81
|
-
{ date: "2024-05-17", desktop: 499, mobile: 420 },
|
|
82
|
-
{ date: "2024-05-18", desktop: 315, mobile: 350 },
|
|
83
|
-
{ date: "2024-05-19", desktop: 235, mobile: 180 },
|
|
84
|
-
{ date: "2024-05-20", desktop: 177, mobile: 230 },
|
|
85
|
-
{ date: "2024-05-21", desktop: 82, mobile: 140 },
|
|
86
|
-
{ date: "2024-05-22", desktop: 81, mobile: 120 },
|
|
87
|
-
{ date: "2024-05-23", desktop: 252, mobile: 290 },
|
|
88
|
-
{ date: "2024-05-24", desktop: 294, mobile: 220 },
|
|
89
|
-
{ date: "2024-05-25", desktop: 201, mobile: 250 },
|
|
90
|
-
{ date: "2024-05-26", desktop: 213, mobile: 170 },
|
|
91
|
-
{ date: "2024-05-27", desktop: 420, mobile: 460 },
|
|
92
|
-
{ date: "2024-05-28", desktop: 233, mobile: 190 },
|
|
93
|
-
{ date: "2024-05-29", desktop: 78, mobile: 130 },
|
|
94
|
-
{ date: "2024-05-30", desktop: 340, mobile: 280 },
|
|
95
|
-
{ date: "2024-05-31", desktop: 178, mobile: 230 },
|
|
96
|
-
{ date: "2024-06-01", desktop: 178, mobile: 200 },
|
|
97
|
-
{ date: "2024-06-02", desktop: 470, mobile: 410 },
|
|
98
|
-
{ date: "2024-06-03", desktop: 103, mobile: 160 },
|
|
99
|
-
{ date: "2024-06-04", desktop: 439, mobile: 380 },
|
|
100
|
-
{ date: "2024-06-05", desktop: 88, mobile: 140 },
|
|
101
|
-
{ date: "2024-06-06", desktop: 294, mobile: 250 },
|
|
102
|
-
{ date: "2024-06-07", desktop: 323, mobile: 370 },
|
|
103
|
-
{ date: "2024-06-08", desktop: 385, mobile: 320 },
|
|
104
|
-
{ date: "2024-06-09", desktop: 438, mobile: 480 },
|
|
105
|
-
{ date: "2024-06-10", desktop: 155, mobile: 200 },
|
|
106
|
-
{ date: "2024-06-11", desktop: 92, mobile: 150 },
|
|
107
|
-
{ date: "2024-06-12", desktop: 492, mobile: 420 },
|
|
108
|
-
{ date: "2024-06-13", desktop: 81, mobile: 130 },
|
|
109
|
-
{ date: "2024-06-14", desktop: 426, mobile: 380 },
|
|
110
|
-
{ date: "2024-06-15", desktop: 307, mobile: 350 },
|
|
111
|
-
{ date: "2024-06-16", desktop: 371, mobile: 310 },
|
|
112
|
-
{ date: "2024-06-17", desktop: 475, mobile: 520 },
|
|
113
|
-
{ date: "2024-06-18", desktop: 107, mobile: 170 },
|
|
114
|
-
{ date: "2024-06-19", desktop: 341, mobile: 290 },
|
|
115
|
-
{ date: "2024-06-20", desktop: 408, mobile: 450 },
|
|
116
|
-
{ date: "2024-06-21", desktop: 169, mobile: 210 },
|
|
117
|
-
{ date: "2024-06-22", desktop: 317, mobile: 270 },
|
|
118
|
-
{ date: "2024-06-23", desktop: 480, mobile: 530 },
|
|
119
|
-
{ date: "2024-06-24", desktop: 132, mobile: 180 },
|
|
120
|
-
{ date: "2024-06-25", desktop: 141, mobile: 190 },
|
|
121
|
-
{ date: "2024-06-26", desktop: 434, mobile: 380 },
|
|
122
|
-
{ date: "2024-06-27", desktop: 448, mobile: 490 },
|
|
123
|
-
{ date: "2024-06-28", desktop: 149, mobile: 200 },
|
|
124
|
-
{ date: "2024-06-29", desktop: 103, mobile: 160 },
|
|
125
|
-
{ date: "2024-06-30", desktop: 446, mobile: 400 },
|
|
126
|
-
]
|
|
127
|
-
|
|
128
|
-
const chartConfig = {
|
|
129
|
-
visitors: {
|
|
130
|
-
label: "Visitors",
|
|
131
|
-
},
|
|
132
|
-
desktop: {
|
|
133
|
-
label: "Desktop",
|
|
134
|
-
color: "var(--primary)",
|
|
135
|
-
},
|
|
136
|
-
mobile: {
|
|
137
|
-
label: "Mobile",
|
|
138
|
-
color: "var(--primary)",
|
|
139
|
-
},
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export function ChartAreaInteractive() {
|
|
143
|
-
const isMobile = useIsMobile()
|
|
144
|
-
const [timeRange, setTimeRange] = React.useState("90d")
|
|
145
|
-
|
|
146
|
-
React.useEffect(() => {
|
|
147
|
-
if (isMobile) {
|
|
148
|
-
setTimeRange("7d")
|
|
149
|
-
}
|
|
150
|
-
}, [isMobile])
|
|
151
|
-
|
|
152
|
-
const filteredData = chartData.filter((item) => {
|
|
153
|
-
const date = new Date(item.date)
|
|
154
|
-
const referenceDate = new Date("2024-06-30")
|
|
155
|
-
let daysToSubtract = 90
|
|
156
|
-
if (timeRange === "30d") {
|
|
157
|
-
daysToSubtract = 30
|
|
158
|
-
} else if (timeRange === "7d") {
|
|
159
|
-
daysToSubtract = 7
|
|
160
|
-
}
|
|
161
|
-
const startDate = new Date(referenceDate)
|
|
162
|
-
startDate.setDate(startDate.getDate() - daysToSubtract)
|
|
163
|
-
return date >= startDate
|
|
164
|
-
})
|
|
165
|
-
|
|
166
|
-
return (
|
|
167
|
-
<Card className="@container/card">
|
|
168
|
-
<CardHeader>
|
|
169
|
-
<CardTitle>Total Visitors</CardTitle>
|
|
170
|
-
<CardDescription>
|
|
171
|
-
<span className="hidden @[540px]/card:block">
|
|
172
|
-
Total for the last 3 months
|
|
173
|
-
</span>
|
|
174
|
-
<span className="@[540px]/card:hidden">Last 3 months</span>
|
|
175
|
-
</CardDescription>
|
|
176
|
-
<CardAction>
|
|
177
|
-
<ToggleGroup
|
|
178
|
-
type="single"
|
|
179
|
-
value={timeRange}
|
|
180
|
-
onValueChange={setTimeRange}
|
|
181
|
-
variant="outline"
|
|
182
|
-
className="hidden *:data-[slot=toggle-group-item]:!px-4 @[767px]/card:flex"
|
|
183
|
-
>
|
|
184
|
-
<ToggleGroupItem value="90d">Last 3 months</ToggleGroupItem>
|
|
185
|
-
<ToggleGroupItem value="30d">Last 30 days</ToggleGroupItem>
|
|
186
|
-
<ToggleGroupItem value="7d">Last 7 days</ToggleGroupItem>
|
|
187
|
-
</ToggleGroup>
|
|
188
|
-
<Select value={timeRange} onValueChange={setTimeRange}>
|
|
189
|
-
<SelectTrigger
|
|
190
|
-
className="flex w-40 **:data-[slot=select-value]:block **:data-[slot=select-value]:truncate @[767px]/card:hidden"
|
|
191
|
-
size="sm"
|
|
192
|
-
aria-label="Select a value"
|
|
193
|
-
>
|
|
194
|
-
<SelectValue placeholder="Last 3 months" />
|
|
195
|
-
</SelectTrigger>
|
|
196
|
-
<SelectContent className="rounded-xl">
|
|
197
|
-
<SelectItem value="90d" className="rounded-lg">
|
|
198
|
-
Last 3 months
|
|
199
|
-
</SelectItem>
|
|
200
|
-
<SelectItem value="30d" className="rounded-lg">
|
|
201
|
-
Last 30 days
|
|
202
|
-
</SelectItem>
|
|
203
|
-
<SelectItem value="7d" className="rounded-lg">
|
|
204
|
-
Last 7 days
|
|
205
|
-
</SelectItem>
|
|
206
|
-
</SelectContent>
|
|
207
|
-
</Select>
|
|
208
|
-
</CardAction>
|
|
209
|
-
</CardHeader>
|
|
210
|
-
<CardContent className="px-2 pt-4 sm:px-6 sm:pt-6">
|
|
211
|
-
<ChartContainer
|
|
212
|
-
config={chartConfig}
|
|
213
|
-
className="aspect-auto h-[250px] w-full"
|
|
214
|
-
>
|
|
215
|
-
<AreaChart data={filteredData}>
|
|
216
|
-
<defs>
|
|
217
|
-
<linearGradient id="fillDesktop" x1="0" y1="0" x2="0" y2="1">
|
|
218
|
-
<stop
|
|
219
|
-
offset="5%"
|
|
220
|
-
stopColor="var(--color-desktop)"
|
|
221
|
-
stopOpacity={1.0}
|
|
222
|
-
/>
|
|
223
|
-
<stop
|
|
224
|
-
offset="95%"
|
|
225
|
-
stopColor="var(--color-desktop)"
|
|
226
|
-
stopOpacity={0.1}
|
|
227
|
-
/>
|
|
228
|
-
</linearGradient>
|
|
229
|
-
<linearGradient id="fillMobile" x1="0" y1="0" x2="0" y2="1">
|
|
230
|
-
<stop
|
|
231
|
-
offset="5%"
|
|
232
|
-
stopColor="var(--color-mobile)"
|
|
233
|
-
stopOpacity={0.8}
|
|
234
|
-
/>
|
|
235
|
-
<stop
|
|
236
|
-
offset="95%"
|
|
237
|
-
stopColor="var(--color-mobile)"
|
|
238
|
-
stopOpacity={0.1}
|
|
239
|
-
/>
|
|
240
|
-
</linearGradient>
|
|
241
|
-
</defs>
|
|
242
|
-
<CartesianGrid vertical={false} />
|
|
243
|
-
<XAxis
|
|
244
|
-
dataKey="date"
|
|
245
|
-
tickLine={false}
|
|
246
|
-
axisLine={false}
|
|
247
|
-
tickMargin={8}
|
|
248
|
-
minTickGap={32}
|
|
249
|
-
tickFormatter={(value) => {
|
|
250
|
-
const date = new Date(value)
|
|
251
|
-
return date.toLocaleDateString("en-US", {
|
|
252
|
-
month: "short",
|
|
253
|
-
day: "numeric",
|
|
254
|
-
})
|
|
255
|
-
}}
|
|
256
|
-
/>
|
|
257
|
-
<ChartTooltip
|
|
258
|
-
cursor={false}
|
|
259
|
-
content={
|
|
260
|
-
<ChartTooltipContent
|
|
261
|
-
labelFormatter={(value) => {
|
|
262
|
-
return new Date(value).toLocaleDateString("en-US", {
|
|
263
|
-
month: "short",
|
|
264
|
-
day: "numeric",
|
|
265
|
-
})
|
|
266
|
-
}}
|
|
267
|
-
indicator="dot"
|
|
268
|
-
/>
|
|
269
|
-
}
|
|
270
|
-
/>
|
|
271
|
-
<Area
|
|
272
|
-
dataKey="mobile"
|
|
273
|
-
type="natural"
|
|
274
|
-
fill="url(#fillMobile)"
|
|
275
|
-
stroke="var(--color-mobile)"
|
|
276
|
-
stackId="a"
|
|
277
|
-
/>
|
|
278
|
-
<Area
|
|
279
|
-
dataKey="desktop"
|
|
280
|
-
type="natural"
|
|
281
|
-
fill="url(#fillDesktop)"
|
|
282
|
-
stroke="var(--color-desktop)"
|
|
283
|
-
stackId="a"
|
|
284
|
-
/>
|
|
285
|
-
</AreaChart>
|
|
286
|
-
</ChartContainer>
|
|
287
|
-
</CardContent>
|
|
288
|
-
</Card>
|
|
289
|
-
)
|
|
290
|
-
}
|