Showing AI reviews for avriti
Project AI Score ?
63%
Quality Avg ?
68%
Security Avg ?
45%
Reviews ?
56

Review Result ?

jattin01/avriti · ac5a7838
This commit adds a reset password form with validation, loading state, error and success handling, and a secure reset password API call. It also introduces a product details page update with an accordion component and a share button in the product detail section. Overall, the code implements user interface improvements and UX enhancements for password resets and product interaction. However, the API call error handling might miss some edge cases, and there is no explicit input sanitization or password strength validation beyond length. Further emphasis on security and improved error feedback would enhance quality.
Quality ?
85%
Security ?
60%
Business Value ?
75%
Maintainability ?
85%
Issues & Suggested Fixes ?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Missing Validation
Where app/reset-password/page.tsx:26
Issue / Evidence Use form element and prevent default submission or add explicit form validation
Suggested Fix change this to improve quality and bug risk score
Security Issue
Where app/reset-password/page.tsx:45
Issue / Evidence Use environment variable NEXT_PUBLIC_API_URL carefully as exposing backend endpoints publicly can pose some security risks
Suggested Fix change this to improve security score
Add More Comprehensive Error Handling For...
Where app/reset-password/page.tsx:53
Issue / Evidence Add more comprehensive error handling for unexpected server responses
Suggested Fix change this to improve bug risk score
Missing Validation
Where app/reset-password/page.tsx:34
Issue / Evidence Add stronger password validation (e.g., complexity requirements) beyond minimum length
Suggested Fix change this to improve security score
Add Fallback Or Error Handling For Sharepr...
Where components/ProductDetailSection.tsx:282
Issue / Evidence Add fallback or error handling for shareProduct function if sharing is unsupported or fails
Suggested Fix change this to improve quality and bug risk score
Consider Accessibility And Keyboard Suppor...
Where components/product-accordion.tsx:21
Issue / Evidence Consider accessibility and keyboard support on accordion toggle button
Suggested Fix change this to improve quality score
Provide More Precise And Detailed Message...
Where commit message
Issue / Evidence Provide more precise and detailed message describing major changes and purpose
Suggested Fix change this to improve business value score
Code Change Preview · app/reset-password/page.tsx ?
Removed / Before Commit

                                                
Added / After Commit
+ "use client";
+ 
+ import { useState, useEffect, Suspense } from "react";
+ import { useSearchParams, useRouter } from "next/navigation";
+ import Link from "next/link";
+ 
+ function ResetPasswordForm() {
+   const searchParams = useSearchParams();
+   const router = useRouter();
+ 
+   const email = searchParams.get("email") || "";
+   const token = searchParams.get("token") || "";
+ 
+   const [password, setPassword] = useState("");
+   const [confirmPassword, setConfirmPassword] = useState("");
+   const [loading, setLoading] = useState(false);
+   const [error, setError] = useState("");
+   const [success, setSuccess] = useState("");
Removed / Before Commit
- import { useParams } from "next/navigation";
- import Breadcrumb from "@/components/common/Breadcrumb";
- import ProductDetailSection from "@/components/ProductDetailSection";
- import ProductTabs from "@/components/product-tabs";
- import { ProductCard } from "@/components/product-card";
- 
- const tones = ["light", "warm", "soft", "fresh"];
- 
- const [featuredProducts, setFeaturedProducts] = useState<FeaturedProduct[]>([]);
- const [description, setDescription] = useState("");
- 
- useEffect(() => {
- fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/product`)
- if (data.success && Array.isArray(data.data)) {
- const currentProduct = data.data.find((p: any) => p.slug === slug);
- setDescription(currentProduct?.description ?? "");
- 
- const relatedProducts = currentProduct
Added / After Commit
+ import { useParams } from "next/navigation";
+ import Breadcrumb from "@/components/common/Breadcrumb";
+ import ProductDetailSection from "@/components/ProductDetailSection";
+ // import ProductTabs from "@/components/product-tabs";
+ import ProductAccordion from "@/components/product-accordion";
+ import { ProductCard } from "@/components/product-card";
+ 
+ const tones = ["light", "warm", "soft", "fresh"];
+ 
+ const [featuredProducts, setFeaturedProducts] = useState<FeaturedProduct[]>([]);
+ const [description, setDescription] = useState("");
+   const [howToUse, setHowToUse] = useState("");
+   const [bestFor, setBestFor] = useState<string[]>([]);
+   const [includes, setIncludes] = useState<string[]>([]);
+ 
+ useEffect(() => {
+ fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/product`)
+ if (data.success && Array.isArray(data.data)) {
Removed / Before Commit
- {attr1 && `- ${attr1.value}${product.variant?.name ? ` ${product.variant.name}` : ''}`}
- </p>
- <button type="button" onClick={(event) => handleWishlist(event, product, attr1)} aria-label="Add to wishlist" className="cursor-pointer">
-                           <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" fill={wishlistIds.includes(product.id) ? "#0b3dba" : "none"} stroke="#0b3dba" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
- <path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
- </svg>
- </button></div>
Added / After Commit
+ {attr1 && `- ${attr1.value}${product.variant?.name ? ` ${product.variant.name}` : ''}`}
+ </p>
+ <button type="button" onClick={(event) => handleWishlist(event, product, attr1)} aria-label="Add to wishlist" className="cursor-pointer">
+                           <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" fill={wishlistIds.includes(product.id) ? "#FF0000" : "none"} stroke="#FF0000" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
+ <path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
+ </svg>
+ </button></div>
Removed / Before Commit

                                                
Added / After Commit
+ "use client";
+ 
+ import { useState } from "react";
+ 
+ type AccordionItem = {
+   title: string;
+   content: React.ReactNode;
+   defaultOpen?: boolean;
+ };
+ 
+ function AccordionRow({ title, content, defaultOpen = false }: AccordionItem) {
+   const [open, setOpen] = useState(defaultOpen);
+ 
+   return (
+     <div
+       style={{
+         borderBottom: "1px solid #ede8e1",
+       }}
Removed / Before Commit
- </div>
- );
- }
Added / After Commit
+ </div>
+ );
+ }
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
Removed / Before Commit
- 
- import { useEffect, useState } from "react";
- import { isLoggedIn, addToLocalCart, apiAddToCart } from "@/lib/cart";
- 
- type Attribute = {
- sr_no: number;
- </button> */}
- </div>
- 
-             <a href="/contact" className="text-[14px] text-[#0b3dba] underline">Any Question? Please Ask Us Here.</a>
- 
-             
- 
- </div>
- </div>
Added / After Commit
+ 
+ import { useEffect, useState } from "react";
+ import { isLoggedIn, addToLocalCart, apiAddToCart } from "@/lib/cart";
+ import { shareProduct } from "@/lib/share";
+ 
+ type Attribute = {
+ sr_no: number;
+ </button> */}
+ </div>
+ 
+             <div className="flex items-center justify-between gap-3 flex-wrap">
+               <a href="/contact" className="text-[14px] text-[#0b3dba] underline">Any Question? Please Ask Us Here.</a>
+ 
+               <button
+                 type="button"
+                 onClick={() => shareProduct(product.slug, product.title)}
+                 className="flex items-center gap-2 text-[14px] text-[#0b3dba] border border-[#0b3dba] rounded-[8px] px-3 py-1.5 hover:bg-[#eef4ff] transition cursor-pointer"
+               >