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 · d504be21
This commit adds extensive logging and UI updates related to sports betting odds. The updates offer improved visibility into real-time odds changes and user interface feedback for flashing odds. However, the presence of many console.log statements throughout production code raises concerns about noise during runtime and potential performance impact. UI changes are minor but useful. There is a moderate risk of bugs due to the complexity of updating nested state objects and potentially missing robust error handling or validation. No direct security enhancements or threats are evident, but the use of deep dependency arrays might cause inefficiencies or missed updates. The commit message is minimal and non-descriptive.
Quality
?
65%
Security
?
40%
Business Value
?
70%
Maintainability
?
65%
Issues & Suggested Fixes
?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Excessive Console.log Statements In Produc...
Where
src/components/sports/SportsMatchList.tsx:90
Issue / Evidence
excessive console.log statements in production code
Suggested Fix
replace or remove debug logs to improve performance and code cleanliness
Multiple Side Effects In Render Logic With...
Where
src/components/sports/SportsMatchList.tsx:182
Issue / Evidence
multiple side-effects in render logic with console.logs
Suggested Fix
remove or batch logs to reduce noise and improve maintainability
Long Function
Where
src/components/sports/SportsMatchList.tsx:210
Issue / Evidence
complex state update logic for nested objects without error handling
Suggested Fix
add validation and consider using updater functions to reduce mutation risks
Deep Dependency On Stringified Matches Obj...
Where
src/components/sports/SportsMatchList.tsx:220
Issue / Evidence
deep dependency on stringified matches object for useEffect
Suggested Fix
optimize this dependency to prevent unnecessary renders
Console.log Usage
Where
src/hooks/useListingOddsSocket.ts:47
Issue / Evidence
console.log usage
Suggested Fix
remove or replace with proper logging framework before shipping code
Console.log Statements On Initial Matches...
Where
src/pages/Home.tsx:28
Issue / Evidence
console.log statements on initial matches load
Suggested Fix
remove or replace with debug flag to control logging
Verbose Socket Data Logging
Where
src/pages/Home.tsx:40
Issue / Evidence
verbose socket data logging
Suggested Fix
limit logging level in production to prevent log flooding
Non Descriptive And Unhelpful
Where
commit message
Issue / Evidence
non-descriptive and unhelpful
Suggested Fix
provide detailed message explaining feature, fixes, impact and rationale
Code Change Preview · src/components/sports/MarketCard.tsx
?
Removed / Before Commit
- diff --git a/src/components/sports/MarketCard.tsx b/src/components/sports/MarketCard.tsx - index d08beb4..2f1ac5d 100644 - <div style={{ backgroundColor: colors.card }} className="flex items-center gap-2 p-[10px] border-b border-gray-700 text-[12px] font-semibold"> - <div className="flex-1 min-w-[120px]" style={{ color: colors.textSecondary }}>Runner</div> - <div className="flex gap-[5px] flex-1 max-w-[250px]"> - <div className="flex-1 text-center" style={{ color: colors.textSecondary, marginLeft: '70px' }}>Back</div> - </div> - <div className="flex gap-[5px] flex-1 max-w-[250px]"> - <div className="flex-1 text-center" style={{ color: colors.textSecondary, marginRight: '215px' }}>Lay</div> - </div> - </div> - {market.runners.map((runner) => (
Added / After Commit
+ diff --git a/src/components/sports/MarketCard.tsx b/src/components/sports/MarketCard.tsx + index d08beb4..2f1ac5d 100644 + <div style={{ backgroundColor: colors.card }} className="flex items-center gap-2 p-[10px] border-b border-gray-700 text-[12px] font-semibold"> + <div className="flex-1 min-w-[120px]" style={{ color: colors.textSecondary }}>Runner</div> + <div className="flex gap-[5px] flex-1 max-w-[250px]"> + <div className="flex-1 text-center" style={{ color: colors.textSecondary, marginLeft: '105px' }}>Back</div> + </div> + <div className="flex gap-[3px] flex-1 max-w-[275px]"> + <div className="flex-1 text-center" style={{ color: colors.textSecondary, marginRight: '275px' }}>Lay</div> + </div> + </div> + {market.runners.map((runner) => (
Removed / Before Commit
- diff --git a/src/components/sports/MarketRunner.tsx b/src/components/sports/MarketRunner.tsx - index b61f1af..e3926b5 100644 - </div> - - {/* Odds / Suspended */} - <div className="relative flex items-center justify-center w-full"> - {marketStatus && ['suspended', 'closed', 'ball running'].includes(marketStatus.toLowerCase()) && ( - <div className="absolute inset-0 flex items-center justify-center font-bold text-[11px] text-white z-20 rounded" - style={{ backgroundColor: 'rgba(55,55,55,0.90)', pointerEvents: 'none' }} - - {/* LAY */} - <div className="flex gap-[5px] flex-1 md:max-w-[250px]"> - {displayLayOdds.map((odd, idx) => ( - <OddsButton - key={`lay-${idx}`}
Added / After Commit
+ diff --git a/src/components/sports/MarketRunner.tsx b/src/components/sports/MarketRunner.tsx + index b61f1af..e3926b5 100644 + </div> + + {/* Odds / Suspended */} + <div className="relative flex items-center justify-center " style={{width:'90%'}}> + {marketStatus && ['suspended', 'closed', 'ball running'].includes(marketStatus.toLowerCase()) && ( + <div className="absolute inset-0 flex items-center justify-center font-bold text-[11px] text-white z-20 rounded" + style={{ backgroundColor: 'rgba(55,55,55,0.90)', pointerEvents: 'none' }} + + {/* LAY */} + <div className="flex gap-[5px] flex-1 md:max-w-[250px]"> + + {displayLayOdds.map((odd, idx) => ( + <OddsButton + key={`lay-${idx}`}
Removed / Before Commit
- diff --git a/src/components/sports/SportsMatchList.tsx b/src/components/sports/SportsMatchList.tsx - index b28ecb1..a9c0b8b 100644 - ); - - if (!runner) { - return { backPrice: null, backSize: null, layPrice: null, laySize: null }; - } - - return { - backPrice: runner.back?.price || null, - backSize: runner.back?.size || null, - layPrice: runner.lay?.price || null, - laySize: runner.lay?.size || null, - }; - }; - - const getDrawOdds = (match: any) => { -
Added / After Commit
+ diff --git a/src/components/sports/SportsMatchList.tsx b/src/components/sports/SportsMatchList.tsx + index b28ecb1..a9c0b8b 100644 + ); + + if (!runner) { + console.log(`⚠️ Runner not found for team: ${teamName} in match ${match.eventName}`); + return { backPrice: null, backSize: null, layPrice: null, laySize: null }; + } + + const odds = { + backPrice: runner.back?.price || null, + backSize: runner.back?.size || null, + layPrice: runner.lay?.price || null, + laySize: runner.lay?.size || null, + }; + + // Only log if price is non-zero (to reduce noise) + if (odds.backPrice || odds.layPrice) {
Removed / Before Commit
- diff --git a/src/hooks/useListingOddsSocket.ts b/src/hooks/useListingOddsSocket.ts - index e5970ff..f11fb6a 100644 - }); - - socket.on("listingOdds", (data) => { - console.log("📊 Listing Odds Update:", data); - if (onUpdateRef.current) { - onUpdateRef.current(data); - }
Added / After Commit
+ diff --git a/src/hooks/useListingOddsSocket.ts b/src/hooks/useListingOddsSocket.ts + index e5970ff..f11fb6a 100644 + }); + + socket.on("listingOdds", (data) => { + console.log("� listingOdds event received:"); + console.log(JSON.stringify(data, null, 2)); + + if (onUpdateRef.current) { + onUpdateRef.current(data); + }
Removed / Before Commit
- diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx - index 552293d..0b9923a 100644 - import { useState } from "react"; - import BannerCarousel from "../components/banner/BannerCarousel"; - import SportTabButton from "../components/home/SportTabButton"; - import UpcomingMatchCard from "../components/home/UpcomingMatchCard"; - import LoadingState from "../components/sports/LoadingState"; - import EmptyState from "../components/sports/EmptyState"; - import { useSportsbook, useCasino } from "../hooks"; - import { useThemeColors } from "../hooks/useThemeColors"; - import { useUpcomingMatches } from "../hooks/useUpcomingMatches"; - - export default function Home() { - const sportsbookEnabled = useSportsbook(); - const casinoEnabled = useCasino(); - const colors = useThemeColors(); - const allMatchesTabs = [ - { id: "all", name: "All Matches", icon: "fa-chess-board" },
Added / After Commit
+ diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx + index 552293d..0b9923a 100644 + import { useState, useEffect } from "react"; + import { useParams } from "react-router-dom"; + import BannerCarousel from "../components/banner/BannerCarousel"; + import SportsTabNavigation from "../components/sports/SportsTabNavigation"; + import LoadingState from "../components/sports/LoadingState"; + import EmptyState from "../components/sports/EmptyState"; + import { useSportsMatches } from "../hooks/useSportsMatches"; + import { useListingOddsSocket } from "../hooks/useListingOddsSocket"; + import { getSportId } from "../utils/sportsHelpers"; + import SportsMatchList from "../components/sports/SportsMatchList"; + import type { CricketMatch } from "../types/cricket"; + + export default function Home() { + const { sport } = useParams<{ sport: string }>(); + const [activeTab, setActiveTab] = useState("live"); +
Removed / Before Commit
- diff --git a/src/pages/Sports.tsx b/src/pages/Sports.tsx - index a1fec80..bd04f0a 100644 - - // Update local matches when initial data loads - useEffect(() => { - setMatches(initialMatches); - }, [initialMatches]); - - // Get all event IDs for socket connection - const eventIds = matches.map(m => m.eventId); - - // Socket connection for real-time listing odds updates - const { error: socketError } = useListingOddsSocket(eventIds, (data) => { - console.log("Received listing odds update:", data); - - // Update matches with new listing odds - if (data && data.eventId) { - setMatches(prevMatches =>
Added / After Commit
+ diff --git a/src/pages/Sports.tsx b/src/pages/Sports.tsx + index a1fec80..bd04f0a 100644 + + // Update local matches when initial data loads + useEffect(() => { + console.log("📥 Initial matches loaded:", initialMatches.length); + setMatches(initialMatches); + }, [initialMatches]); + + // Get all event IDs for socket connection + const eventIds = matches.map(m => m.eventId); + + console.log("🎯 Event IDs for socket:", eventIds); + + // Socket connection for real-time listing odds updates + const { isConnected } = useListingOddsSocket(eventIds, (socketData) => { + const timestamp = new Date().toLocaleTimeString(); + console.log(`🔄 [${timestamp}] ========== SOCKET DATA RECEIVED ==========`);