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
?
73%
Quality Avg
?
74%
Security Avg
?
74%
Reviews
?
130
Review Result ?
solutionbowl/crm-dashbaord · ae2478e6
The commit improves numeric input handling by sanitizing input values to allow or disallow decimals based on a flag. It also restricts invalid characters and manages decimal points correctly. The changes reduce potential input errors and improve data integrity in the admin race page inputs allowing decimals accurately where needed.
Quality
?
85%
Security
?
90%
Business Value
?
75%
Maintainability
?
83%
Issues & Suggested Fixes
?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Regex Could Mistakenly Allow Multiple Deci...
Where
src/modules/horse/pages/Race/AdminRacepage.tsx:502
Issue / Evidence
regex could mistakenly allow multiple decimal points by joining parts
Suggested Fix
refine logic to prevent multiple decimals explicitly
Inserting Text At Selection Could Cause Is...
Where
src/modules/horse/pages/Race/AdminRacepage.tsx:514
Issue / Evidence
inserting text at selection could cause issues if cursor position or selection range is invalid
Suggested Fix
add validation for cursor positions
Duplicate Logic
Where
src/modules/horse/pages/Race/AdminRacepage.tsx:570
Issue / Evidence
repeated calls to allowsAdminDecimal on event.target
Suggested Fix
cache this in a variable to improve efficiency
Early Returns In Event Handlers Could Bene...
Where
src/modules/horse/pages/Race/AdminRacepage.tsx:575
Issue / Evidence
early returns in event handlers could benefit from clearer documentation or comments explaining why return occurs
Suggested Fix
Review and simplify this section.
2063
Where
src/modules/horse/pages/Race/AdminRacepage.tsx:2010
Issue / Evidence
2063
Suggested Fix
multiple similar input elements with data-admin-decimal="true" could be centralized using a reusable component or config to reduce duplication
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 42498f8..bf2227f 100644 - const isAdminNavInput = (target: EventTarget | null): target is HTMLInputElement => - target instanceof HTMLInputElement && target.matches('input[data-admin-nav="true"]'); - - const keepDigitsOnly = (value: string) => value.replace(/\D/g, ""); - - const syncAdminInputValue = (input: HTMLInputElement, value: string) => { - input.value = value; - input.dispatchEvent(new Event("input", { bubbles: true })); - }; - - const insertDigitsAtSelection = (input: HTMLInputElement, digits: string) => { - let start = input.value.length; - let end = start; - - end = start; - }
Added / After Commit
+ diff --git a/src/modules/horse/pages/Race/AdminRacepage.tsx b/src/modules/horse/pages/Race/AdminRacepage.tsx + index 42498f8..bf2227f 100644 + const isAdminNavInput = (target: EventTarget | null): target is HTMLInputElement => + target instanceof HTMLInputElement && target.matches('input[data-admin-nav="true"]'); + + const keepAdminNumericValue = (value: string, allowDecimal: boolean) => { + if (!allowDecimal) return value.replace(/\D/g, ""); + + const numeric = value.replace(/[^\d.]/g, ""); + const [whole = "", ...decimalParts] = numeric.split("."); + return decimalParts.length > 0 ? `${whole}.${decimalParts.join("")}` : whole; + }; + + const allowsAdminDecimal = (input: HTMLInputElement) => input.dataset.adminDecimal === "true"; + + const syncAdminInputValue = (input: HTMLInputElement, value: string) => { + input.value = value; + input.dispatchEvent(new Event("input", { bubbles: true }));