From 3369116d22806e79a81845b85fe871f7c24e17ae Mon Sep 17 00:00:00 2001 From: Unclebigbay Date: Sun, 15 Feb 2026 17:22:52 +0100 Subject: [PATCH] feat: add reports tab to dashboard --- .../dashboard/components/reports-chart.tsx | 63 ++++ src/features/dashboard/components/reports.tsx | 284 ++++++++++++++++++ src/features/dashboard/index.tsx | 6 +- src/routeTree.gen.ts | 6 +- 4 files changed, 356 insertions(+), 3 deletions(-) create mode 100644 src/features/dashboard/components/reports-chart.tsx create mode 100644 src/features/dashboard/components/reports.tsx diff --git a/src/features/dashboard/components/reports-chart.tsx b/src/features/dashboard/components/reports-chart.tsx new file mode 100644 index 000000000..49c7f9b92 --- /dev/null +++ b/src/features/dashboard/components/reports-chart.tsx @@ -0,0 +1,63 @@ +import { + Bar, + BarChart, + ResponsiveContainer, + Tooltip, + XAxis, + YAxis, +} from 'recharts' + +const data = [ + { name: 'Jan', revenue: 4200, expenses: 2800 }, + { name: 'Feb', revenue: 3800, expenses: 2600 }, + { name: 'Mar', revenue: 5100, expenses: 3200 }, + { name: 'Apr', revenue: 4600, expenses: 2900 }, + { name: 'May', revenue: 5400, expenses: 3100 }, + { name: 'Jun', revenue: 6200, expenses: 3400 }, + { name: 'Jul', revenue: 5800, expenses: 3600 }, + { name: 'Aug', revenue: 6800, expenses: 3800 }, + { name: 'Sep', revenue: 6100, expenses: 3500 }, + { name: 'Oct', revenue: 7200, expenses: 4000 }, + { name: 'Nov', revenue: 6900, expenses: 3900 }, + { name: 'Dec', revenue: 7800, expenses: 4200 }, +] + +export function ReportsChart() { + return ( + + + + `$${value}`} + /> + [`$${value.toLocaleString()}`, '']} + labelFormatter={(label) => `Month: ${label}`} + /> + + + + + ) +} diff --git a/src/features/dashboard/components/reports.tsx b/src/features/dashboard/components/reports.tsx new file mode 100644 index 000000000..c85cb7677 --- /dev/null +++ b/src/features/dashboard/components/reports.tsx @@ -0,0 +1,284 @@ +import { Badge } from '@/components/ui/badge' +import { Button } from '@/components/ui/button' +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from '@/components/ui/card' +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from '@/components/ui/table' +import { ReportsChart } from './reports-chart' + +export function Reports() { + return ( +
+
+ + + + Total Revenue + + + + + + +
$72,800
+

+ +14.2% from last quarter +

+
+
+ + + + Total Expenses + + + + + + +
$41,200
+

+ +8.1% from last quarter +

+
+
+ + + Net Profit + + + + + +
$31,600
+

+ +22.4% from last quarter +

+
+
+ + + + Profit Margin + + + + + + + + + +
43.4%
+

+ +3.1% from last quarter +

+
+
+
+ + + Revenue vs Expenses + + Monthly comparison for the current fiscal year. + + + + + + + + + Recent Reports + + Generated reports from the last 30 days. + + + + + + + Report + Type + Status + Date + Size + Action + + + + {reports.map((report) => ( + + + {report.name} + + {report.type} + + + {report.status} + + + {report.date} + {report.size} + + + + + ))} + +
+
+
+
+ ) +} + +const reports: { + id: number + name: string + type: string + status: string + statusVariant: 'default' | 'secondary' | 'destructive' | 'outline' + date: string + size: string +}[] = [ + { + id: 1, + name: 'Q4 Revenue Summary', + type: 'Financial', + status: 'Complete', + statusVariant: 'default', + date: 'Feb 14, 2026', + size: '2.4 MB', + }, + { + id: 2, + name: 'User Growth Analysis', + type: 'Analytics', + status: 'Complete', + statusVariant: 'default', + date: 'Feb 12, 2026', + size: '1.8 MB', + }, + { + id: 3, + name: 'Monthly Expenses Breakdown', + type: 'Financial', + status: 'Processing', + statusVariant: 'secondary', + date: 'Feb 10, 2026', + size: '--', + }, + { + id: 4, + name: 'Customer Churn Report', + type: 'Analytics', + status: 'Complete', + statusVariant: 'default', + date: 'Feb 8, 2026', + size: '3.1 MB', + }, + { + id: 5, + name: 'Infrastructure Cost Audit', + type: 'Operations', + status: 'Failed', + statusVariant: 'destructive', + date: 'Feb 5, 2026', + size: '--', + }, + { + id: 6, + name: 'Annual Performance Review', + type: 'HR', + status: 'Complete', + statusVariant: 'default', + date: 'Feb 1, 2026', + size: '5.6 MB', + }, + { + id: 7, + name: 'Product Feature Usage', + type: 'Analytics', + status: 'Complete', + statusVariant: 'default', + date: 'Jan 28, 2026', + size: '1.2 MB', + }, + { + id: 8, + name: 'Sales Pipeline Forecast', + type: 'Financial', + status: 'Complete', + statusVariant: 'default', + date: 'Jan 25, 2026', + size: '4.3 MB', + }, +] diff --git a/src/features/dashboard/index.tsx b/src/features/dashboard/index.tsx index bd650239a..a319b79a5 100644 --- a/src/features/dashboard/index.tsx +++ b/src/features/dashboard/index.tsx @@ -17,6 +17,7 @@ import { ThemeSwitch } from '@/components/theme-switch' import { Analytics } from './components/analytics' import { Overview } from './components/overview' import { RecentSales } from './components/recent-sales' +import { Reports } from './components/reports' export function Dashboard() { return ( @@ -49,7 +50,7 @@ export function Dashboard() { Overview Analytics - + Reports @@ -186,6 +187,9 @@ export function Dashboard() { + + + diff --git a/src/routeTree.gen.ts b/src/routeTree.gen.ts index f45cbfe03..4e4fd8ce3 100644 --- a/src/routeTree.gen.ts +++ b/src/routeTree.gen.ts @@ -200,6 +200,7 @@ const AuthenticatedErrorsErrorRoute = export interface FileRoutesByFullPath { '/clerk': typeof ClerkAuthenticatedRouteRouteWithChildren '/settings': typeof AuthenticatedSettingsRouteRouteWithChildren + '/clerk/': typeof ClerkauthRouteRouteWithChildren '/forgot-password': typeof authForgotPasswordRoute '/otp': typeof authOtpRoute '/sign-in': typeof authSignInRoute @@ -292,6 +293,7 @@ export interface FileRouteTypes { fullPaths: | '/clerk' | '/settings' + | '/clerk/' | '/forgot-password' | '/otp' | '/sign-in' @@ -496,8 +498,8 @@ declare module '@tanstack/react-router' { } '/clerk/(auth)': { id: '/clerk/(auth)' - path: '' - fullPath: '/clerk' + path: '/' + fullPath: '/clerk/' preLoaderRoute: typeof ClerkauthRouteRouteImport parentRoute: typeof ClerkRouteRoute }