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 · 2a73aa88
This commit adds UI and logic for displaying and interacting with a hierarchy view in the net exposure detail page, including fetching sub-hierarchies asynchronously and handling expand/collapse states. The code shows thoughtful features such as role-based row styles and loading states. However, the commit message is uninformative, and some repeated logic in two files hints at potential for code reuse improvements. There are no apparent security or bug risks in the code changes.
Quality
?
85%
Security
?
70%
Business Value
?
80%
Maintainability
?
85%
Issues & Suggested Fixes
?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Poor Description
Where
commit message
Issue / Evidence
poor description
Suggested Fix
improve commit message to clearly describe what has been added or changed, e.g., 'Add hierarchy view and expand/collapse logic for net exposure detail'
Duplicate Logic
Where
src/routes/net-exposure-detail.tsx:46
Issue / Evidence
repeated functionality
Suggested Fix
consider abstracting the fetchHierarchy and expand/collapse logic into a shared hook or utility to avoid duplication with net-exposure-herarchy.tsx
Magic Strings
Where
src/routes/net-exposure-detail.tsx:131
Issue / Evidence
magic strings
Suggested Fix
replace role string literals with enums or constants to improve code maintainability and avoid typos
State Set With Functional Update
Where
src/routes/net-exposure-detail.tsx:114
Issue / Evidence
state set with functional update
Suggested Fix
ensure error handling in async toggleExpand, e.g., catch errors in fetchHierarchy to avoid stale UI states or failed loading indicators
Accessibility
Where
src/routes/net-exposure-detail.tsx:158
Issue / Evidence
accessibility
Suggested Fix
add aria-expanded attributes and keyboard accessibility to expand/collapse buttons
Code Change Preview · src/routes/bet-list.tsx
?
Removed / Before Commit
- diff --git a/src/routes/bet-list.tsx b/src/routes/bet-list.tsx - index a7a3e8a..7c30345 100644 - </span> - )} - </td> - <td className="whitespace-nowrap px-2 py-2 text-green-500"> - {getDisplayValue(bet.combined_odds)} - </td> - <td className="whitespace-nowrap px-2 py-2 text-green-500"> - {getDisplayValue(racingDetails?.odds_matched)} - </td> - <td className="whitespace-nowrap px-2 py-2 text-green-500"> - {formatNumber(bet.bet_amount)} - </td> - <td className="whitespace-nowrap px-2 py-2 text-green-500"> - {formatNumber(bet.return_amount)} - </td> - <td className="whitespace-nowrap px-2 py-2 text-green-500">
Added / After Commit
+ diff --git a/src/routes/bet-list.tsx b/src/routes/bet-list.tsx + index a7a3e8a..7c30345 100644 + </span> + )} + </td> + <td className="whitespace-nowrap px-2 py-2 text-500"> + {getDisplayValue(bet.combined_odds)} + </td> + <td className="whitespace-nowrap px-2 py-2 text-500"> + {getDisplayValue(racingDetails?.odds_matched)} + </td> + <td className="whitespace-nowrap px-2 py-2 text-500"> + {formatNumber(bet.bet_amount)} + </td> + <td className="whitespace-nowrap px-2 py-2 text-green-500"> + {formatNumber(bet.return_amount)} + </td> + <td className="whitespace-nowrap px-2 py-2 text-500">
Removed / Before Commit
- diff --git a/src/routes/net-exposure-detail.tsx b/src/routes/net-exposure-detail.tsx - index eb58225..829e52e 100644 - import { createFileRoute, useNavigate } from "@tanstack/react-router"; - import { useQuery } from "@tanstack/react-query"; - import { useState } from "react"; - import { ArrowLeft, RefreshCw, Network } from "lucide-react"; - import { Button } from "@/components/ui/button"; - import { cn } from "@/lib/utils"; - import { tenantApiClient } from "@/services/api/apiClient"; - - - - - // ─── Route ──────────────────────────────────────────────────────────────────── - - export const Route = createFileRoute("/net-exposure-detail")({ - component: NetExposureDetailPage, - validateSearch: (s: Record<string, unknown>) => ({
Added / After Commit
+ diff --git a/src/routes/net-exposure-detail.tsx b/src/routes/net-exposure-detail.tsx + index eb58225..829e52e 100644 + import { createFileRoute, useNavigate } from "@tanstack/react-router"; + import { useQuery } from "@tanstack/react-query"; + import { useState } from "react"; + import type React from "react"; + import { ArrowLeft, RefreshCw, ChevronDown, Network } from "lucide-react"; + import { Button } from "@/components/ui/button"; + import { cn } from "@/lib/utils"; + import { tenantApiClient } from "@/services/api/apiClient"; + + export const Route = createFileRoute("/net-exposure-detail")({ + component: NetExposureDetailPage, + validateSearch: (s: Record<string, unknown>) => ({ + + // ─── Types ──────────────────────────────────────────────────────────────────── + + interface DetailRunner { runnerId: string; runnerName: string; exposure: number; exposureProfit: number; }
Removed / Before Commit
- diff --git a/src/routes/net-exposure-herarchy.tsx b/src/routes/net-exposure-herarchy.tsx - index a285bbd..8439b74 100644 - import { createFileRoute, useNavigate } from "@tanstack/react-router"; - import { useQuery } from "@tanstack/react-query"; - import { useState } from "react"; - import { Network, RefreshCw, ArrowLeft } from "lucide-react"; - import { tenantApiClient } from "@/services/api/apiClient"; - import { Button } from "@/components/ui/button"; - import { cn } from "@/lib/utils"; - validateSearch: (search: Record<string, unknown>) => ({ - raceId: String(search.raceId ?? ""), - marketId: String(search.marketId ?? ""), - }), - head: () => ({ meta: [{ title: "Net Exposure Hierarchy - B2B-B2C Panel" }] }), - }); - hierarchy: HierarchyUser[]; - } -
Added / After Commit
+ diff --git a/src/routes/net-exposure-herarchy.tsx b/src/routes/net-exposure-herarchy.tsx + index a285bbd..8439b74 100644 + import { createFileRoute, useNavigate } from "@tanstack/react-router"; + import { useQuery } from "@tanstack/react-query"; + import { useState } from "react"; + import type React from "react"; + import { ChevronDown, ChevronUp, Network, RefreshCw, ArrowLeft } from "lucide-react"; + import { tenantApiClient } from "@/services/api/apiClient"; + import { Button } from "@/components/ui/button"; + import { cn } from "@/lib/utils"; + validateSearch: (search: Record<string, unknown>) => ({ + raceId: String(search.raceId ?? ""), + marketId: String(search.marketId ?? ""), + userId: String(search.userId ?? ""), + }), + head: () => ({ meta: [{ title: "Net Exposure Hierarchy - B2B-B2C Panel" }] }), + }); + hierarchy: HierarchyUser[];
Removed / Before Commit
- diff --git a/src/routes/user-details.$userId.tsx b/src/routes/user-details.$userId.tsx - index 309bc4a..97befdf 100644 - <TableCell className="text-sm">{bet.market_name}</TableCell> - <TableCell className="text-sm">{bet.selection}</TableCell> - <TableCell className="text-sm"> - <Badge variant={bet.odds_type === "back" ? "default" : "destructive"}> - {bet.odds_type.toUpperCase()} - </Badge> - </TableCell> - <TableCell className="text-sm tabular-nums">{bet.odds_request.toFixed(2)}</TableCell>
Added / After Commit
+ diff --git a/src/routes/user-details.$userId.tsx b/src/routes/user-details.$userId.tsx + index 309bc4a..97befdf 100644 + <TableCell className="text-sm">{bet.market_name}</TableCell> + <TableCell className="text-sm">{bet.selection}</TableCell> + <TableCell className="text-sm"> + <Badge + className={bet.odds_type === "back" ? "bg-[#3BA7FF] text-black" : "bg-[#FF7F9D] text-black"} + > + {bet.odds_type.toUpperCase()} + </Badge> + </TableCell> + <TableCell className="text-sm tabular-nums">{bet.odds_request.toFixed(2)}</TableCell>