Showing AI reviews for super-admin
Project AI Score ?
72%
Quality Avg ?
77%
Security Avg ?
64%
Reviews ?
91

Review Result ?

solutionbowl/super-admin · 3d76c820
The commit adds new Net Exposure routes and a React page component for net-exposure-bet with API integration and UI elements. The code shows reasonable structure and use of modern React and React Query practices, but the commit message is vague and the route imports use 'as any' casting which reduces type safety and maintainability. The UI component handles loading and error states but the error handling UI snippet is incomplete in the diff. No obvious security-sensitive code is present but no input sanitization or error boundary concepts are evident.
Quality ?
75%
Security ?
40%
Business Value ?
70%
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 more descriptive commit message explaining the feature and scope
Uses 'As Any' Casting For Route Update
Where src/routeTree.gen.ts:107
Issue / Evidence uses 'as any' casting for route update
Suggested Fix refactor to use proper TypeScript types to enhance type safety
Uses 'As Any' Casting For Route Update
Where src/routeTree.gen.ts:112
Issue / Evidence uses 'as any' casting for route update
Suggested Fix refactor to use proper TypeScript types to enhance type safety
Uses 'As Any' Casting For Route Update
Where src/routeTree.gen.ts:117
Issue / Evidence uses 'as any' casting for route update
Suggested Fix refactor to use proper TypeScript types to enhance type safety
Error Ui Handling Is Incomplete In Diff
Where src/routes/net-exposure-bet.tsx:134
Issue / Evidence error UI handling is incomplete in diff
Suggested Fix add full error handling UI for better UX in failure cases
Fetchbets Function Returns Casted Unknown...
Where src/routes/net-exposure-bet.tsx:60
Issue / Evidence fetchBets function returns casted unknown JSON
Suggested Fix add input validation and error handling for API response to reduce runtime bugs
React Query Usage Has Retry=1 But No Error...
Where src/routes/net-exposure-bet.tsx:74
Issue / Evidence React Query usage has retry=1 but no error boundary
Suggested Fix consider adding error boundaries or user feedback on persistent failure to improve robustness
Code Change Preview · src/routes/net-exposure-bet.tsx ?
Removed / Before Commit
- diff --git a/src/routes/net-exposure-bet.tsx b/src/routes/net-exposure-bet.tsx
- new file mode 100644
- index 0000000..da748b9
Added / After Commit
+ diff --git a/src/routes/net-exposure-bet.tsx b/src/routes/net-exposure-bet.tsx
+ new file mode 100644
+ index 0000000..da748b9
+ import { createFileRoute, useNavigate } from "@tanstack/react-router";
+ import { useQuery } from "@tanstack/react-query";
+ import { ArrowLeft, RefreshCw } from "lucide-react";
+ import { Button } from "@/components/ui/button";
+ import { cn } from "@/lib/utils";
+ import { tenantApiClient } from "@/services/api/apiClient";
+ import { format } from "date-fns";
+ 
+ export const Route = createFileRoute("/net-exposure-bet")({
+   component: NetExposureBetPage,
+   validateSearch: (s: Record<string, unknown>) => ({
+     raceId: String(s.raceId ?? ""),
+     marketId: String(s.marketId ?? ""),
+   }),
+   head: () => ({ meta: [{ title: "Net Exposure Bets - B2B-B2C Panel" }] }),
Removed / Before Commit
- diff --git a/src/routes/net-exposure-detail.tsx b/src/routes/net-exposure-detail.tsx
- new file mode 100644
- index 0000000..eda2bb2
Added / After Commit
+ diff --git a/src/routes/net-exposure-detail.tsx b/src/routes/net-exposure-detail.tsx
+ new file mode 100644
+ index 0000000..eda2bb2
+ import { createFileRoute, useNavigate } from "@tanstack/react-router";
+ import { useQuery } from "@tanstack/react-query";
+ import { useState } from "react";
+ import { ArrowLeft, RefreshCw, ChevronUp, ChevronDown } from "lucide-react";
+ import { Button } from "@/components/ui/button";
+ import { cn } from "@/lib/utils";
+ import { tenantApiClient } from "@/services/api/apiClient";
+ import { useAuth } from "@/hooks/useAuth";
+ 
+ // ─── Route ────────────────────────────────────────────────────────────────────
+ 
+ export const Route = createFileRoute("/net-exposure-detail")({
+   component: NetExposureDetailPage,
+   validateSearch: (s: Record<string, unknown>) => ({
+     raceId: String(s.raceId ?? ""),
Removed / Before Commit
- diff --git a/src/routes/net-exposure-herarchy.tsx b/src/routes/net-exposure-herarchy.tsx
- new file mode 100644
- index 0000000..c417f6b
- \ No newline at end of file
Added / After Commit
+ diff --git a/src/routes/net-exposure-herarchy.tsx b/src/routes/net-exposure-herarchy.tsx
+ new file mode 100644
+ index 0000000..c417f6b
+ import { createFileRoute } from "@tanstack/react-router";
+ import { useQuery } from "@tanstack/react-query";
+ import { useState } from "react";
+ import { ChevronDown, ChevronUp, RefreshCw } from "lucide-react";
+ 
+ import { tenantApiClient } from "@/services/api/apiClient";
+ import { Button } from "@/components/ui/button";
+ import { cn } from "@/lib/utils";
+ 
+ export const Route = createFileRoute("/net-exposure-herarchy")({
+   component: NetExposureHierarchyPage,
+   validateSearch: (search: Record<string, unknown>) => ({
+     raceId: String(search.raceId ?? ""),
+     marketId: String(search.marketId ?? ""),
+     userId: String(search.userId ?? ""),
Removed / Before Commit
- diff --git a/src/routes/net-exposure.tsx b/src/routes/net-exposure.tsx
- index f8bab6e..b1d511e 100644
- import { createFileRoute } from "@tanstack/react-router";
- import { useState } from "react";
- import { motion } from "motion/react";
- import { Card } from "@/components/ui/card";
- import { Button } from "@/components/ui/button";
- import { cn } from "@/lib/utils";
- 
- export const Route = createFileRoute("/net-exposure")({
- component: NetExposurePage,
-   head: () => ({ meta: [{ title: "Net Exposure - B2B-B2C Panel" }] }),
- });
- 
- type SportType = "My P/L" | "Total Block" | "Filter by Sport" | "All" | "Cricket" | "Football" | "Tennis" | "Horse Racing" | "Greyhound Racing";
- 
- function NetExposurePage() {
- const [selectedSport, setSelectedSport] = useState<SportType>("My P/L");
Added / After Commit
+ diff --git a/src/routes/net-exposure.tsx b/src/routes/net-exposure.tsx
+ index f8bab6e..b1d511e 100644
+ import { createFileRoute, useNavigate } from "@tanstack/react-router";
+ import { useState } from "react";
+ import { motion } from "motion/react";
+ import { Card } from "@/components/ui/card";
+ import { Button } from "@/components/ui/button";
+ import { cn } from "@/lib/utils";
+ import { useQuery } from "@tanstack/react-query";
+ import { Home, List, Users } from "lucide-react";
+ import { internalServices } from "@/services/api/internalServices";
+ 
+ export const Route = createFileRoute("/net-exposure")({
+ component: NetExposurePage,
+   head: () => ({ meta: [{ title: "Net Exposure  - B2B-B2C Panel" }] }),
+ });
+ 
+ type SportType =
Removed / Before Commit
- diff --git a/src/routeTree.gen.ts b/src/routeTree.gen.ts
- index 3c32b04..c2262f4 100644
- import { Route as PositionTakingListingRouteImport } from './routes/position-taking-listing'
- import { Route as PlByMarketRouteImport } from './routes/pl-by-market'
- import { Route as PlByAgentRouteImport } from './routes/pl-by-agent'
- import { Route as NetExposureRouteImport } from './routes/net-exposure'
- import { Route as MarketingRouteImport } from './routes/marketing'
- import { Route as LoginRouteImport } from './routes/login'
- path: '/pl-by-agent',
- getParentRoute: () => rootRouteImport,
- } as any)
- const NetExposureRoute = NetExposureRouteImport.update({
- id: '/net-exposure',
- path: '/net-exposure',
- '/login': typeof LoginRoute
- '/marketing': typeof MarketingRoute
- '/net-exposure': typeof NetExposureRoute
- '/pl-by-agent': typeof PlByAgentRoute
Added / After Commit
+ diff --git a/src/routeTree.gen.ts b/src/routeTree.gen.ts
+ index 3c32b04..c2262f4 100644
+ import { Route as PositionTakingListingRouteImport } from './routes/position-taking-listing'
+ import { Route as PlByMarketRouteImport } from './routes/pl-by-market'
+ import { Route as PlByAgentRouteImport } from './routes/pl-by-agent'
+ import { Route as NetExposureHerarchyRouteImport } from './routes/net-exposure-herarchy'
+ 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'
+ path: '/pl-by-agent',
+ getParentRoute: () => rootRouteImport,
+ } as any)
+ const NetExposureHerarchyRoute = NetExposureHerarchyRouteImport.update({
+   id: '/net-exposure-herarchy',
+   path: '/net-exposure-herarchy',
+   getParentRoute: () => rootRouteImport,
Removed / Before Commit
- diff --git a/src/services/api/internalServices.ts b/src/services/api/internalServices.ts
- index 84573e0..ae7f8ab 100644
- casinoLive: createResourceService<CasinoItem>("/casino/live", "games"),
- punching: createResourceService<PunchingMarket>("/punching", "markets"),
- horseRacingReports: {
- async globalProfitLoss(fromDate: string, toDate: string) {
- return unwrapData<ProfitLossReport>(
- await tenantApiClient.post<unknown>("/horse-racing/reports/global-profit-loss", {
Added / After Commit
+ diff --git a/src/services/api/internalServices.ts b/src/services/api/internalServices.ts
+ index 84573e0..ae7f8ab 100644
+ casinoLive: createResourceService<CasinoItem>("/casino/live", "games"),
+ punching: createResourceService<PunchingMarket>("/punching", "markets"),
+ horseRacingReports: {
+     async netExposure() {
+       const raw = await tenantApiClient.post<unknown>("/horse-racing/reports/net-exposure", {});
+       // Return raw so the caller can inspect the actual shape
+       if (Array.isArray(raw)) return raw;
+       const obj = raw as Record<string, unknown>;
+       if (Array.isArray(obj?.data)) return obj.data;
+       return raw;
+     },
+ async globalProfitLoss(fromDate: string, toDate: string) {
+ return unwrapData<ProfitLossReport>(
+ await tenantApiClient.post<unknown>("/horse-racing/reports/global-profit-loss", {