AI Review Center
Commit Review Workspace ?
Select a commit on the left to inspect quality, security, business value, findings, and suggested code changes.
Project AI Score
?
72%
Quality Avg
?
77%
Security Avg
?
64%
Reviews
?
91
Review Result ?
solutionbowl/super-admin · 68588bf6
This commit adds several new components and UI elements for a dashboard, including metric cards, charts, alerts, and insights. The code is well-structured and uses typed interfaces, improving maintainability and readability. The UI components are visually detailed and appear to enhance user experience. However, the commit message is minimal and does not explain the purpose or context of the changes. Some hardcoded values (e.g., metric values, percentages) reduce flexibility and might require adjustment for dynamic data. There is insufficient error handling or validation visible in the new components, which could increase bug risks if underlying data changes.
Quality
?
75%
Security
?
70%
Business Value
?
80%
Maintainability
?
78%
Issues & Suggested Fixes
?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Issue
Where
commit message
Issue / Evidence
issue
Suggested Fix
provide a more descriptive commit message explaining the goals, scope, and features of this dashboard work to improve business value and quality scores
Hardcoded Metric Value
Where
src/components/dashboard/dashboard-content.tsx:15
Issue / Evidence
hardcoded metric value
Suggested Fix
replace static values (e.g., ₹35,750) with dynamic props or state to support real-time data and improve quality and business value
Hardcoded Metric Value
Where
src/components/dashboard/dashboard-content.tsx:16
Issue / Evidence
hardcoded metric value
Suggested Fix
replace static values with dynamic content to increase flexibility and accuracy
Hardcoded Percentage
Where
src/components/dashboard/high-loss-alert.tsx:18
Issue / Evidence
hardcoded percentage
Suggested Fix
calculate the percentage dynamically based on actual data instead of hardcoding '31.7%' to reduce bug risk
Currency Formatting
Where
src/components/dashboard/high-loss-alert.tsx:21
Issue / Evidence
currency formatting
Suggested Fix
consider internationalization and validation for loss amount to improve reliability and user trust
Static Insights Data
Where
src/components/dashboard/insights.tsx:15
Issue / Evidence
static insights data
Suggested Fix
make insight data configurable or fetched dynamically to reflect up-to-date information, improving business value
Nullable Trend
Where
src/components/dashboard/metric-card.tsx:9
Issue / Evidence
nullable trend
Suggested Fix
clarify handling of null trend values and consider default or fallback UI to avoid unexpected UI states reducing bug risk
Code Change Preview · src/components/dashboard/dashboard-content.tsx
?
Removed / Before Commit
- diff --git a/src/components/dashboard/dashboard-content.tsx b/src/components/dashboard/dashboard-content.tsx - new file mode 100644 - index 0000000..c4cc160
Added / After Commit
+ diff --git a/src/components/dashboard/dashboard-content.tsx b/src/components/dashboard/dashboard-content.tsx + new file mode 100644 + index 0000000..c4cc160 + import { Banknote, ChartNoAxesCombined, CircleDollarSign, Target } from "lucide-react"; + import { MetricCard } from "./metric-card"; + import { SportsProfitLossChart } from "./sports-profit-loss-chart"; + import { SportsExposureChart } from "./sports-exposure-chart"; + import { HighLossAlert } from "./high-loss-alert"; + import { PerformanceTable } from "./performance-table"; + import { RecentActivity } from "./recent-activity"; + import { Insights } from "./insights"; + + export function DashboardContent() { + return ( + <div className="w-full space-y-5"> + <div className="grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4"> + <MetricCard + title="Net Profit / Loss"
Removed / Before Commit
- diff --git a/src/components/dashboard/high-loss-alert.tsx b/src/components/dashboard/high-loss-alert.tsx - new file mode 100644 - index 0000000..5bdff6d
Added / After Commit
+ diff --git a/src/components/dashboard/high-loss-alert.tsx b/src/components/dashboard/high-loss-alert.tsx + new file mode 100644 + index 0000000..5bdff6d + import { AlertTriangle } from "lucide-react"; + + interface HighLossAlertProps { + sport: string; + loss: number; + } + + export function HighLossAlert({ sport, loss }: HighLossAlertProps) { + return ( + <div className="flex flex-col gap-4 rounded-xl border border-red-200 bg-red-50 px-5 py-4 shadow-[0_12px_34px_rgba(239,68,68,0.08)] sm:flex-row sm:items-center sm:justify-between"> + <div className="flex items-center gap-4"> + <div className="flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-red-500 text-white shadow-[0_10px_24px_rgba(239,68,68,0.28)]"> + <AlertTriangle className="h-5 w-5" /> + </div> + <div>
Removed / Before Commit
- diff --git a/src/components/dashboard/insights.tsx b/src/components/dashboard/insights.tsx - new file mode 100644 - index 0000000..6df7bcb
Added / After Commit
+ diff --git a/src/components/dashboard/insights.tsx b/src/components/dashboard/insights.tsx + new file mode 100644 + index 0000000..6df7bcb + import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; + import type { ComponentType } from "react"; + import { ArrowDownRight, ArrowUpRight, Clock3 } from "lucide-react"; + import { cn } from "@/lib/utils"; + + interface Insight { + id: string; + type: "positive" | "negative" | "neutral"; + title: string; + value: string; + description: string; + icon: ComponentType<{ className?: string }>; + } + + const insights: Insight[] = [
Removed / Before Commit
- diff --git a/src/components/dashboard/metric-card.tsx b/src/components/dashboard/metric-card.tsx - new file mode 100644 - index 0000000..e8aac11
Added / After Commit
+ diff --git a/src/components/dashboard/metric-card.tsx b/src/components/dashboard/metric-card.tsx + new file mode 100644 + index 0000000..e8aac11 + import type { ComponentType } from "react"; + import { TrendingDown, TrendingUp } from "lucide-react"; + import { Card, CardContent } from "@/components/ui/card"; + import { cn } from "@/lib/utils"; + + interface MetricCardProps { + title: string; + value: string; + trend?: "up" | "down" | null; + trendPercent?: string; + icon: ComponentType<{ className?: string }>; + iconColor: "green" | "blue" | "violet" | "orange"; + sparkline: number[]; + } +
Removed / Before Commit
- diff --git a/src/components/dashboard/performance-table.tsx b/src/components/dashboard/performance-table.tsx - new file mode 100644 - index 0000000..13b3582
Added / After Commit
+ diff --git a/src/components/dashboard/performance-table.tsx b/src/components/dashboard/performance-table.tsx + new file mode 100644 + index 0000000..13b3582 + import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; + import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, + } from "@/components/ui/table"; + import { cn } from "@/lib/utils"; + + interface PerformanceData { + sport: string; + icon: string; + pl: number;
Removed / Before Commit
- diff --git a/src/components/dashboard/recent-activity.tsx b/src/components/dashboard/recent-activity.tsx - new file mode 100644 - index 0000000..09b0cca
Added / After Commit
+ diff --git a/src/components/dashboard/recent-activity.tsx b/src/components/dashboard/recent-activity.tsx + new file mode 100644 + index 0000000..09b0cca + import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; + import type { ComponentType } from "react"; + import { ArrowDownRight, ArrowUpRight, Banknote, CheckCircle2, Clock3 } from "lucide-react"; + import { cn } from "@/lib/utils"; + + interface RecentActivity { + id: string; + type: "profit" | "loss" | "commission" | "exposure" | "settled"; + title: string; + amount: string; + time: string; + icon: ComponentType<{ className?: string }>; + } + + const activities: RecentActivity[] = [
Removed / Before Commit
- diff --git a/src/components/dashboard/sports-exposure-chart.tsx b/src/components/dashboard/sports-exposure-chart.tsx - new file mode 100644 - index 0000000..611647f
Added / After Commit
+ diff --git a/src/components/dashboard/sports-exposure-chart.tsx b/src/components/dashboard/sports-exposure-chart.tsx + new file mode 100644 + index 0000000..611647f + import { Info } from "lucide-react"; + import { Cell, Pie, PieChart, ResponsiveContainer, Tooltip } from "recharts"; + import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; + + const data = [ + { name: "Soccer", value: 47100, percent: 80.6, fill: "#2f7df4" }, + { name: "Cricket", value: 11350, percent: 19.4, fill: "#f59e0b" }, + ]; + + export function SportsExposureChart() { + return ( + <Card className="rounded-xl border border-slate-200/80 bg-white shadow-[0_12px_34px_rgba(15,23,42,0.05)]"> + <CardHeader className="px-5 pb-1 pt-5"> + <CardTitle className="text-[15px] font-bold text-slate-900">Exposure by Sport</CardTitle> + </CardHeader>
Removed / Before Commit
- diff --git a/src/components/dashboard/sports-profit-loss-chart.tsx b/src/components/dashboard/sports-profit-loss-chart.tsx - new file mode 100644 - index 0000000..16187e9
Added / After Commit
+ diff --git a/src/components/dashboard/sports-profit-loss-chart.tsx b/src/components/dashboard/sports-profit-loss-chart.tsx + new file mode 100644 + index 0000000..16187e9 + import { + Bar, + BarChart, + Cell, + CartesianGrid, + LabelList, + ReferenceLine, + ResponsiveContainer, + Tooltip, + XAxis, + YAxis, + } from "recharts"; + import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; + + const data = [
Removed / Before Commit
- diff --git a/src/routes/index.tsx b/src/routes/index.tsx - index 3dfed4b..573c475 100644 - import { createFileRoute } from "@tanstack/react-router"; - - export const Route = createFileRoute("/")({ - component: DashboardPage, - }); - - function DashboardPage() { - return ( - <div className="flex min-h-[50vh] items-center justify-center"> - <h1 className="text-3xl font-bold tracking-tight text-foreground">Welcome</h1> - </div> - ); - }
Added / After Commit
+ diff --git a/src/routes/index.tsx b/src/routes/index.tsx + index 3dfed4b..573c475 100644 + import { createFileRoute } from "@tanstack/react-router"; + import { DashboardContent } from "@/components/dashboard/dashboard-content"; + + export const Route = createFileRoute("/")({ + component: DashboardPage, + }); + + function DashboardPage() { + return <DashboardContent />; + }
Removed / Before Commit
- diff --git a/src/routes/master-dashboard.tsx b/src/routes/master-dashboard.tsx - new file mode 100644 - index 0000000..c2f40d3
Added / After Commit
+ diff --git a/src/routes/master-dashboard.tsx b/src/routes/master-dashboard.tsx + new file mode 100644 + index 0000000..c2f40d3 + import { createFileRoute } from "@tanstack/react-router"; + import { DashboardContent } from "@/components/dashboard/dashboard-content"; + + export const Route = createFileRoute("/master-dashboard")({ + component: MasterDashboardPage, + head: () => ({ meta: [{ title: "Master Dashboard - B2B-B2C Panel" }] }), + }); + + function MasterDashboardPage() { + return <DashboardContent />; + }
Removed / Before Commit
- diff --git a/src/routes/super-dashboard.tsx b/src/routes/super-dashboard.tsx - new file mode 100644 - index 0000000..f086f4b
Added / After Commit
+ diff --git a/src/routes/super-dashboard.tsx b/src/routes/super-dashboard.tsx + new file mode 100644 + index 0000000..f086f4b + import { createFileRoute } from "@tanstack/react-router"; + import { DashboardContent } from "@/components/dashboard/dashboard-content"; + + export const Route = createFileRoute("/super-dashboard")({ + component: SuperDashboardPage, + head: () => ({ meta: [{ title: "Super Dashboard - B2B-B2C Panel" }] }), + }); + + function SuperDashboardPage() { + return <DashboardContent />; + }
Removed / Before Commit
- diff --git a/src/routeTree.gen.ts b/src/routeTree.gen.ts - index c2262f4..cfc24f3 100644 - import { Route as UploadFilesRouteImport } from './routes/upload-files' - import { Route as TransferStatementRouteImport } from './routes/transfer-statement' - import { Route as TransferRouteImport } from './routes/transfer' - import { Route as StatementRouteImport } from './routes/statement' - import { Route as SettingsRouteImport } from './routes/settings' - import { Route as ReportsRouteImport } from './routes/reports' - import { Route as NetExposureDetailRouteImport } from './routes/net-exposure-detail' - import { Route as NetExposureBetRouteImport } from './routes/net-exposure-bet' - import { Route as NetExposureRouteImport } from './routes/net-exposure' - import { Route as MarketingRouteImport } from './routes/marketing' - import { Route as LoginRouteImport } from './routes/login' - import { Route as FormulaCenterRouteImport } from './routes/formula-center' - path: '/transfer', - getParentRoute: () => rootRouteImport, - } as any) - const StatementRoute = StatementRouteImport.update({
Added / After Commit
+ diff --git a/src/routeTree.gen.ts b/src/routeTree.gen.ts + index c2262f4..cfc24f3 100644 + import { Route as UploadFilesRouteImport } from './routes/upload-files' + import { Route as TransferStatementRouteImport } from './routes/transfer-statement' + import { Route as TransferRouteImport } from './routes/transfer' + import { Route as SuperDashboardRouteImport } from './routes/super-dashboard' + import { Route as StatementRouteImport } from './routes/statement' + import { Route as SettingsRouteImport } from './routes/settings' + import { Route as ReportsRouteImport } from './routes/reports' + import { Route as NetExposureDetailRouteImport } from './routes/net-exposure-detail' + import { Route as NetExposureBetRouteImport } from './routes/net-exposure-bet' + import { Route as NetExposureRouteImport } from './routes/net-exposure' + import { Route as MasterDashboardRouteImport } from './routes/master-dashboard' + import { Route as MarketingRouteImport } from './routes/marketing' + import { Route as LoginRouteImport } from './routes/login' + import { Route as FormulaCenterRouteImport } from './routes/formula-center' + path: '/transfer', + getParentRoute: () => rootRouteImport,
Removed / Before Commit
- diff --git a/src/services/api/authService.ts b/src/services/api/authService.ts - index 03bb8a8..e579034 100644 - return normalizeUser(rawUser, data.permissions ?? root.permissions); - } - - function readJson<T>(key: string): T | null { - if (!isBrowser()) return null; - try { - - export const authService = { - async login(credentials: LoginRequest): Promise<LoginResult> { - const payload = await authApiClient.post<unknown>("/auth/login", credentials, { auth: false }); - const result = extractLoginResult(payload); - writeAuth(result.token, result.user);
Added / After Commit
+ diff --git a/src/services/api/authService.ts b/src/services/api/authService.ts + index 03bb8a8..e579034 100644 + return normalizeUser(rawUser, data.permissions ?? root.permissions); + } + + // Demo mode for testing + function createDemoUser(username: string): AuthUser { + return { + id: "demo-user-1", + username, + email: `${username}@example.com`, + role: "owner", + userRole: "owner", + permissions: [ + "dashboard", + "view_dashboard", + "view_reports", + "view_users",