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
?
71%
Quality Avg
?
72%
Security Avg
?
74%
Reviews
?
123
Review Result ?
solutionbowl/website · 3655932f
The commit introduces a new AccountStatement feature with well-structured React code. It includes routing, UI components, date and amount formatting, and data fetching with error handling. The commit provides value by enabling users to view their account statements and integrates well with existing authentication and theme context systems. Some minor improvements in naming conventions, error handling clarity, and security practices could be beneficial.
Quality
?
85%
Security
?
70%
Business Value
?
90%
Maintainability
?
83%
Issues & Suggested Fixes
?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Non Descriptive
Where
commit message
Issue / Evidence
non-descriptive
Suggested Fix
improve the commit message to clearly describe what was implemented or changed in the AccountSettlement API work
Fix Hard Coded Api Endpoint By Ensuring It...
Where
src/pages/AccountStatement.tsx:104
Issue / Evidence
fix hard-coded API endpoint by ensuring it's configurable or properly abstracted in service layer
Suggested Fix
enhance maintainability and security
Error Handling Could Be Improved By Loggin...
Where
src/pages/AccountStatement.tsx:113
Issue / Evidence
error handling could be improved by logging or categorizing errors better
Suggested Fix
enables easier debugging and monitoring
Missing Validation
Where
src/pages/AccountStatement.tsx:147
Issue / Evidence
add validation for fromDate and toDate inputs before applying filters
Suggested Fix
reduces risk of invalid date inputs causing bugs
Add Error Handling Or Fallback For Navigat...
Where
src/components/profile/ProfileMenu.tsx:24
Issue / Evidence
add error handling or fallback for navigation failures in handleAccountStatement
Suggested Fix
improve robustness
Ensure Secret Or Sensitive Urls Are Loaded...
Where
src/config/api.config.ts:9
Issue / Evidence
ensure secret or sensitive URLs are loaded from environment variables instead of hardcoded strings
Suggested Fix
improve security
Code Change Preview · src/App.tsx
?
Removed / Before Commit
- diff --git a/src/App.tsx b/src/App.tsx - index 41dbb4b..beac9d6 100644 - import SportsDetailPage from "./pages/SportsDetailPage"; - import LiveCasinoPage from "./pages/LiveCasinoPage"; - import TransactionPage from "./pages/Transaction"; - import { checkSingleTab, forceLogoutCurrentTab } from "./utils/singleTab"; - import { useEffect, useState } from "react"; - import SingleTabModal from "./components/common/SingleTabModal"; - <Route path="sports-detail/:id" element={<SportsDetailPage />} /> - <Route path="/live-casino" element={<LiveCasinoPage />} /> - <Route path="/transactions" element={<TransactionPage />} /> - </Route> - </Routes> - </BrowserRouter>
Added / After Commit
+ diff --git a/src/App.tsx b/src/App.tsx + index 41dbb4b..beac9d6 100644 + import SportsDetailPage from "./pages/SportsDetailPage"; + import LiveCasinoPage from "./pages/LiveCasinoPage"; + import TransactionPage from "./pages/Transaction"; + import AccountStatement from "./pages/AccountStatement"; + import { checkSingleTab, forceLogoutCurrentTab } from "./utils/singleTab"; + import { useEffect, useState } from "react"; + import SingleTabModal from "./components/common/SingleTabModal"; + <Route path="sports-detail/:id" element={<SportsDetailPage />} /> + <Route path="/live-casino" element={<LiveCasinoPage />} /> + <Route path="/transactions" element={<TransactionPage />} /> + <Route + path="/account-statement" + element={ + <ProtectedRoute> + <AccountStatement /> + </ProtectedRoute>
Removed / Before Commit
- diff --git a/src/components/layout/Layout.tsx b/src/components/layout/Layout.tsx - index 3650f5e..893868f 100644 - setIsProfileDrawerOpen(false); - }; - - const hiddenRoutes = ["/horse-racing", "/transactions"]; - - const hideDesktopSidebar = hiddenRoutes.includes(location.pathname); - - <Toaster /> - </div> - ); - } - \ No newline at end of file
Added / After Commit
+ diff --git a/src/components/layout/Layout.tsx b/src/components/layout/Layout.tsx + index 3650f5e..893868f 100644 + setIsProfileDrawerOpen(false); + }; + + const hiddenRoutes = ["/horse-racing", "/transactions", "/account-statement"]; + + const hideDesktopSidebar = hiddenRoutes.includes(location.pathname); + + <Toaster /> + </div> + ); + \ No newline at end of file + }
Removed / Before Commit
- diff --git a/src/components/profile/ProfileMenu.tsx b/src/components/profile/ProfileMenu.tsx - index 26fd7be..4b400f6 100644 - navigate("/transactions"); - onClose?.(); - }; - - const handleMenuItemClick = (callback?: () => void) => { - return () => { - - return ( - <nav className="space-y-[4px]"> - <ProfileMenuItem icon="fa-solid fa-user" label="Account Statement" onClick={handleMenuItemClick()} /> - <ProfileMenuItem icon="fa-solid fa-clock-rotate-left" label="Bet History" onClick={handleBetHistory} /> - <ProfileMenuItem icon="fa-solid fa-money-bill" label="Deposit" onClick={handleMenuItemClick()} /> - <ProfileMenuItem icon="fa-solid fa-arrow-up-from-bracket" label="Withdraw" onClick={handleMenuItemClick()} />
Added / After Commit
+ diff --git a/src/components/profile/ProfileMenu.tsx b/src/components/profile/ProfileMenu.tsx + index 26fd7be..4b400f6 100644 + navigate("/transactions"); + onClose?.(); + }; + + const handleAccountStatement = () => { + navigate("/account-statement"); + onClose?.(); + }; + + const handleMenuItemClick = (callback?: () => void) => { + return () => { + + return ( + <nav className="space-y-[4px]"> + <ProfileMenuItem icon="fa-solid fa-user" label="Account Statement" onClick={handleAccountStatement} /> + <ProfileMenuItem icon="fa-solid fa-clock-rotate-left" label="Bet History" onClick={handleBetHistory} />
Removed / Before Commit
- diff --git a/src/config/api.config.ts b/src/config/api.config.ts - index 5b39051..84e8ad6 100644 - // Main API base URL - const API_BASE_URL = "https://api.digitalbowls.com/website/api" - const BET_API_BASE_URL = "https://api.digitalbowls.com/bet" - - /** - * API Endpoints Configuration - placeMultiBet: `${BET_API_BASE_URL}/api/bets/place-multi-bet`, - getMultiBets: `${BET_API_BASE_URL}/api/bets/multi-bets`, - getMarketTexts: (raceId: string) => `${API_BASE_URL}/racing/getMarketTexts?race_id=${raceId}`, - } - } as const
Added / After Commit
+ diff --git a/src/config/api.config.ts b/src/config/api.config.ts + index 5b39051..84e8ad6 100644 + // Main API base URL + const API_BASE_URL = "https://api.digitalbowls.com/website/api" + const BET_API_BASE_URL = "https://api.digitalbowls.com/bet" + const AUTH_API_BASE_URL = "https://api.digitalbowls.com/auth/api" + + /** + * API Endpoints Configuration + placeMultiBet: `${BET_API_BASE_URL}/api/bets/place-multi-bet`, + getMultiBets: `${BET_API_BASE_URL}/api/bets/multi-bets`, + getMarketTexts: (raceId: string) => `${API_BASE_URL}/racing/getMarketTexts?race_id=${raceId}`, + }, + credit: { + accountStatement: `${AUTH_API_BASE_URL}/credit/account-statement`, + } + } as const
Removed / Before Commit
- diff --git a/src/pages/AccountStatement.tsx b/src/pages/AccountStatement.tsx - new file mode 100644 - index 0000000..670768c
Added / After Commit
+ diff --git a/src/pages/AccountStatement.tsx b/src/pages/AccountStatement.tsx + new file mode 100644 + index 0000000..670768c + import { Fragment, useEffect, useMemo, useState } from "react"; + import { Search } from "lucide-react"; + import { useAuth } from "../contexts/AuthContext"; + import { useThemeColors } from "../hooks/useThemeColors"; + import { + getAccountStatement, + type AccountStatementEntry, + } from "../services/accountStatement"; + + const formatDateInput = (date: Date) => date.toISOString().split("T")[0]; + + const getDefaultFromDate = () => { + const date = new Date(); + date.setDate(date.getDate() - 30); + return formatDateInput(date);
Removed / Before Commit
- diff --git a/src/services/accountStatement.ts b/src/services/accountStatement.ts - new file mode 100644 - index 0000000..95218d4
Added / After Commit
+ diff --git a/src/services/accountStatement.ts b/src/services/accountStatement.ts + new file mode 100644 + index 0000000..95218d4 + import { API_ENDPOINTS, getApiHeaders } from "../config/api.config"; + + export interface AccountStatementEntry { + _id: string; + createdAt: string; + updatedAt?: string; + user_id?: string; + tenant_id?: string; + amount: number; + transaction_type: "credit" | "debit" | string; + statement_type?: string; + type?: string; + bet_id?: string; + remark?: string; + balanceAfter: number;