Showing AI reviews for super-admin
Project AI Score ?
72%
Quality Avg ?
77%
Security Avg ?
64%
Reviews ?
91

Review Result ?

solutionbowl/super-admin · 57794c89
The commit introduces new features for image handling, date range filtering, and activity reporting improvements across multiple files. The updates add meaningful UI components and utility functions, improving functionality. However, the commit message is vague and does not describe what issues are fixed or what was added. Some minor cleanups and more descriptive messages could improve understanding and traceability.
Quality ?
75%
Security ?
80%
Business Value ?
50%
Maintainability ?
73%
Issues & Suggested Fixes ?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Issue
Where commit message
Issue / Evidence issue
Suggested Fix provide a detailed and specific commit message explaining what issue is fixed and what the changes achieve
Code Clarity
Where src/routes/marketing.tsx:80
Issue / Evidence code clarity
Suggested Fix add comments to explain the use of existingImageUrl and bannerImageInputRef state variables
Code Robustness
Where src/routes/marketing.tsx:377
Issue / Evidence code robustness
Suggested Fix add error handling or checks when filtering images to avoid unexpected runtime errors
User Experience
Where src/routes/transfer-statement.tsx:141
Issue / Evidence user experience
Suggested Fix validate and unify date parsing and formatting into helper functions to avoid duplication and reduce errors
Code Clarity
Where src/routes/user-details.$userId.tsx:353
Issue / Evidence code clarity
Suggested Fix add explanatory comments for normalizeValue and resolveActivitySegment to clarify use cases
Data Safety
Where src/routes/user-details.$userId.tsx:367
Issue / Evidence data safety
Suggested Fix add type validation and error handling for activity data to avoid bugs from unexpected values
Code Change Preview · src/routes/marketing.tsx ?
Removed / Before Commit
- diff --git a/src/routes/marketing.tsx b/src/routes/marketing.tsx
- index d6b9943..8fecb87 100644
- import { createFileRoute } from "@tanstack/react-router";
- import { useMutation, useQuery } from "@tanstack/react-query";
- import { useEffect, useState } from "react";
- import { motion } from "motion/react";
- import { Card } from "@/components/ui/card";
- import { Button } from "@/components/ui/button";
- const [formData, setFormData] = useState<BannerFormValues>(() => emptyForm());
- const [formError, setFormError] = useState("");
- const [imagePreviews, setImagePreviews] = useState<Array<{ name: string; url: string }>>([]);
- 
- const bannersQuery = useQuery({
- queryKey: ["banners", page, limit, search],
- const clearForm = () => {
- setEditingBanner(null);
- setFormData(emptyForm());
- setFormError("");
Added / After Commit
+ diff --git a/src/routes/marketing.tsx b/src/routes/marketing.tsx
+ index d6b9943..8fecb87 100644
+ import { createFileRoute } from "@tanstack/react-router";
+ import { useMutation, useQuery } from "@tanstack/react-query";
+ import { useEffect, useRef, useState } from "react";
+ import { motion } from "motion/react";
+ import { Card } from "@/components/ui/card";
+ import { Button } from "@/components/ui/button";
+ const [formData, setFormData] = useState<BannerFormValues>(() => emptyForm());
+ const [formError, setFormError] = useState("");
+ const [imagePreviews, setImagePreviews] = useState<Array<{ name: string; url: string }>>([]);
+   const [existingImageUrl, setExistingImageUrl] = useState("");
+   const bannerImageInputRef = useRef<HTMLInputElement | null>(null);
+ 
+ const bannersQuery = useQuery({
+ queryKey: ["banners", page, limit, search],
+ const clearForm = () => {
+ setEditingBanner(null);
Removed / Before Commit
- diff --git a/src/routes/pl-by-agent.tsx b/src/routes/pl-by-agent.tsx
- index c22ad80..01edc59 100644
- }
- 
- function formatDateInput(date: Date) {
-   return date.toISOString().split("T")[0];
- }
- 
- function SectionRow({ label, variant }: { label: string; variant: "date" | "race" }) {
Added / After Commit
+ diff --git a/src/routes/pl-by-agent.tsx b/src/routes/pl-by-agent.tsx
+ index c22ad80..01edc59 100644
+ }
+ 
+ function formatDateInput(date: Date) {
+   const year = date.getFullYear();
+   const month = String(date.getMonth() + 1).padStart(2, "0");
+   const day = String(date.getDate()).padStart(2, "0");
+ 
+   return `${year}-${month}-${day}`;
+ }
+ 
+ function SectionRow({ label, variant }: { label: string; variant: "date" | "race" }) {
Removed / Before Commit
- diff --git a/src/routes/pl-by-market.tsx b/src/routes/pl-by-market.tsx
- index 1e78c2c..5094782 100644
- }
- 
- function formatDateInput(date: Date) {
-   return date.toISOString().split("T")[0];
- }
- 
- function SectionRow({ label, variant }: { label: string; variant: "date" | "race" }) {
Added / After Commit
+ diff --git a/src/routes/pl-by-market.tsx b/src/routes/pl-by-market.tsx
+ index 1e78c2c..5094782 100644
+ }
+ 
+ function formatDateInput(date: Date) {
+   const year = date.getFullYear();
+   const month = String(date.getMonth() + 1).padStart(2, "0");
+   const day = String(date.getDate()).padStart(2, "0");
+ 
+   return `${year}-${month}-${day}`;
+ }
+ 
+ function SectionRow({ label, variant }: { label: string; variant: "date" | "race" }) {
Removed / Before Commit
- diff --git a/src/routes/transfer-statement.tsx b/src/routes/transfer-statement.tsx
- index 7c2bde1..6007e9c 100644
- import { createFileRoute } from "@tanstack/react-router";
- import { useState } from "react";
- import { motion } from "motion/react";
- import { useQuery } from "@tanstack/react-query";
- import { authApiClient } from "@/services/api/apiClient";
- import { Card } from "@/components/ui/card";
- import { Button } from "@/components/ui/button";
- import { Input } from "@/components/ui/input";
- import { Calendar, Download } from "lucide-react";
- import {
- Table,
- TableBody,
- }),
- });
- 
- const fetchTransferStatement = async () => {
Added / After Commit
+ diff --git a/src/routes/transfer-statement.tsx b/src/routes/transfer-statement.tsx
+ index 7c2bde1..6007e9c 100644
+ import { createFileRoute } from "@tanstack/react-router";
+ import { useState } from "react";
+ import type { DateRange } from "react-day-picker";
+ import { format } from "date-fns";
+ import { motion } from "motion/react";
+ import { useQuery } from "@tanstack/react-query";
+ import { authApiClient } from "@/services/api/apiClient";
+ import { toast } from "sonner";
+ import { Calendar as CalendarIcon, Download } from "lucide-react";
+ import { Calendar } from "@/components/ui/calendar";
+ import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
+ import { Card } from "@/components/ui/card";
+ import { Button } from "@/components/ui/button";
+ import { Input } from "@/components/ui/input";
+ import {
+ Table,
Removed / Before Commit
- diff --git a/src/routes/user-details.$userId.tsx b/src/routes/user-details.$userId.tsx
- index 1a9ba47..d93b75b 100644
- setDateRange: (range: { from: Date | undefined; to: Date | undefined }) => void;
- formatDateRange: () => string;
- }) {
-   const formatNumber = (num: number) => {
-     return num.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
- };
- 
- const balanceData = [
- {
- label: "Win",
-       today: formatNumber(userActivity?.activity.today.win || 0),
-       days3: formatNumber(userActivity?.activity.threeDays.win || 0),
-       days7: formatNumber(userActivity?.activity.sevenDays.win || 0),
-       days30: formatNumber(userActivity?.activity.thirtyDays.win || 0),
-       lifetime: formatNumber(userActivity?.activity.lifetime.win || 0),
-       rawToday: userActivity?.activity.today.win || 0,
Added / After Commit
+ diff --git a/src/routes/user-details.$userId.tsx b/src/routes/user-details.$userId.tsx
+ index 1a9ba47..d93b75b 100644
+ setDateRange: (range: { from: Date | undefined; to: Date | undefined }) => void;
+ formatDateRange: () => string;
+ }) {
+   const normalizeValue = (value: number | string | undefined) => {
+     if (typeof value === "number") return value;
+     if (typeof value === "string") {
+       const normalized = Number(value.replace(/,/g, ""));
+       return Number.isNaN(normalized) ? 0 : normalized;
+     }
+     return 0;
+   };
+ 
+   const formatNumber = (num: number | string | undefined) => {
+     const value = normalizeValue(num);
+     return value.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
+ };
Removed / Before Commit
- diff --git a/src/routes/user-listing.tsx b/src/routes/user-listing.tsx
- index bb75e56..e932782 100644
- { value: "INACTIVE", label: "INACTIVE" },
- { value: "SUSPENDED", label: "SUSPENDED" },
- { value: "CLOSED", label: "CLOSED" },
-   { value: "FORCE_INACTIVE", label: "Force Inactive" },
- ] as const;
- const positionTakingSports = [
- "Cricket",
- const amount = Number(creditAmount);
- const targetCreditLimit = toNumber(creditAdjustment.user.creditLimit);
- const targetAvailableBalance = toNumber(creditAdjustment.user.availableCredit);
- 
- setCreditFormError("");
- 
- return;
- }
- 
Added / After Commit
+ diff --git a/src/routes/user-listing.tsx b/src/routes/user-listing.tsx
+ index bb75e56..e932782 100644
+ { value: "INACTIVE", label: "INACTIVE" },
+ { value: "SUSPENDED", label: "SUSPENDED" },
+ { value: "CLOSED", label: "CLOSED" },
+   { value: "FORCE_INACTIVE", label: "FORCE INACTIVE" },
+ ] as const;
+ const positionTakingSports = [
+ "Cricket",
+ const amount = Number(creditAmount);
+ const targetCreditLimit = toNumber(creditAdjustment.user.creditLimit);
+ const targetAvailableBalance = toNumber(creditAdjustment.user.availableCredit);
+     const actorRole = user?.role?.toUpperCase?.();
+     const isActorAdminOrOwner = actorRole === "OWNER" || actorRole === "ADMIN";
+ 
+ setCreditFormError("");
+ 
+ return;
Removed / Before Commit
- diff --git a/src/routes/virtual-report.tsx b/src/routes/virtual-report.tsx
- index 3ca7578..1cae906 100644
- import { createFileRoute } from "@tanstack/react-router";
- import { useState } from "react";
- import { motion } from "motion/react";
- import { Card } from "@/components/ui/card";
- import { Button } from "@/components/ui/button";
- import { Input } from "@/components/ui/input";
- import { Calendar, Download } from "lucide-react";
- import {
- Select,
- SelectContent,
- ];
- 
- function VirtualReportPage() {
-   const [startDate] = useState("19/05/2026 00:00:00");
-   const [endDate] = useState("19/05/2026 23:59:59");
- const [sportAll, setSportAll] = useState("Sport-All");
Added / After Commit
+ diff --git a/src/routes/virtual-report.tsx b/src/routes/virtual-report.tsx
+ index 3ca7578..1cae906 100644
+ import { createFileRoute } from "@tanstack/react-router";
+ import { useState } from "react";
+ import { motion } from "motion/react";
+ import type { DateRange } from "react-day-picker";
+ import { format } from "date-fns";
+ import { Card } from "@/components/ui/card";
+ import { Button } from "@/components/ui/button";
+ import { useQuery } from "@tanstack/react-query";
+ import { toast } from "sonner";
+ import { internalServices } from "@/services/api/internalServices";
+ import { Calendar as CalendarIcon, Download } from "lucide-react";
+ import { Calendar } from "@/components/ui/calendar";
+ import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
+ import {
+ Select,
+ SelectContent,
Removed / Before Commit
- diff --git a/src/services/api/internalServices.ts b/src/services/api/internalServices.ts
- index ae7f8ab..72188b9 100644
- return query ? `?${query}` : "";
- }
- 
- function toBannerFormData(values: BannerFormValues) {
- const formData = new FormData();
- formData.append("title", values.title);
- formData.append("banner_type", values.banner_type);
- formData.append("redirect_link", values.redirect_link);
- formData.append("isActive", String(values.isActive));
- formData.append("publish_time", new Date(values.publish_time).toISOString());
-   values.images.forEach((image) => formData.append("images", image));
- return formData;
- }
- 
- },
- async update(id: string, values: BannerFormValues) {
Added / After Commit
+ diff --git a/src/services/api/internalServices.ts b/src/services/api/internalServices.ts
+ index ae7f8ab..72188b9 100644
+ return query ? `?${query}` : "";
+ }
+ 
+ function toBannerFormData(values: BannerFormValues, update = false) {
+ const formData = new FormData();
+ formData.append("title", values.title);
+ formData.append("banner_type", values.banner_type);
+ formData.append("redirect_link", values.redirect_link);
+ formData.append("isActive", String(values.isActive));
+ formData.append("publish_time", new Date(values.publish_time).toISOString());
+   if (values.images.length > 0) {
+     if (update) {
+       formData.append("image", values.images[0]);
+     } else {
+       values.images.forEach((image) => formData.append("images", image));
+     }