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

Review Result ?

solutionbowl/website · 5f8207fa
The commit introduces UI improvements and API call integration for race events data fetching. The UI updates include detailed styling and interaction improvements in transaction components. However, some areas such as type safety in DetailRow props, error handling in API calls, and copy-to-clipboard UX could be improved. The commit message is vague and should be more descriptive to enhance maintainability and ease of review.
Quality ?
75%
Security ?
60%
Business Value ?
65%
Maintainability ?
73%
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 improve commit message to be more descriptive of the UI changes and API call functionality to improve maintainability
No Explicit Typing For Detailrow Props
Where src/components/transactions/TransactionCard.tsx:13
Issue / Evidence no explicit typing for DetailRow props
Suggested Fix add proper TypeScript interfaces/types to improve code quality and reduce bug risks
Clipboard Usage Lacks Error Handling
Where src/components/transactions/TransactionCard.tsx:27
Issue / Evidence clipboard usage lacks error handling
Suggested Fix add try/catch and notification on failure to improve robustness and user experience
No Check For Raceevents Data Validity Beyo...
Where src/pages/HorseRacing.tsx:34
Issue / Evidence no check for raceEvents data validity beyond try/catch
Suggested Fix add validation of API response shape to reduce bug risk
Error Handling Only Logs Error
Where src/pages/HorseRacing.tsx:41
Issue / Evidence error handling only logs error
Suggested Fix improve user feedback on error conditions (e.g. UI message) to increase business value
Usestate Used Without Import Shown
Where src/components/transactions/TransactionCard.tsx:14
Issue / Evidence useState used without import shown
Suggested Fix confirm import of useState from react to avoid runtime issues
Duplicate Logic
Where src/components/transactions/TransactionTabs.tsx:150
Issue / Evidence complex inline styles and conditional styling repeated
Suggested Fix consider extracting to functions or CSS modules for maintainability
Code Change Preview · src/components/transactions/TransactionCard.tsx ?
Removed / Before Commit
- diff --git a/src/components/transactions/TransactionCard.tsx b/src/components/transactions/TransactionCard.tsx
- index e8d591b..fc690b9 100644
- import { useState } from "react";
- import { formatDate, formatStatusLabel, typeColor } from "./helpers";
- import { ChevronDown, ChevronUp, Flag, User, Target, TrendingUp, Calendar, Hash, CheckCircle, Copy } from "lucide-react";
- 
- export default function TransactionCard({ row, colors, historyType = "single", betType = "current" }: any) {
- const [isExpanded, setIsExpanded] = useState(false);
- 
- if (historyType === "multi") {
- return (
-       <div 
-         className="rounded-[12px] overflow-hidden border-l-4"
-         style={{ 
-           backgroundColor: colors.secondary,
-           borderLeftColor: row.bet_status === "WON" ? "#4ade80" : row.bet_status === "LOST" ? "#f87171" : "#fbbf24"
-         }}
- >
Added / After Commit
+ diff --git a/src/components/transactions/TransactionCard.tsx b/src/components/transactions/TransactionCard.tsx
+ index e8d591b..fc690b9 100644
+ import { useState } from "react";
+ import { formatDate, formatStatusLabel, typeColor } from "./helpers";
+ import { ChevronDown, ChevronUp, CheckCircle, Copy, Hash, Calendar } from "lucide-react";
+ 
+ const getStatusStyles = (status = "") => {
+   const s = status.toUpperCase();
+   if (s === "WON") return { color: "#16a34a", bg: "#dcfce7" };
+   if (s === "LOST") return { color: "#dc2626", bg: "#fee2e2" };
+   if (s === "VOID" || s === "CANCELLED") return { color: "#475569", bg: "#e2e8f0" };
+   return { color: "#ca8a04", bg: "#fef3c7" };
+ };
+ 
+ function DetailRow({ icon, label, value, colors, valueClassName = "", copyable = false }: any) {
+   const [copied, setCopied] = useState(false);
+   return (
+     <div className="flex items-center justify-between py-[5px] border-b last:border-0" style={{ borderColor: `${colors.secondary}60` }}>
Removed / Before Commit
- diff --git a/src/components/transactions/TransactionRow.tsx b/src/components/transactions/TransactionRow.tsx
- index f468c72..2a986ae 100644
- label: "Odds",
- value: row.odds_request || row.odds_matched || "-",
- icon: TrendingUp,
-           color: colors.primary,
- chip: true,
- },
- {
- color: oddsTypeColor,
- chip: true,
- },
- {
- label: "Odds",
- value: row.odds_request || row.odds_matched || "-",
- icon: TrendingUp,
-           color: colors.primary,
- chip: true,
Added / After Commit
+ diff --git a/src/components/transactions/TransactionRow.tsx b/src/components/transactions/TransactionRow.tsx
+ index f468c72..2a986ae 100644
+ label: "Odds",
+ value: row.odds_request || row.odds_matched || "-",
+ icon: TrendingUp,
+           color: colors.accent,
+ chip: true,
+ },
+ {
+ color: oddsTypeColor,
+ chip: true,
+ },
+ 
+ {
+ label: "Odds",
+ value: row.odds_request || row.odds_matched || "-",
+ icon: TrendingUp,
+           color: colors.accent,
Removed / Before Commit
- diff --git a/src/components/transactions/TransactionTabs.tsx b/src/components/transactions/TransactionTabs.tsx
- index b76fe24..69753a7 100644
- import { useRef, useState } from "react";
- import type { TransactionFilters } from "./helpers";
- import { Calendar, ChevronDown,  Clock3, History, RotateCcw } from "lucide-react";
- 
- // const TABS = ['Bet History', 'Deposit', 'Withdraw'];
- 
- return (
- <div className="pt-[10px]">
- <div
-           className="mb-4 rounded-[10px] border px-4 py-4 shadow-sm"
- style={{
- borderColor: `${colors.primary}35`,
- }}
- borderColor: `${colors.secondary}70`,
- }}
- >
Added / After Commit
+ diff --git a/src/components/transactions/TransactionTabs.tsx b/src/components/transactions/TransactionTabs.tsx
+ index b76fe24..69753a7 100644
+ import { useRef, useState } from "react";
+ import type { TransactionFilters } from "./helpers";
+ import { Calendar, ChevronDown, Clock3, Filter, History, RotateCcw } from "lucide-react";
+ 
+ // const TABS = ['Bet History', 'Deposit', 'Withdraw'];
+ 
+ return (
+ <div className="pt-[10px]">
+ <div
+           className="hidden md:block mb-4 rounded-[10px] border px-4 py-4 shadow-sm"
+ style={{
+ borderColor: `${colors.primary}35`,
+ }}
+ borderColor: `${colors.secondary}70`,
+ }}
+ >
Removed / Before Commit
- diff --git a/src/hooks/useThemeColors.ts b/src/hooks/useThemeColors.ts
- index eaef4af..242dc78 100644
- primary: theme?.primaryColor ?? '#0052CC',
- secondary: theme?.secondaryColor ?? '#6B7280',
- background: theme?.backgroundColor ?? '#1C1B22',
-     accent: theme?.accentColor ?? '#0052CC',
- card: theme?.cardColor ?? '#2A2A2A',
- textPrimary: theme?.textPrimary ?? '#FFFFFF',
- textSecondary: theme?.textSecondary ?? '#9CA3AF',
- success: theme?.successColor ?? '#10B981',
- warning: theme?.warningColor ?? '#F59E0B',
- error: theme?.errorColor ?? '#EF4444',
- };
- };
Added / After Commit
+ diff --git a/src/hooks/useThemeColors.ts b/src/hooks/useThemeColors.ts
+ index eaef4af..242dc78 100644
+ primary: theme?.primaryColor ?? '#0052CC',
+ secondary: theme?.secondaryColor ?? '#6B7280',
+ background: theme?.backgroundColor ?? '#1C1B22',
+     accent: theme?.accentColor ?? '#3284ff',
+ card: theme?.cardColor ?? '#2A2A2A',
+ textPrimary: theme?.textPrimary ?? '#FFFFFF',
+ textSecondary: theme?.textSecondary ?? '#9CA3AF',
+ success: theme?.successColor ?? '#10B981',
+ warning: theme?.warningColor ?? '#F59E0B',
+ error: theme?.errorColor ?? '#EF4444',
+     
+ };
+ };
Removed / Before Commit
- diff --git a/src/main.tsx b/src/main.tsx
- index cac0984..f63e7ab 100644
- import { StrictMode } from 'react'
- import { createRoot } from 'react-dom/client'
- import './index.css'
- import App from './App.tsx'
- import '@fortawesome/fontawesome-free/css/all.min.css';
- 
- createRoot(document.getElementById('root')!).render(
-   <StrictMode>
- <ConfigProvider>
- <AuthProvider>
- <GlobalAuthModalProvider>
- </GlobalAuthModalProvider>
- </AuthProvider>
- </ConfigProvider>
-   </StrictMode>,
- )
Added / After Commit
+ diff --git a/src/main.tsx b/src/main.tsx
+ index cac0984..f63e7ab 100644
+ // import { StrictMode } from 'react'
+ import { createRoot } from 'react-dom/client'
+ import './index.css'
+ import App from './App.tsx'
+ import '@fortawesome/fontawesome-free/css/all.min.css';
+ 
+ createRoot(document.getElementById('root')!).render(
+   // <StrictMode>
+ <ConfigProvider>
+ <AuthProvider>
+ <GlobalAuthModalProvider>
+ </GlobalAuthModalProvider>
+ </AuthProvider>
+ </ConfigProvider>
+   // </StrictMode>,
+ )
Removed / Before Commit
- diff --git a/src/pages/AccountStatement.tsx b/src/pages/AccountStatement.tsx
- index 1385a66..40b0b21 100644
- <h3 style={{ color: colors.textPrimary }}>Account Statement</h3>
- </div>
- 
-           <div
- className="hidden h-[35px] min-w-[260px] items-center justify-center rounded-[10px] px-4 text-[12px] font-semibold md:flex"
- style={{ backgroundColor: colors.primary, color: "#000" }}
- >
- Available Credit: {formatAmount(Number(availableCredit || 0))}
-           </div>
- </div>
- 
- <div className="mb-3 flex justify-end md:hidden">
Added / After Commit
+ diff --git a/src/pages/AccountStatement.tsx b/src/pages/AccountStatement.tsx
+ index 1385a66..40b0b21 100644
+ <h3 style={{ color: colors.textPrimary }}>Account Statement</h3>
+ </div>
+ 
+           {/* <div
+ className="hidden h-[35px] min-w-[260px] items-center justify-center rounded-[10px] px-4 text-[12px] font-semibold md:flex"
+ style={{ backgroundColor: colors.primary, color: "#000" }}
+ >
+ Available Credit: {formatAmount(Number(availableCredit || 0))}
+           </div> */}
+ </div>
+ 
+ <div className="mb-3 flex justify-end md:hidden">
Removed / Before Commit
- diff --git a/src/pages/HorseRacing.tsx b/src/pages/HorseRacing.tsx
- index 011f353..94a7ba1 100644
- import { useEffect, useState } from "react"
- import { getRaceEvents, getCountries } from "../services/racing"
- import type { Country, RaceEvent, Race } from "../types/racing"
- import BannerCarousel from "../components/banner/BannerCarousel"
- const [loading, setLoading] = useState(true)
- const [watchLiveRaceId, setWatchLiveRaceId] = useState<string | null>(null)
- const selectedCountry = countries.find((country) => country._id === activeCountry) ?? null
- 
- useEffect(() => {
- loadCountries()
- }, [])
- 
-   useEffect(() => {
-     if (activeCountry) {
-       loadRaceEvents(activeCountry)
- }
Added / After Commit
+ diff --git a/src/pages/HorseRacing.tsx b/src/pages/HorseRacing.tsx
+ index 011f353..94a7ba1 100644
+ import { useEffect, useState,useRef } from "react"
+ import { getRaceEvents, getCountries } from "../services/racing"
+ import type { Country, RaceEvent, Race } from "../types/racing"
+ import BannerCarousel from "../components/banner/BannerCarousel"
+ const [loading, setLoading] = useState(true)
+ const [watchLiveRaceId, setWatchLiveRaceId] = useState<string | null>(null)
+ const selectedCountry = countries.find((country) => country._id === activeCountry) ?? null
+   const hasFetchedEvents = useRef(false)
+ 
+ useEffect(() => {
+ loadCountries()
+ }, [])
+ 
+ useEffect(() => {
+   if (!activeCountry) return
+ 
Removed / Before Commit
- diff --git a/src/pages/HorseRacingDetails.tsx b/src/pages/HorseRacingDetails.tsx
- index 15b120b..2c52ae7 100644
- 
- 
- 
- const DEFAULT_FANCY_TYPE = "DEFAULT"
- const STANDALONE_FANCY_TYPES = new Set(["OBJECTION", "ODDS & EVENS", "PHOTO"])
- const MARKET_TYPE_DISPLAY_ORDER = [
- const filteredMarkets = filterMarketsBySettleFlags(marketsData.data || [], race)
- const transformedMarkets = transformRaceMarkets(filteredMarkets)
- 
-     // Fetch exposure data and merge
- try {
- const exposureResponse = await getRaceExposure(raceId)
- if (exposureResponse.success && exposureResponse.data) {
Added / After Commit
+ diff --git a/src/pages/HorseRacingDetails.tsx b/src/pages/HorseRacingDetails.tsx
+ index 15b120b..2c52ae7 100644
+ 
+ 
+ 
+ 
+ const DEFAULT_FANCY_TYPE = "DEFAULT"
+ const STANDALONE_FANCY_TYPES = new Set(["OBJECTION", "ODDS & EVENS", "PHOTO"])
+ const MARKET_TYPE_DISPLAY_ORDER = [
+ const filteredMarkets = filterMarketsBySettleFlags(marketsData.data || [], race)
+ const transformedMarkets = transformRaceMarkets(filteredMarkets)
+ 
+     
+ try {
+ const exposureResponse = await getRaceExposure(raceId)
+ if (exposureResponse.success && exposureResponse.data) {
Removed / Before Commit
- diff --git a/src/pages/RaceDetail.tsx b/src/pages/RaceDetail.tsx
- index dd43085..d09573d 100644
- 
- const [raceData, marketsData] = await Promise.all([
- getRaceDetails(raceId),
- getRaceMarkets(raceId)
- ])
- 
- setRace(raceData)
- setMarkets(marketsData.data || [])
- } catch (err) {
- if (loading) {
- return (
- <div className="flex justify-center items-center min-h-[400px]">
-         <div style={{ color: colors.textPrimary }}>Loading race details...</div>
- </div>
- )
- }
Added / After Commit
+ diff --git a/src/pages/RaceDetail.tsx b/src/pages/RaceDetail.tsx
+ index dd43085..d09573d 100644
+ 
+ const [raceData, marketsData] = await Promise.all([
+ getRaceDetails(raceId),
+           
+ getRaceMarkets(raceId)
+ ])
+         
+ setRace(raceData)
+ setMarkets(marketsData.data || [])
+ } catch (err) {
+ if (loading) {
+ return (
+ <div className="flex justify-center items-center min-h-[400px]">
+         <div style={{ color: colors.textPrimary }}>Loading race details</div>
+ </div>
+ )
Removed / Before Commit
- diff --git a/src/services/racing.ts b/src/services/racing.ts
- index ff77c9d..e929594 100644
- import type { RaceMarketsResponse } from "../types/raceMarkets"
- import { API_ENDPOINTS, getApiHeaders, getPublicApiHeaders } from "../config/api.config"
- 
- export const getCountries = async (): Promise<Country[]> => {
- const response = await fetch(`${API_ENDPOINTS.RACING}/getCountries`, {
- method: "GET",
- headers: getApiHeaders(),
- })
- 
- const data = await response.json()
- return data.data
- }
- 
- export const getRaceEvents = async (countryId: string): Promise<RaceEvent[]> => {
-   const response = await fetch(
-     `${API_ENDPOINTS.RACING}/getRaceEvents?country_id=${countryId}`,
Added / After Commit
+ diff --git a/src/services/racing.ts b/src/services/racing.ts
+ index ff77c9d..e929594 100644
+ import type { RaceMarketsResponse } from "../types/raceMarkets"
+ import { API_ENDPOINTS, getApiHeaders, getPublicApiHeaders } from "../config/api.config"
+ 
+ let countriesCache: Country[] | null = null
+ 
+ 
+ export const getCountries = async (): Promise<Country[]> => {
+   console.log(">>> getCountries API")
+ 
+   if (countriesCache) {
+     console.log("⚡ Returning cached countries")
+     return countriesCache
+   }
+ 
+ const response = await fetch(`${API_ENDPOINTS.RACING}/getCountries`, {
+ method: "GET",