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
?
73%
Quality Avg
?
74%
Security Avg
?
74%
Reviews
?
130
Review Result ?
solutionbowl/crm-dashbaord · 0ae1ee0d
The commit adds new report views and UI components including a BetButton and AgentReport, integrating new routes and form controls. The code demonstrates structured types and UI state management. However, there are minor bugs like an unreachable condition check in valueClassName and some code repetition. Overall quality is solid but could be improved for clarity, robustness, and minor security best practices.
Quality
?
80%
Security
?
60%
Business Value
?
75%
Maintainability
?
70%
Issues & Suggested Fixes
?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Logic Error In Condition Always True ('If...
Where
src/modules/horse/pages/Report/AgentReport.tsx:76
Issue / Evidence
logic error in condition always true ('if (strValue.startsWith("")')
Suggested Fix
fix the condition to correctly detect positive values
Inconsistent Import Style (Single Vs Doubl...
Where
src/main.tsx:16
Issue / Evidence
inconsistent import style (single vs double quotes)
Suggested Fix
unify string quotation marks to improve code consistency
Handle Potential Json.parse Errors From Un...
Where
src/modules/horse/pages/Race/RaceDetail.tsx:1474-1487
Issue / Evidence
handle potential JSON.parse errors from untrusted input
Suggested Fix
add try/catch to avoid runtime exceptions and improve security
Better Naming & Documentation For Valuecla...
Where
src/modules/horse/pages/Report/AgentReport.tsx:72-79
Issue / Evidence
better naming & documentation for valueClassName function to clarify intent of css class application
Suggested Fix
Review and simplify this section.
Update To More Descriptive Message Detaili...
Where
commit message
Issue / Evidence
update to more descriptive message detailing added features and modifications
Suggested Fix
improve business value clarity and reviewer understanding
Code Change Preview · src/main.tsx
?
Removed / Before Commit
- diff --git a/src/main.tsx b/src/main.tsx - index 6d5cf4d..99c6728 100644 - import EventInfoPage from './modules/horse/pages/Market/EventInfoPage.tsx'; - import MarketPage from './modules/horse/pages/Market/MarketPage.tsx'; - import AllReport from './modules/horse/pages/Report/AllReport.tsx'; - - authService.initializeAuth(); - - const Loader = lazy(() => import('./components/loader/loader.tsx')); - <Route path="event/edit/:id" element={<CreateEvent />} /> - <Route path="races" element={<AllRaces />} /> - <Route path="reports" element={<AllReport />} /> - <Route path="races/create" element={<CreateRace />} /> - <Route path="races/edit/:id" element={<CreateRace />} /> - <Route path="races/detail/:id" element={<RaceDetail />} />
Added / After Commit
+ diff --git a/src/main.tsx b/src/main.tsx + index 6d5cf4d..99c6728 100644 + import EventInfoPage from './modules/horse/pages/Market/EventInfoPage.tsx'; + import MarketPage from './modules/horse/pages/Market/MarketPage.tsx'; + import AllReport from './modules/horse/pages/Report/AllReport.tsx'; + import AgentReport from './modules/horse/pages/Report/AgentReport.tsx'; + import BetButton from './modules/horse/pages/Report/BetButton.tsx'; + import BetButtonMarket from "./modules/horse/pages/Report/BetButtonMarket.tsx" + authService.initializeAuth(); + + const Loader = lazy(() => import('./components/loader/loader.tsx')); + <Route path="event/edit/:id" element={<CreateEvent />} /> + <Route path="races" element={<AllRaces />} /> + <Route path="reports" element={<AllReport />} /> + <Route path="reports/AgentReport" element={<AgentReport/>} /> + <Route path="reports/BetButton" element={<BetButton/>} /> + <Route path="reports/BetButtonMarket" element={<BetButtonMarket/>} /> + <Route path="races/create" element={<CreateRace />} />
Removed / Before Commit
- diff --git a/src/modules/horse/layout/HorseSidebar.tsx b/src/modules/horse/layout/HorseSidebar.tsx - index 833cc62..8febc4d 100644 - title: "Report", - icon: " ri-book-open-line", - children: [ - { title: "All Reports", path: "/horse/reports" }, - - ], - },
Added / After Commit
+ diff --git a/src/modules/horse/layout/HorseSidebar.tsx b/src/modules/horse/layout/HorseSidebar.tsx + index 833cc62..8febc4d 100644 + title: "Report", + icon: " ri-book-open-line", + children: [ + { title: "P&L Report by Market", path: "/horse/reports" }, + { title: "P&L Report by Agent", path: "/horse/reports/AgentReport" }, + + ], + },
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Race/RaceDetail.tsx b/src/modules/horse/pages/Race/RaceDetail.tsx - index 82ce8f6..4caeff5 100644 - - const [showFancySettleModal, setShowFancySettleModal] = useState(false); - const [fancyMarkets, setFancyMarkets] = useState<any[]>([]); - const [selectedFancyRunner, setSelectedFancyRunner] = useState<{ - marketId: string; - marketType: string; - runnerId: string; - displayName: string; - } | null>(null); - const [loadingFancyMarkets, setLoadingFancyMarkets] = useState(false); - const [settlingFancy, setSettlingFancy] = useState(false); - const [marketSettleStatus, setMarketSettleStatus] = useState<{ - - const handleOpenFancySettleModal = () => { - setShowFancySettleModal(true); - setSelectedFancyRunner(null);
Added / After Commit
+ diff --git a/src/modules/horse/pages/Race/RaceDetail.tsx b/src/modules/horse/pages/Race/RaceDetail.tsx + index 82ce8f6..4caeff5 100644 + + const [showFancySettleModal, setShowFancySettleModal] = useState(false); + const [fancyMarkets, setFancyMarkets] = useState<any[]>([]); + const [selectedFancyRunners, setSelectedFancyRunners] = useState<Record<string, { + marketId: string; + marketType: string; + runnerId: string; + displayName: string; + }>>({}); + const [loadingFancyMarkets, setLoadingFancyMarkets] = useState(false); + const [settlingFancy, setSettlingFancy] = useState(false); + const [marketSettleStatus, setMarketSettleStatus] = useState<{ + + const handleOpenFancySettleModal = () => { + setShowFancySettleModal(true); + setSelectedFancyRunners({});
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Report/AgentReport.tsx b/src/modules/horse/pages/Report/AgentReport.tsx - new file mode 100644 - index 0000000..e05b74b
Added / After Commit
+ diff --git a/src/modules/horse/pages/Report/AgentReport.tsx b/src/modules/horse/pages/Report/AgentReport.tsx + new file mode 100644 + index 0000000..e05b74b + import { Fragment, useState, useEffect } from "react"; + import { Button, Card, Col, Row, Form } from "react-bootstrap"; + import { useNavigate } from "react-router-dom"; + import Pageheader from "../../components/pageheader/pageheader"; + import { reportService } from "../../../../services/api/ReportService"; + import "../../styles/horsespages.css"; + + // API Response Types for Agent Report + interface AgentReportData { + fromDate: string; + toDate: string; + grandTotal: { + user: { + netWin: number; + comm: number;
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Report/AllReport.tsx b/src/modules/horse/pages/Report/AllReport.tsx - index a62f5e3..36db138 100644 - import Pageheader from "../../components/pageheader/pageheader"; - import { reportService } from "../../../../services/api/ReportService"; - import "../../styles/horsespages.css"; - - - interface ApiReportData { - }; - dates: Array<{ - date: string; - races: Array<{ - raceName: string; - markets: Array<{ - marketId: string; - }; - }>; - }
Added / After Commit
+ diff --git a/src/modules/horse/pages/Report/AllReport.tsx b/src/modules/horse/pages/Report/AllReport.tsx + index a62f5e3..36db138 100644 + import Pageheader from "../../components/pageheader/pageheader"; + import { reportService } from "../../../../services/api/ReportService"; + import "../../styles/horsespages.css"; + import { useNavigate } from "react-router-dom"; + + + interface ApiReportData { + }; + dates: Array<{ + date: string; + races: Array<{ + raceId: string; + raceName: string; + markets: Array<{ + marketId: string; + };
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Report/BetButton.tsx b/src/modules/horse/pages/Report/BetButton.tsx - new file mode 100644 - index 0000000..5e17cb9
Added / After Commit
+ diff --git a/src/modules/horse/pages/Report/BetButton.tsx b/src/modules/horse/pages/Report/BetButton.tsx + new file mode 100644 + index 0000000..5e17cb9 + import { Fragment, useState, useEffect } from "react"; + import { Card, Col, Row } from "react-bootstrap"; + import { useSearchParams, useNavigate } from "react-router-dom"; + import Pageheader from "../../components/pageheader/pageheader"; + import { reportService } from "../../../../services/api/ReportService"; + import "../../styles/horsespages.css"; + + interface BetData { + id: string; + createdAt: string; + updatedAt: string; + agentWinLoss: number; + username: string; + email: string; + userId: string;
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Report/BetButtonMarket.tsx b/src/modules/horse/pages/Report/BetButtonMarket.tsx - new file mode 100644 - index 0000000..25f0acb
Added / After Commit
+ diff --git a/src/modules/horse/pages/Report/BetButtonMarket.tsx b/src/modules/horse/pages/Report/BetButtonMarket.tsx + new file mode 100644 + index 0000000..25f0acb + import { Fragment, useState, useEffect } from "react"; + import { Card, Col, Row } from "react-bootstrap"; + import { useSearchParams, useNavigate } from "react-router-dom"; + import Pageheader from "../../components/pageheader/pageheader"; + import { reportService } from "../../../../services/api/ReportService"; + import "../../styles/horsespages.css"; + + interface BetData { + id: string; + createdAt: string; + updatedAt: string; + agentWinLoss: number; + username: string; + email: string; + userId: string;
Removed / Before Commit
- diff --git a/src/modules/horse/styles/horsespages.css b/src/modules/horse/styles/horsespages.css - index 25233ce..d296dd4 100644 - } - - .horse-report-grand-total { - background: #8ab9e7; - border-bottom: 1px solid var(--default-border, #dee2e6); - } - - - .horse-report-value-negative { - color: #ff0202; - } - .horse-report-value-positive { - color: #05b51f; - font-weight: 700; - }
Added / After Commit
+ diff --git a/src/modules/horse/styles/horsespages.css b/src/modules/horse/styles/horsespages.css + index 25233ce..d296dd4 100644 + } + + .horse-report-grand-total { + background: #6cb5ff; + border-bottom: 1px solid var(--default-border, #dee2e6); + } + + + .horse-report-value-negative { + color: #ff0202; + + } + .horse-report-value-positive { + color: #5dff05; + font-weight: 700; + }
Removed / Before Commit
- diff --git a/src/services/api/ReportService.ts b/src/services/api/ReportService.ts - index 8063242..b1cb5ed 100644 - - - const BET_SERVICE_URL = import.meta.env.VITE_BET_API_URL || 'https://api.digitalbowls.com/bet/api'; - - const createBetServiceInstance = (): AxiosInstance => { - const instance = axios.create({ - 'Content-Type': 'application/json', - }, - }); - - instance.interceptors.request.use( - async (config: any) => { - try { - return Promise.reject(error); - } - );
Added / After Commit
+ diff --git a/src/services/api/ReportService.ts b/src/services/api/ReportService.ts + index 8063242..b1cb5ed 100644 + + + const BET_SERVICE_URL = import.meta.env.VITE_BET_API_URL || 'https://api.digitalbowls.com/bet/api'; + const TENANT_SERVICE_URL = import.meta.env.VITE_TENANT_API_URL || 'https://api.digitalbowls.com/tenant/api'; + + const createBetServiceInstance = (): AxiosInstance => { + const instance = axios.create({ + 'Content-Type': 'application/json', + }, + }); + //https://api.digitalbowls.com/tenant/api/horse-racing/reports/global-profit-loss + instance.interceptors.request.use( + async (config: any) => { + try { + return Promise.reject(error); + }