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
?
63%
Quality Avg
?
68%
Security Avg
?
45%
Reviews
?
56
Review Result ?
jattin01/avriti · 9f357d88
The commit adds new product detail fields to UI components and renders them conditionally, increasing the product information richness. The implementation is mostly straightforward but includes several uses of 'dangerouslySetInnerHTML' which could pose security risks if not properly sanitized. Some tabs and fields are commented out or partially implemented.
Quality
?
75%
Security
?
40%
Business Value
?
85%
Maintainability
?
78%
Issues & Suggested Fixes
?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Using 'Dangerouslysetinnerhtml' Can Introd...
Where
components/product-accordion.tsx:116-120
Issue / Evidence
Using 'dangerouslySetInnerHTML' can introduce XSS risk
Suggested Fix
ensure input is sanitized before rendering or use safer rendering methods
Missing Validation
Where
components/product-accordion.tsx:131-134
Issue / Evidence
Use caution with 'dangerouslySetInnerHTML' here as well; validate or sanitize storage instructions content
Suggested Fix
Review and simplify this section.
Message Is Vague And Lacks Detail About Th...
Where
commit message
Issue / Evidence
Message is vague and lacks detail about the fields added
Suggested Fix
improve message clarity and detail to enhance business context and reviewability
Code For Rendering 'One Line Meaning' Tab...
Where
components/product-accordion.tsx:316-320
Issue / Evidence
Code for rendering 'One-Line Meaning' tab is commented out
Suggested Fix
review whether to enable and integrate or remove dead code to improve maintainability
Group Related Usestate Hooks Or Replace Wi...
Where
app/shop/[slug]/page.tsx:38-42
Issue / Evidence
Group related useState hooks or replace with a single state object to improve code maintainability and readability
Suggested Fix
Review and simplify this section.
Code Change Preview · app/shop/[slug]/page.tsx
?
Removed / Before Commit
- const [howToUse, setHowToUse] = useState<string[]>([]); - const [bestFor, setBestFor] = useState<string[]>([]); - const [includes, setIncludes] = useState<string[]>([]); - - useEffect(() => { - fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/product`) - setHowToUse(currentProduct?.how_to_use ?? []); - setBestFor(currentProduct?.best_for ?? []); - setIncludes(currentProduct?.includes ?? []); - - const relatedProducts = currentProduct - ? data.data.filter((p: any) => p.category_id === currentProduct.category_id && p.slug !== slug).slice(0, 3) - <Breadcrumb /> - <ProductDetailSection slug={slug} /> - {/* <ProductTabs description={description} /> */} - <ProductAccordion description={description} howToUse={howToUse} bestFor={bestFor} includes={includes} /> - - {/* Related Products */}
Added / After Commit
+ const [howToUse, setHowToUse] = useState<string[]>([]); + const [bestFor, setBestFor] = useState<string[]>([]); + const [includes, setIncludes] = useState<string[]>([]); + const [disclaimer, setDisclaimer] = useState(""); + const [importantNotes, setImportantNotes] = useState(""); + const [storageInstructions, setStorageInstructions] = useState(""); + const [countryOfOrigin, setCountryOfOrigin] = useState(""); + const [oneLineMeaning, setOneLineMeaning] = useState(""); + + useEffect(() => { + fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/product`) + setHowToUse(currentProduct?.how_to_use ?? []); + setBestFor(currentProduct?.best_for ?? []); + setIncludes(currentProduct?.includes ?? []); + setDisclaimer(currentProduct?.disclaimer ?? ""); + setImportantNotes(currentProduct?.important_notes ?? ""); + setStorageInstructions(currentProduct?.storage_instructions ?? ""); + setCountryOfOrigin(currentProduct?.country_of_origin ?? "");
Removed / Before Commit
- howToUse?: string[]; - bestFor?: string[]; - includes?: string[]; - }; - - export default function ProductAccordion({ description, howToUse, bestFor, includes }: ProductAccordionProps) { - const sections: AccordionItem[] = [ - { - title: "Shipping Policy", - defaultOpen:false, - </div> - ), - }, - { - title: "Disclaimer", - content: ( - <div style={{ display: "flex", flexDirection: "column", gap: "14px" }}> - <p>This product is a ritual tool and makes no claims of guaranteed outcomes. It is intended for spiritual, ritual, and energetic purposes only and is not intended to diagnose, treat, cure, or prevent any medical, psychological, legal, financial, or personal condition.</p>
Added / After Commit
+ howToUse?: string[]; + bestFor?: string[]; + includes?: string[]; + disclaimer?: string; + importantNotes?: string; + storageInstructions?: string; + countryOfOrigin?: string; + oneLineMeaning?: string; + }; + + export default function ProductAccordion({ + description, + howToUse, + bestFor, + includes, + disclaimer, + importantNotes, + storageInstructions,
Removed / Before Commit
- title: string; - slug: string; - short_description?: string; - - attributes?: Attribute[]; - thumbnail?: string[]; - category?: { name: string }; - - {/* Description */} - <div - className="text-[15px] leading-relaxed text-[#6b6060] mb-5 pb-5 border-b border-[#e5ddd5]" - dangerouslySetInnerHTML={{ __html: product.short_description ?? "" }} - /> - - {/* Quantity + Add to Cart */} - <div className="flex items-center gap-4 mb-4"> - {/* Quantity */} - </button>
Added / After Commit
+ title: string; + slug: string; + short_description?: string; + one_line_meaning?: string; + fragrance?: string[]; + sold_as?: string[]; + attributes?: Attribute[]; + thumbnail?: string[]; + category?: { name: string }; + + {/* Description */} + <div + className="text-[15px] leading-relaxed text-[#6b6060] mb-3" + dangerouslySetInnerHTML={{ __html: product.short_description ?? "" }} + /> + + {/* Fragrance + Sold As */} + {((product.fragrance?.length ?? 0) > 0 || (product.sold_as?.length ?? 0) > 0) && (