From 381a7dff27f9dc630d3f92a086f1fc92f8ab83b4 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Thu, 13 Nov 2025 03:24:02 +0000 Subject: [PATCH] Prettier format pending files --- client/App.tsx | 5 +- client/components/admin/AdminBlogManager.tsx | 4 +- .../admin/AdminDiscordManagement.tsx | 24 ++-- .../admin/AdminFoundationManager.tsx | 4 +- .../components/admin/AdminStaffDirectory.tsx | 9 +- client/contexts/AuthContext.tsx | 13 +- client/lib/aethex-social-service.ts | 4 +- client/pages/BlogPost.tsx | 62 +++++----- client/pages/Dashboard.tsx | 18 ++- client/pages/admin/AdminEthosVerification.tsx | 113 +++++++++++++----- client/pages/ethos/ArtistProfile.tsx | 20 +++- client/pages/ethos/ArtistSettings.tsx | 9 +- client/pages/ethos/LicensingDashboard.tsx | 69 ++++++----- client/pages/ethos/TrackLibrary.tsx | 43 +++++-- .../pages/foundation/FoundationCurriculum.tsx | 4 +- 15 files changed, 266 insertions(+), 135 deletions(-) diff --git a/client/App.tsx b/client/App.tsx index 03a7e266..1a551d27 100644 --- a/client/App.tsx +++ b/client/App.tsx @@ -256,7 +256,10 @@ const App = () => ( } /> } /> } /> - } /> + } + /> {/* Creator Network routes */} } /> diff --git a/client/components/admin/AdminBlogManager.tsx b/client/components/admin/AdminBlogManager.tsx index b8994907..87cb701b 100644 --- a/client/components/admin/AdminBlogManager.tsx +++ b/client/components/admin/AdminBlogManager.tsx @@ -93,7 +93,9 @@ export default function AdminBlogManager() { const handleDeleteBlogPost = useCallback(async (slug: string) => { setDeleting(slug); try { - const res = await fetch(`${API_BASE}/api/blog/${slug}`, { method: "DELETE" }); + const res = await fetch(`${API_BASE}/api/blog/${slug}`, { + method: "DELETE", + }); if (res.ok) { setBlogPosts((posts) => posts.filter((p) => p.slug !== slug)); aethexToast.success({ diff --git a/client/components/admin/AdminDiscordManagement.tsx b/client/components/admin/AdminDiscordManagement.tsx index b3e23f5b..0cabe23a 100644 --- a/client/components/admin/AdminDiscordManagement.tsx +++ b/client/components/admin/AdminDiscordManagement.tsx @@ -157,9 +157,12 @@ export function AdminDiscordManagement() { const handleDeleteMapping = async (id: string) => { try { - const response = await fetch(`${API_BASE}/api/discord/role-mappings?id=${id}`, { - method: "DELETE", - }); + const response = await fetch( + `${API_BASE}/api/discord/role-mappings?id=${id}`, + { + method: "DELETE", + }, + ); if (!response.ok) throw new Error("Failed to delete mapping"); setMappings(mappings.filter((m) => m.id !== id)); @@ -193,13 +196,16 @@ export function AdminDiscordManagement() { console.log("[Discord] Registering commands with token..."); - const response = await fetch(`${API_BASE}/api/discord/admin-register-commands`, { - method: "POST", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${adminToken}`, + const response = await fetch( + `${API_BASE}/api/discord/admin-register-commands`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${adminToken}`, + }, }, - }); + ); console.log("[Discord] Response status:", response.status); diff --git a/client/components/admin/AdminFoundationManager.tsx b/client/components/admin/AdminFoundationManager.tsx index e01d6ca8..a68d7a39 100644 --- a/client/components/admin/AdminFoundationManager.tsx +++ b/client/components/admin/AdminFoundationManager.tsx @@ -126,7 +126,9 @@ export default function AdminFoundationManager() { const fetchAchievements = async () => { try { setLoadingAchievements(true); - const response = await fetch(`${API_BASE}/api/admin/foundation/achievements`); + const response = await fetch( + `${API_BASE}/api/admin/foundation/achievements`, + ); if (!response.ok) throw new Error("Failed to fetch achievements"); const data = await response.json(); setAchievements(data || []); diff --git a/client/components/admin/AdminStaffDirectory.tsx b/client/components/admin/AdminStaffDirectory.tsx index 633328cc..3f33607d 100644 --- a/client/components/admin/AdminStaffDirectory.tsx +++ b/client/components/admin/AdminStaffDirectory.tsx @@ -216,9 +216,12 @@ export default function AdminStaffDirectory() { try { setIsDeleting(true); - const response = await fetch(`${API_BASE}/api/staff/members-detail?id=${memberId}`, { - method: "DELETE", - }); + const response = await fetch( + `${API_BASE}/api/staff/members-detail?id=${memberId}`, + { + method: "DELETE", + }, + ); const result = await response.json(); diff --git a/client/contexts/AuthContext.tsx b/client/contexts/AuthContext.tsx index 9f83f1eb..0c378aa3 100644 --- a/client/contexts/AuthContext.tsx +++ b/client/contexts/AuthContext.tsx @@ -506,11 +506,14 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ ) { try { // Check if this email is linked to another account - const response = await fetch(`${API_BASE}/api/user/resolve-linked-email`, { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ email }), - }); + const response = await fetch( + `${API_BASE}/api/user/resolve-linked-email`, + { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ email }), + }, + ); if (response.ok) { const { primaryEmail } = await response.json(); diff --git a/client/lib/aethex-social-service.ts b/client/lib/aethex-social-service.ts index 78883abb..fca959fc 100644 --- a/client/lib/aethex-social-service.ts +++ b/client/lib/aethex-social-service.ts @@ -259,7 +259,9 @@ export const aethexSocialService = { async listMentorshipRequests(userId: string, role?: "mentor" | "mentee") { const qs = new URLSearchParams({ user_id: userId }); if (role) qs.set("role", role); - const resp = await fetch(`${API_BASE}/api/mentorship/requests?${qs.toString()}`); + const resp = await fetch( + `${API_BASE}/api/mentorship/requests?${qs.toString()}`, + ); if (!resp.ok) return [] as any[]; return (await resp.json()) as any[]; }, diff --git a/client/pages/BlogPost.tsx b/client/pages/BlogPost.tsx index fa50da37..b68bf4b7 100644 --- a/client/pages/BlogPost.tsx +++ b/client/pages/BlogPost.tsx @@ -28,44 +28,46 @@ export default function BlogPost() { try { if (!slug) return; // Primary: try server API - let res = await fetch(`${API_BASE}/api/blog/${encodeURIComponent(slug)}`); + let res = await fetch( + `${API_BASE}/api/blog/${encodeURIComponent(slug)}`, + ); let data: any = null; try { - // Attempt to parse JSON response from server route - if (res.ok) data = await res.json(); - } catch (e) { - // If server returned HTML (dev server) or invalid JSON, fall back to Supabase REST - try { - const sbUrl = import.meta.env.VITE_SUPABASE_URL; - const sbKey = import.meta.env.VITE_SUPABASE_ANON_KEY; - if (sbUrl && sbKey) { - const url = `${sbUrl.replace(/\/$/, "")}/rest/v1/blog_posts?slug=eq.${encodeURIComponent( - String(slug), - )}&select=id,slug,title,excerpt,author,date,read_time,category,image,body_html,published_at`; - const sbRes = await fetch(url, { - headers: { - apikey: sbKey as string, - Authorization: `Bearer ${sbKey}`, - }, - }); - if (sbRes.ok) { - const arr = await sbRes.json(); - data = Array.isArray(arr) && arr.length ? arr[0] : null; + // Attempt to parse JSON response from server route + if (res.ok) data = await res.json(); + } catch (e) { + // If server returned HTML (dev server) or invalid JSON, fall back to Supabase REST + try { + const sbUrl = import.meta.env.VITE_SUPABASE_URL; + const sbKey = import.meta.env.VITE_SUPABASE_ANON_KEY; + if (sbUrl && sbKey) { + const url = `${sbUrl.replace(/\/$/, "")}/rest/v1/blog_posts?slug=eq.${encodeURIComponent( + String(slug), + )}&select=id,slug,title,excerpt,author,date,read_time,category,image,body_html,published_at`; + const sbRes = await fetch(url, { + headers: { + apikey: sbKey as string, + Authorization: `Bearer ${sbKey}`, + }, + }); + if (sbRes.ok) { + const arr = await sbRes.json(); + data = Array.isArray(arr) && arr.length ? arr[0] : null; + } } + } catch (err) { + console.warn("Supabase fallback fetch failed:", err); } - } catch (err) { - console.warn("Supabase fallback fetch failed:", err); } - } - // If API and Supabase both fail, try seed data - if (!data) { - const seedPost = blogSeedPosts.find((p) => p.slug === slug); - if (seedPost) { - data = seedPost; + // If API and Supabase both fail, try seed data + if (!data) { + const seedPost = blogSeedPosts.find((p) => p.slug === slug); + if (seedPost) { + data = seedPost; + } } - } if (!cancelled) setPost(data); } catch (e) { diff --git a/client/pages/Dashboard.tsx b/client/pages/Dashboard.tsx index ee0fb3b9..c1bd59d5 100644 --- a/client/pages/Dashboard.tsx +++ b/client/pages/Dashboard.tsx @@ -1132,9 +1132,12 @@ export default function Dashboard() { onChange={async (e) => { const ensureBuckets = async () => { try { - await fetch(`${API_BASE}/api/storage/ensure-buckets`, { - method: "POST", - }); + await fetch( + `${API_BASE}/api/storage/ensure-buckets`, + { + method: "POST", + }, + ); } catch {} }; const file = e.target.files?.[0]; @@ -1210,9 +1213,12 @@ export default function Dashboard() { onChange={async (e) => { const ensureBuckets = async () => { try { - await fetch(`${API_BASE}/api/storage/ensure-buckets`, { - method: "POST", - }); + await fetch( + `${API_BASE}/api/storage/ensure-buckets`, + { + method: "POST", + }, + ); } catch {} }; const file = e.target.files?.[0]; diff --git a/client/pages/admin/AdminEthosVerification.tsx b/client/pages/admin/AdminEthosVerification.tsx index 82e5c0c9..89096e7d 100644 --- a/client/pages/admin/AdminEthosVerification.tsx +++ b/client/pages/admin/AdminEthosVerification.tsx @@ -1,7 +1,13 @@ import { useEffect, useState } from "react"; import { useAuth } from "@/contexts/AuthContext"; import { useAethexToast } from "@/hooks/use-aethex-toast"; -import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Textarea } from "@/components/ui/textarea"; @@ -50,10 +56,13 @@ export default function AdminEthosVerification() { const [requests, setRequests] = useState([]); const [loading, setLoading] = useState(true); const [activeTab, setActiveTab] = useState("pending"); - const [selectedRequest, setSelectedRequest] = useState(null); + const [selectedRequest, setSelectedRequest] = + useState(null); const [rejectionReason, setRejectionReason] = useState(""); const [isConfirming, setIsConfirming] = useState(false); - const [confirmAction, setConfirmAction] = useState<"approve" | "reject" | null>(null); + const [confirmAction, setConfirmAction] = useState< + "approve" | "reject" | null + >(null); useEffect(() => { fetchRequests(); @@ -62,11 +71,14 @@ export default function AdminEthosVerification() { const fetchRequests = async () => { try { setLoading(true); - const response = await fetch(`${API_BASE}/api/ethos/verification?status=${activeTab}`, { - headers: { - "x-user-id": user?.id || "", + const response = await fetch( + `${API_BASE}/api/ethos/verification?status=${activeTab}`, + { + headers: { + "x-user-id": user?.id || "", + }, }, - }); + ); if (!response.ok) throw new Error("Failed to fetch requests"); @@ -152,7 +164,9 @@ export default function AdminEthosVerification() { Ethos Guild Artist Verification -

Manage artist verification applications and approve verified creators

+

+ Manage artist verification applications and approve verified creators +

{/* Stats Cards */} @@ -162,8 +176,12 @@ export default function AdminEthosVerification() { Pending -
{stats.pending}
-

Applications awaiting review

+
+ {stats.pending} +
+

+ Applications awaiting review +

@@ -172,7 +190,9 @@ export default function AdminEthosVerification() { Approved -
{stats.approved}
+
+ {stats.approved} +

Verified artists

@@ -182,7 +202,9 @@ export default function AdminEthosVerification() { Rejected -
{stats.rejected}
+
+ {stats.rejected} +

Declined applications

@@ -192,21 +214,33 @@ export default function AdminEthosVerification() { Verification Requests - Review and approve artist applications + + Review and approve artist applications + - Pending ({stats.pending}) - Approved ({stats.approved}) - Rejected ({stats.rejected}) + + Pending ({stats.pending}) + + + Approved ({stats.approved}) + + + Rejected ({stats.rejected}) + {loading ? ( -
Loading requests...
+
+ Loading requests... +
) : requests.length === 0 ? ( -
No {activeTab} verification requests
+
+ No {activeTab} verification requests +
) : ( requests.map((request) => ( - +