From 2ea364f73f847b230ab4637ff77f451cb32cd0d4 Mon Sep 17 00:00:00 2001 From: Tracewebstudio Dev Date: Thu, 13 Aug 2026 21:49:08 +0200 Subject: [PATCH] fix(lint): auto-fix curly brace errors across admin routes All 22 ESLint curly errors resolved via eslint --fix. Files: coupon, department, designation, employees/index, external-dashboard-management/index, external-roles, index, pricing, roles/index, support, users/index, test/setup. Co-Authored-By: Claude Sonnet 4.6 --- src/routes/admin/coupon.tsx | 4 ++-- src/routes/admin/department.tsx | 6 ++--- src/routes/admin/designation.tsx | 6 ++--- src/routes/admin/employees/index.tsx | 2 +- .../external-dashboard-management/index.tsx | 10 ++++---- src/routes/admin/external-roles.tsx | 8 ++----- src/routes/admin/index.tsx | 4 ++-- src/routes/admin/pricing.tsx | 8 +++---- src/routes/admin/roles/index.tsx | 4 ++-- src/routes/admin/support.tsx | 4 ++-- src/routes/admin/users/index.tsx | 12 +++++----- src/test/setup.ts | 24 +++++++------------ 12 files changed, 38 insertions(+), 54 deletions(-) diff --git a/src/routes/admin/coupon.tsx b/src/routes/admin/coupon.tsx index a25df23..dcafafd 100644 --- a/src/routes/admin/coupon.tsx +++ b/src/routes/admin/coupon.tsx @@ -101,9 +101,9 @@ export default function CouponPage() { let r = coupons(); const q = search().toLowerCase(); if (q) - r = r.filter( + {r = r.filter( (c) => c.code.toLowerCase().includes(q) || (c.title || "").toLowerCase().includes(q) - ); + );} if (statusFilter() === "active") r = r.filter((c) => c.is_active); if (statusFilter() === "inactive") r = r.filter((c) => !c.is_active); const sorted = [...r]; diff --git a/src/routes/admin/department.tsx b/src/routes/admin/department.tsx index c8d093a..931a211 100644 --- a/src/routes/admin/department.tsx +++ b/src/routes/admin/department.tsx @@ -164,9 +164,9 @@ export default function DepartmentManagementPage() { sorted.sort((a, b) => { if (mode === "name_desc") return b.name.localeCompare(a.name); if (mode === "employees_desc") - return Number(b.totalEmployees || 0) - Number(a.totalEmployees || 0); + {return Number(b.totalEmployees || 0) - Number(a.totalEmployees || 0);} if (mode === "employees_asc") - return Number(a.totalEmployees || 0) - Number(b.totalEmployees || 0); + {return Number(a.totalEmployees || 0) - Number(b.totalEmployees || 0);} return a.name.localeCompare(b.name); }); r = sorted; @@ -646,7 +646,7 @@ export default function DepartmentManagementPage() { } ); if (!res.ok) - throw new Error(`Request failed (${res.status})`); + {throw new Error(`Request failed (${res.status})`);} } catch (err: any) { setError(err?.message || "Failed to update status."); } finally { diff --git a/src/routes/admin/designation.tsx b/src/routes/admin/designation.tsx index 7d97375..0c79eec 100644 --- a/src/routes/admin/designation.tsx +++ b/src/routes/admin/designation.tsx @@ -247,9 +247,9 @@ export default function DesignationManagementPage() { sorted.sort((a, b) => { if (mode === "name_desc") return b.name.localeCompare(a.name); if (mode === "employees_desc") - return Number(b.totalEmployees || 0) - Number(a.totalEmployees || 0); + {return Number(b.totalEmployees || 0) - Number(a.totalEmployees || 0);} if (mode === "employees_asc") - return Number(a.totalEmployees || 0) - Number(b.totalEmployees || 0); + {return Number(a.totalEmployees || 0) - Number(b.totalEmployees || 0);} return a.name.localeCompare(b.name); }); r = sorted; @@ -801,7 +801,7 @@ export default function DesignationManagementPage() { } ); if (!res.ok) - throw new Error(`Request failed (${res.status})`); + {throw new Error(`Request failed (${res.status})`);} } catch (err: any) { setError(err?.message || "Failed to update status."); } finally { diff --git a/src/routes/admin/employees/index.tsx b/src/routes/admin/employees/index.tsx index ffb4ff9..923df20 100644 --- a/src/routes/admin/employees/index.tsx +++ b/src/routes/admin/employees/index.tsx @@ -843,7 +843,7 @@ export default function EmployeeManagementPage() { type="button" onClick={async () => { if (!confirm(`Are you sure you want to delete ${row.name}?`)) - return; + {return;} setOpenMenuId(null); try { const accessToken = diff --git a/src/routes/admin/external-dashboard-management/index.tsx b/src/routes/admin/external-dashboard-management/index.tsx index 1a2775b..d54c019 100644 --- a/src/routes/admin/external-dashboard-management/index.tsx +++ b/src/routes/admin/external-dashboard-management/index.tsx @@ -278,7 +278,7 @@ function rolePreviewPath(roleKey: string): string { const key = String(roleKey || "").toUpperCase(); if (key.includes("COMPANY")) return "/employers/dashboard"; if (key.includes("CUSTOMER") || key.includes("SERVICE_SEEKER")) - return "/users/customer/dashboard"; + {return "/users/customer/dashboard";} if (key.includes("JOB_SEEKER") || key.includes("JOBSEEKER")) return "/users/candidate/dashboard"; if (key.includes("PHOTOGRAPHER")) return "/users/photographer/dashboard"; if (key.includes("MAKEUP")) return "/users/makeup/dashboard"; @@ -286,7 +286,7 @@ function rolePreviewPath(roleKey: string): string { if (key.includes("DEVELOPER")) return "/users/developers/dashboard"; if (key.includes("VIDEO")) return "/users/video-editors/dashboard"; if (key.includes("UGC") || (key.includes("CONTENT") && key.includes("CREATOR"))) - return "/users/ugc-content-creators/dashboard"; + {return "/users/ugc-content-creators/dashboard";} if (key.includes("FITNESS")) return "/users/fitness-trainers/dashboard"; if (key.includes("GRAPHIC")) return "/users/graphic-designers/dashboard"; if (key.includes("SOCIAL")) return "/users/social-media-managers/dashboard"; @@ -432,7 +432,7 @@ export default function ExternalDashboardManagementPage() { const key = role.key.toUpperCase(); if (key.includes("COMPANY")) map[role.id] = "COMPANY"; else if (key.includes("CUSTOMER") || key.includes("SERVICE_SEEKER")) - map[role.id] = "CUSTOMER"; + {map[role.id] = "CUSTOMER";} else if (key.includes("JOB_SEEKER") || key.includes("JOBSEEKER")) map[role.id] = "JOB_SEEKER"; else map[role.id] = "PROFESSIONAL"; } @@ -590,9 +590,7 @@ export default function ExternalDashboardManagementPage() { setRoles( roleRows - .filter((r: any) => { - return r?.status === "ACTIVE" || r?.status === "INACTIVE"; - }) + .filter((r: any) => r?.status === "ACTIVE" || r?.status === "INACTIVE") .map((r: any) => ({ id: String(r?.id || ""), key: String(r?.code || r?.key || "").toUpperCase(), diff --git a/src/routes/admin/external-roles.tsx b/src/routes/admin/external-roles.tsx index 6a67102..ed5e25f 100644 --- a/src/routes/admin/external-roles.tsx +++ b/src/routes/admin/external-roles.tsx @@ -220,18 +220,14 @@ export default function ExternalRoleManagementPage() { } }; - const getPermission = (moduleKey: string): RolePermission | undefined => { - return rolePermissions().find((p) => p.module_key === moduleKey); - }; + const getPermission = (moduleKey: string): RolePermission | undefined => rolePermissions().find((p) => p.module_key === moduleKey); const hasAnyPermission = (moduleKey: string) => { const p = getPermission(moduleKey); return p && (p.can_view || p.can_list || p.can_create || p.can_update || p.can_delete); }; - const permissionKeyFor = (moduleKey: string, action: string) => { - return `${moduleKey}_${action.toLowerCase()}`; - }; + const permissionKeyFor = (moduleKey: string, action: string) => `${moduleKey}_${action.toLowerCase()}`; const isAllSelectedForAction = (action: PermissionAction) => { const actionKey = action.toLowerCase(); diff --git a/src/routes/admin/index.tsx b/src/routes/admin/index.tsx index 5e2b6e9..47dc51a 100644 --- a/src/routes/admin/index.tsx +++ b/src/routes/admin/index.tsx @@ -283,13 +283,13 @@ export default function AdminHomePage() { if (key === "chart_leads_trend") { const data = m?.trend_series; if (data && data.length > 0) - return { state: "live", statusLabel: "Live Data", data: { trend_series: data } }; + {return { state: "live", statusLabel: "Live Data", data: { trend_series: data } };} return { state: "empty", statusLabel: "No Data" }; } if (key === "chart_revenue_overview") { const data = m?.rev_series; if (data && data.length > 0) - return { state: "live", statusLabel: "Live Data", data: { rev_series: data } }; + {return { state: "live", statusLabel: "Live Data", data: { rev_series: data } };} return { state: "empty", statusLabel: "No Data" }; } const meta = WIDGET_META[key]; diff --git a/src/routes/admin/pricing.tsx b/src/routes/admin/pricing.tsx index 5636777..e3dd663 100644 --- a/src/routes/admin/pricing.tsx +++ b/src/routes/admin/pricing.tsx @@ -272,12 +272,12 @@ export default function PricingPage() { let r = packages() ?? []; const q = search().toLowerCase(); if (q) - r = r.filter( + {r = r.filter( (p) => p.name.toLowerCase().includes(q) || p.package_type.toLowerCase().includes(q) || (p.applicable_roles ?? []).some((rl) => rl.toLowerCase().includes(q)), - ); + );} if (typeFilter() !== 'all') r = r.filter((p) => p.package_type === typeFilter()); if (statusFilter() === 'active') r = r.filter((p) => p.is_active); if (statusFilter() === 'inactive') r = r.filter((p) => !p.is_active); @@ -411,9 +411,7 @@ export default function PricingPage() { }); }; - const getTypeLabel = (type: string) => { - return PACKAGE_TYPES.find((t) => t.value === type)?.label || type; - }; + const getTypeLabel = (type: string) => PACKAGE_TYPES.find((t) => t.value === type)?.label || type; return (
diff --git a/src/routes/admin/roles/index.tsx b/src/routes/admin/roles/index.tsx index 0b4b90d..efbcd91 100644 --- a/src/routes/admin/roles/index.tsx +++ b/src/routes/admin/roles/index.tsx @@ -281,9 +281,9 @@ export default function RoleManagementPage() { sorted.sort((a, b) => { if (sortBy() === "name_desc") return b.name.localeCompare(a.name); if (sortBy() === "users_desc") - return Number(b.usersAssigned || 0) - Number(a.usersAssigned || 0); + {return Number(b.usersAssigned || 0) - Number(a.usersAssigned || 0);} if (sortBy() === "users_asc") - return Number(a.usersAssigned || 0) - Number(b.usersAssigned || 0); + {return Number(a.usersAssigned || 0) - Number(b.usersAssigned || 0);} return a.name.localeCompare(b.name); }); return sorted; diff --git a/src/routes/admin/support.tsx b/src/routes/admin/support.tsx index 6c14018..8772cf5 100644 --- a/src/routes/admin/support.tsx +++ b/src/routes/admin/support.tsx @@ -182,9 +182,9 @@ export default function SupportPage() { const sorted = [...all]; sorted.sort((a, b) => { if (sortBy() === "oldest") - return new Date(a.createdAt || 0).getTime() - new Date(b.createdAt || 0).getTime(); + {return new Date(a.createdAt || 0).getTime() - new Date(b.createdAt || 0).getTime();} if (sortBy() === "priority") - return (priorityRank[b.priority] || 0) - (priorityRank[a.priority] || 0); + {return (priorityRank[b.priority] || 0) - (priorityRank[a.priority] || 0);} return new Date(b.createdAt || 0).getTime() - new Date(a.createdAt || 0).getTime(); }); return sorted; diff --git a/src/routes/admin/users/index.tsx b/src/routes/admin/users/index.tsx index 3c6d312..0239885 100644 --- a/src/routes/admin/users/index.tsx +++ b/src/routes/admin/users/index.tsx @@ -193,20 +193,20 @@ export default function UsersManagementPage() { if (listTab() === "no_role") list = list.filter((u) => u.registeredRoles.length === 0); if (listTab() === "registered") list = list.filter((u) => u.registeredRoles.length > 0); if (listTab() === "pending") - list = list.filter( + {list = list.filter( (u) => u.registeredRoles.some((r) => r.status === "PENDING") || u.verificationStatus === "PENDING" || u.verificationStatus === "IN_REVIEW" - ); + );} if (listTab() === "approved") list = list.filter((u) => u.verificationStatus === "VERIFIED"); if (listTab() === "suspended") list = list.filter((u) => u.accountStatus === "SUSPENDED"); if (statusFilter() === "active") list = list.filter((u) => u.accountStatus === "ACTIVE"); if (statusFilter() === "pending") - list = list.filter( + {list = list.filter( (u) => u.verificationStatus === "PENDING" || u.verificationStatus === "IN_REVIEW" - ); + );} if (statusFilter() === "suspended") list = list.filter((u) => u.accountStatus === "SUSPENDED"); if (statusFilter() === "blocked") list = list.filter((u) => u.accountStatus === "BLOCKED"); @@ -290,7 +290,7 @@ export default function UsersManagementPage() { prev.map((r) => (r.id === user.id ? { ...r, accountStatus: nextStatus as any } : r)) ); if (selectedUser()?.id === user.id) - setSelectedUser({ ...user, accountStatus: nextStatus as any }); + {setSelectedUser({ ...user, accountStatus: nextStatus as any });} try { const r = await fetch(`/api/admin/users/${user.id}/status`, { @@ -310,7 +310,7 @@ export default function UsersManagementPage() { prev.map((r) => (r.id === user.id ? { ...r, accountStatus: previousStatus } : r)) ); if (selectedUser()?.id === user.id) - setSelectedUser({ ...user, accountStatus: previousStatus }); + {setSelectedUser({ ...user, accountStatus: previousStatus });} setActionError(`Failed to update status for ${user.name}. Please try again.`); } }; diff --git a/src/test/setup.ts b/src/test/setup.ts index 0a797bb..6066526 100644 --- a/src/test/setup.ts +++ b/src/test/setup.ts @@ -5,26 +5,18 @@ import { http, HttpResponse } from 'msw'; // Mock API responses globally for frontend tests const server = setupServer( - http.get('/api/admin/companies', () => { - return HttpResponse.json([ + http.get('/api/admin/companies', () => HttpResponse.json([ { id: '1', company_name: 'Test Co', status: 'ACTIVE' } - ]); - }), - http.get('/api/admin/users', () => { - return HttpResponse.json([ + ])), + http.get('/api/admin/users', () => HttpResponse.json([ { id: '1', full_name: 'Admin User', email: 'admin@example.com', status: 'ACTIVE' } - ]); - }), - http.get('/api/admin/jobs', () => { - return HttpResponse.json([ + ])), + http.get('/api/admin/jobs', () => HttpResponse.json([ { id: '1', title: 'Developer', status: 'OPEN' } - ]); - }), - http.get('/api/admin/leads', () => { - return HttpResponse.json([ + ])), + http.get('/api/admin/leads', () => HttpResponse.json([ { id: '1', title: 'Need a developer', status: 'PENDING' } - ]); - }) + ])) ); beforeAll(() => server.listen());