Showing AI reviews for crm-dashbaord
Project AI Score ?
73%
Quality Avg ?
74%
Security Avg ?
74%
Reviews ?
130

Review Result ?

solutionbowl/crm-dashbaord · 99f81404
This commit adds functionality to toggle the visibility of Back and Lay static volume data in the AdminRacepage and AdminMarketPage components. The implementation uses React state and callbacks to manage hiding/showing these metrics, integrating checkboxes with tooltips that improve the user interface and experience. The code is well-structured and consistent across both pages but lacks automated tests and some minor code clarity improvements.
Quality ?
85%
Security ?
90%
Business Value ?
80%
Maintainability ?
88%
Issues & Suggested Fixes ?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Lack Of Comments
Where src/modules/horse/pages/Race/AdminRacepage.tsx:456
Issue / Evidence lack of comments
Suggested Fix add brief comments describing the purpose of these new states to improve maintainability
Missing Test Coverage
Where src/modules/horse/pages/Race/AdminRacepage.tsx:560
Issue / Evidence no tests for toggleBackStaticVol
Suggested Fix add unit tests for toggleBackStaticVol to reduce bug risk
Missing Test Coverage
Where src/modules/horse/pages/Race/AdminRacepage.tsx:569
Issue / Evidence no tests for toggleLayStaticVol
Suggested Fix add unit tests for toggleLayStaticVol to reduce bug risk
Lack Of Comments
Where src/pages/Platforms/AdminMarketPage.tsx:556
Issue / Evidence lack of comments
Suggested Fix add brief comments describing the purpose of these new states to improve maintainability
Missing Test Coverage
Where src/pages/Platforms/AdminMarketPage.tsx:711
Issue / Evidence no tests for toggleBackStaticVol
Suggested Fix add unit tests for toggleBackStaticVol to reduce bug risk
Missing Test Coverage
Where src/pages/Platforms/AdminMarketPage.tsx:720
Issue / Evidence no tests for toggleLayStaticVol
Suggested Fix add unit tests for toggleLayStaticVol to reduce bug risk
Vague Description And Poor Grammar
Where commit message
Issue / Evidence vague description and poor grammar
Suggested Fix improve commit message by clearly describing the feature added and fixing grammar (e.g. 'Add toggles to hide/show Back and Lay static volume tables')
Unnecessary Marginleft Conditional
Where src/modules/horse/pages/Race/AdminRacepage.tsx:1126
Issue / Evidence unnecessary marginLeft conditional
Suggested Fix simplify style marginLeft to a constant if both conditions yield same value to reduce confusion
Unnecessary Marginleft Conditional
Where src/pages/Platforms/AdminMarketPage.tsx:1312
Issue / Evidence unnecessary marginLeft conditional
Suggested Fix simplify style marginLeft to a constant if both conditions yield same value to reduce confusion
Code Change Preview · src/modules/horse/pages/Race/AdminRacepage.tsx ?
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Race/AdminRacepage.tsx b/src/modules/horse/pages/Race/AdminRacepage.tsx
- index 5c02dbc..00f162b 100644
- const [selectedIds,    setSelectedIds]    = useState<Set<string>>(new Set());
- const [globalStates,   setGlobalStates]   = useState<Record<string, GlobalState>>({});
- const [percentColumnMarketIds, setPercentColumnMarketIds] = useState<Set<string>>(new Set());
- 
- useEffect(() => {
- if (selectedRaceId) fetchOdds(selectedRaceId);
- });
- }, []);
- 
- const selectedMarkets = useMemo(() => {
- return markets.filter((market) => selectedIds.has(market.marketId));
- }, [markets, selectedIds]);
- const showDeadHeatToggle = isPhotoFancyMarket(market.marketType, market.marketName, market.fancy_type);
- const canTogglePercentColumns = isPlaceMarketType(market.marketType, market.marketName) && !isFancy;
- const showPercentColumns = canTogglePercentColumns && percentColumnMarketIds.has(market.marketId);
- // const statusSpacerColumnCount = (isWinner || isFancy || canTogglePercentColumns ) ? 6 : 0 ;
Added / After Commit
+ diff --git a/src/modules/horse/pages/Race/AdminRacepage.tsx b/src/modules/horse/pages/Race/AdminRacepage.tsx
+ index 5c02dbc..00f162b 100644
+ const [selectedIds,    setSelectedIds]    = useState<Set<string>>(new Set());
+ const [globalStates,   setGlobalStates]   = useState<Record<string, GlobalState>>({});
+ const [percentColumnMarketIds, setPercentColumnMarketIds] = useState<Set<string>>(new Set());
+   const [hideBackStaticVolMarketIds, setHideBackStaticVolMarketIds] = useState<Set<string>>(new Set());
+   const [hideLayStaticVolMarketIds,  setHideLayStaticVolMarketIds]  = useState<Set<string>>(new Set());
+ 
+ useEffect(() => {
+ if (selectedRaceId) fetchOdds(selectedRaceId);
+ });
+ }, []);
+ 
+   const toggleBackStaticVol = useCallback((marketId: string, value: boolean) => {
+     setHideBackStaticVolMarketIds(prev => {
+       const next = new Set(prev);
+       if (!value) next.add(marketId); // checkbox unchecked = hide
+       else next.delete(marketId);
Removed / Before Commit
- diff --git a/src/pages/Platforms/AdminMarketPage.tsx b/src/pages/Platforms/AdminMarketPage.tsx
- index dcd55ae..481c861 100644
- const [selectedIds,    setSelectedIds]    = useState<Set<string>>(new Set());
- const [globalStates,   setGlobalStates]   = useState<Record<string, GlobalState>>({});
- const [percentColumnMarketIds, setPercentColumnMarketIds] = useState<Set<string>>(new Set());
- const [confirmedWithdrawnRunnerKeys, setConfirmedWithdrawnRunnerKeys] = useState<Set<string>>(new Set());
- const assignedRacesLoadedRef = useRef(false);
- const permissionsKey = permissions.join(",");
- });
- }, []);
- 
- const selectedMarkets = useMemo(() => {
- return markets.filter((market) => selectedIds.has(market.marketId));
- }, [markets, selectedIds]);
- const showDeadHeatToggle = isPhotoFancyMarket(market.marketType, market.marketName, market.fancy_type);
- const canTogglePercentColumns = isPlaceMarketType(market.marketType, market.marketName) && !isFancy;
- const showPercentColumns = canTogglePercentColumns && percentColumnMarketIds.has(market.marketId);
- // const statusSpacerColumnCount = (isWinner || isFancy || canTogglePercentColumns) ? 6 : 0;
Added / After Commit
+ diff --git a/src/pages/Platforms/AdminMarketPage.tsx b/src/pages/Platforms/AdminMarketPage.tsx
+ index dcd55ae..481c861 100644
+ const [selectedIds,    setSelectedIds]    = useState<Set<string>>(new Set());
+ const [globalStates,   setGlobalStates]   = useState<Record<string, GlobalState>>({});
+ const [percentColumnMarketIds, setPercentColumnMarketIds] = useState<Set<string>>(new Set());
+   const [hideBackStaticVolMarketIds, setHideBackStaticVolMarketIds] = useState<Set<string>>(new Set());
+   const [hideLayStaticVolMarketIds,  setHideLayStaticVolMarketIds]  = useState<Set<string>>(new Set());
+ const [confirmedWithdrawnRunnerKeys, setConfirmedWithdrawnRunnerKeys] = useState<Set<string>>(new Set());
+ const assignedRacesLoadedRef = useRef(false);
+ const permissionsKey = permissions.join(",");
+ });
+ }, []);
+ 
+   const toggleBackStaticVol = useCallback((marketId: string, value: boolean) => {
+     setHideBackStaticVolMarketIds(prev => {
+       const next = new Set(prev);
+       if (!value) next.add(marketId); // checkbox unchecked = hide
+       else next.delete(marketId);