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

Review Result ?

solutionbowl/super-admin · 3a0f08c7
Introduced a sessionStorage-based mechanism to pass navigation parameters without exposing them in the URL. This improves user experience and cleanliness of URLs for navigation related to net-exposure. The changes are comprehensive and consistent across relevant route files.
Quality ?
85%
Security ?
50%
Business Value ?
75%
Maintainability ?
83%
Issues & Suggested Fixes ?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
In Getexposureparams, Returning Empty Stri...
Where src/lib/nav-params.ts:20
Issue / Evidence In getExposureParams, returning empty strings for raceId and marketId could cause bugs if these are expected to be valid identifiers. Consider returning null or throwing an error to handle missing params explicitly.
Suggested Fix Review and simplify this section.
The Catch Block Swallows All Errors Silent...
Where src/lib/nav-params.ts:21
Issue / Evidence The catch block swallows all errors silently; logging errors or handling specific exceptions could help with debugging and reliability.
Suggested Fix Review and simplify this section.
Missing Validation
Where src/lib/nav-params.ts:16
Issue / Evidence Adding validation when setting exposure params to ensure required fields are non-empty strings would improve data integrity and reduce bug risks.
Suggested Fix Review and simplify this section.
Long Function
Where src/lib/nav-params.ts:14
Issue / Evidence The key name 'exposure_nav_params' in sessionStorage could be made more unique or namespaced to avoid collisions in complex applications.
Suggested Fix Review and simplify this section.
Duplicate Logic
Where src/routes/net-exposure.tsx:253
Issue / Evidence The repeated calls to setExposureParams with similar param objects could be refactored into a helper function to reduce duplication and maintenance effort.
Suggested Fix Review and simplify this section.
The Commit Message Is Very Brief And Lacks...
Where commit message
Issue / Evidence The commit message is very brief and lacks detail on the motivation, approach, and impact of the changes. Improving the commit message would increase maintainability and business value.
Suggested Fix Review and simplify this section.
Code Change Preview · src/lib/nav-params.ts ?
Removed / Before Commit
- diff --git a/src/lib/nav-params.ts b/src/lib/nav-params.ts
- new file mode 100644
- index 0000000..5d8440a
Added / After Commit
+ diff --git a/src/lib/nav-params.ts b/src/lib/nav-params.ts
+ new file mode 100644
+ index 0000000..5d8440a
+ /**
+  * nav-params.ts
+  * URL-clean navigation params — stored in sessionStorage so they
+  * never appear in the address bar but survive same-tab navigation.
+  */
+ 
+ export interface ExposureNavParams {
+   raceId: string;
+   marketId: string;
+   userId?: string;
+   parentUserId?: string;
+ }
+ 
+ const KEY = "exposure_nav_params";
+ 
Removed / Before Commit
- diff --git a/src/routes/net-exposure-bet.tsx b/src/routes/net-exposure-bet.tsx
- index 5ed613b..4c58b31 100644
- import { cn } from "@/lib/utils";
- import { tenantApiClient } from "@/services/api/apiClient";
- import { format } from "date-fns";
- 
- export const Route = createFileRoute("/net-exposure-bet")({
- component: NetExposureBetPage,
-   validateSearch: (s: Record<string, unknown>) => ({
-     raceId: String(s.raceId ?? ""),
-     marketId: String(s.marketId ?? ""),
-     userId: String(s.userId ?? ""),
-   }),
- head: () => ({ meta: [{ title: "Net Exposure Bets - B2B-B2C Panel" }] }),
- });
- 
- // ─── Page ─────────────────────────────────────────────────────────────────────
- 
Added / After Commit
+ diff --git a/src/routes/net-exposure-bet.tsx b/src/routes/net-exposure-bet.tsx
+ index 5ed613b..4c58b31 100644
+ import { cn } from "@/lib/utils";
+ import { tenantApiClient } from "@/services/api/apiClient";
+ import { format } from "date-fns";
+ import { getExposureParams } from "@/lib/nav-params";
+ 
+ export const Route = createFileRoute("/net-exposure-bet")({
+ component: NetExposureBetPage,
+ head: () => ({ meta: [{ title: "Net Exposure Bets - B2B-B2C Panel" }] }),
+ });
+ 
+ // ─── Page ─────────────────────────────────────────────────────────────────────
+ 
+ function NetExposureBetPage() {
+   const { raceId, marketId, userId } = getExposureParams();
+ const navigate = useNavigate();
+ 
Removed / Before Commit
- diff --git a/src/routes/net-exposure-detail.tsx b/src/routes/net-exposure-detail.tsx
- index 829e52e..f81274a 100644
- import { Button } from "@/components/ui/button";
- import { cn } from "@/lib/utils";
- import { tenantApiClient } from "@/services/api/apiClient";
- 
- export const Route = createFileRoute("/net-exposure-detail")({
- component: NetExposureDetailPage,
-   validateSearch: (s: Record<string, unknown>) => ({
-     raceId: String(s.raceId ?? ""),
-     marketId: String(s.marketId ?? ""),
-     parentUserId: String(s.parentUserId ?? ""),
-   }),
- head: () => ({ meta: [{ title: "Net Exposure Detail - B2B-B2C Panel" }] }),
- });
- 
- // ─── Page ─────────────────────────────────────────────────────────────────────
- 
Added / After Commit
+ diff --git a/src/routes/net-exposure-detail.tsx b/src/routes/net-exposure-detail.tsx
+ index 829e52e..f81274a 100644
+ import { Button } from "@/components/ui/button";
+ import { cn } from "@/lib/utils";
+ import { tenantApiClient } from "@/services/api/apiClient";
+ import { getExposureParams } from "@/lib/nav-params";
+ 
+ export const Route = createFileRoute("/net-exposure-detail")({
+ component: NetExposureDetailPage,
+ head: () => ({ meta: [{ title: "Net Exposure Detail - B2B-B2C Panel" }] }),
+ });
+ 
+ // ─── Page ─────────────────────────────────────────────────────────────────────
+ 
+ function NetExposureDetailPage() {
+   const { raceId, marketId, parentUserId } = getExposureParams();
+ const navigate = useNavigate();
+ 
Removed / Before Commit
- diff --git a/src/routes/net-exposure-herarchy.tsx b/src/routes/net-exposure-herarchy.tsx
- index 8439b74..bc7e760 100644
- import { useQuery } from "@tanstack/react-query";
- import { useState } from "react";
- import type React from "react";
- import { ChevronDown, ChevronUp, Network, RefreshCw, ArrowLeft } from "lucide-react";
- import { tenantApiClient } from "@/services/api/apiClient";
- import { Button } from "@/components/ui/button";
- import { cn } from "@/lib/utils";
- 
- export const Route = createFileRoute("/net-exposure-herarchy")({
- component: NetExposureHierarchyPage,
-   validateSearch: (search: Record<string, unknown>) => ({
-     raceId: String(search.raceId ?? ""),
-     marketId: String(search.marketId ?? ""),
-     userId: String(search.userId ?? ""),
-   }),
- head: () => ({ meta: [{ title: "Net Exposure Hierarchy - B2B-B2C Panel" }] }),
Added / After Commit
+ diff --git a/src/routes/net-exposure-herarchy.tsx b/src/routes/net-exposure-herarchy.tsx
+ index 8439b74..bc7e760 100644
+ import { useQuery } from "@tanstack/react-query";
+ import { useState } from "react";
+ import type React from "react";
+ import { ChevronDown, Network, RefreshCw, ArrowLeft } from "lucide-react";
+ import { tenantApiClient } from "@/services/api/apiClient";
+ import { Button } from "@/components/ui/button";
+ import { cn } from "@/lib/utils";
+ import { getExposureParams } from "@/lib/nav-params";
+ 
+ export const Route = createFileRoute("/net-exposure-herarchy")({
+ component: NetExposureHierarchyPage,
+ head: () => ({ meta: [{ title: "Net Exposure Hierarchy - B2B-B2C Panel" }] }),
+ });
+ 
+ }
+ 
Removed / Before Commit
- diff --git a/src/routes/net-exposure.tsx b/src/routes/net-exposure.tsx
- index c6b8777..9460c7a 100644
- import { Gauge, List, Users } from "lucide-react";
- import { useAutoRefresh } from "@/hooks/useAutoRefresh";
- import { internalServices } from "@/services/api/internalServices";
- 
- export const Route = createFileRoute("/net-exposure")({
- component: NetExposurePage,
- type="button"
- title="View detail"
- className="rounded p-0.5 hover:bg-muted transition-colors"
-                             onClick={() =>
-                             navigate({
-                             to: "/net-exposure-detail",
-                             search: {
-                             raceId: race.raceId,
-                            marketId: market.marketId,
-                            },
Added / After Commit
+ diff --git a/src/routes/net-exposure.tsx b/src/routes/net-exposure.tsx
+ index c6b8777..9460c7a 100644
+ import { Gauge, List, Users } from "lucide-react";
+ import { useAutoRefresh } from "@/hooks/useAutoRefresh";
+ import { internalServices } from "@/services/api/internalServices";
+ import { setExposureParams } from "@/lib/nav-params";
+ 
+ export const Route = createFileRoute("/net-exposure")({
+ component: NetExposurePage,
+ type="button"
+ title="View detail"
+ className="rounded p-0.5 hover:bg-muted transition-colors"
+                             onClick={() => {
+                               setExposureParams({ raceId: race.raceId, marketId: market.marketId });
+                               navigate({ to: "/net-exposure-detail" });
+                             }}
+ >
+ <Gauge className="h-3.5 w-3.5 text-muted-foreground hover:text-primary" />
Removed / Before Commit
- diff --git a/src/routes/user-details.$userId.tsx b/src/routes/user-details.$userId.tsx
- index 97befdf..91a528c 100644
- import { tenantApiClient } from "@/services/api/apiClient";
- import { cn } from "@/lib/utils";
- import { format } from "date-fns";
- 
- export const Route = createFileRoute("/user-details/$userId")({
- component: UserDetailsPage,
- type="button"
- title="View detail"
- className="rounded p-0.5 hover:bg-muted transition-colors"
-                             onClick={() =>
-                             navigate({
-                             to: "/net-exposure-detail",
-                             search: {
-                            raceId: race.raceId,
-                            marketId: market.marketId,
-                            parentUserId: userId,
Added / After Commit
+ diff --git a/src/routes/user-details.$userId.tsx b/src/routes/user-details.$userId.tsx
+ index 97befdf..91a528c 100644
+ import { tenantApiClient } from "@/services/api/apiClient";
+ import { cn } from "@/lib/utils";
+ import { format } from "date-fns";
+ import { setExposureParams } from "@/lib/nav-params";
+ 
+ export const Route = createFileRoute("/user-details/$userId")({
+ component: UserDetailsPage,
+ type="button"
+ title="View detail"
+ className="rounded p-0.5 hover:bg-muted transition-colors"
+                             onClick={() => {
+                               setExposureParams({ raceId: race.raceId, marketId: market.marketId, parentUserId: userId });
+                               navigate({ to: "/net-exposure-detail" });
+                             }}
+ >
+ <Gauge className="h-3.5 w-3.5 text-muted-foreground hover:text-primary" />