Showing AI reviews for website
Project AI Score ?
71%
Quality Avg ?
72%
Security Avg ?
74%
Reviews ?
123

Review Result ?

solutionbowl/website · 25959d97
The commit introduces a new account statement page with filtering, grouping, and UI elements displaying user's credit balance. The implementation includes proper React hooks and state management with error handling for data fetching. The changes include adding a protected route, navigation from the profile menu, and API endpoint configuration. Overall, the code is well-structured and adds valuable business functionality.
Quality ?
85%
Security ?
75%
Business Value ?
90%
Maintainability ?
85%
Issues & Suggested Fixes ?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Fetchstatement Function Calls Getaccountst...
Where src/pages/AccountStatement.tsx:104
Issue / Evidence fetchStatement function calls getAccountStatement without parameters for date filters
Suggested Fix add date range parameters to API call to avoid fetching unnecessary data and improve performance and business value
Error Handling Sets Error Message From Mes...
Where src/pages/AccountStatement.tsx:113
Issue / Evidence error handling sets error message from message property or generic string; error type check is minimal
Suggested Fix consider enhancing error handling to handle possible error types and log unexpected errors for debugging to improve bug risk and quality
Loading State Is Managed Properly But Ther...
Where src/pages/AccountStatement.tsx:95
Issue / Evidence loading state is managed properly but there is no indication within the UI return to show loading or error messages to user
Suggested Fix add UI feedback for loading and error states to improve user experience and business value
Availablecredit Calculation Relies On The...
Where src/pages/AccountStatement.tsx:137
Issue / Evidence availableCredit calculation relies on the first row's balanceAfter which may be inaccurate or stale
Suggested Fix ensure the balanceAfter is correctly maintained or fallback logic is more robust to improve accuracy and reduce bug risk
The Api Base Url Is Hardcoded As A Plain S...
Where src/config/api.config.ts:32
Issue / Evidence the API base url is hardcoded as a plain string
Suggested Fix consider moving to environment variables or secure config to improve security and flexibility
Non Descriptive Commit Message
Where commit message
Issue / Evidence non-descriptive commit message
Suggested Fix provide detailed descriptive commit messages in future to improve maintainability and reduce fake work risk
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;