diff --git a/client/components/passport/PassportSummary.tsx b/client/components/passport/PassportSummary.tsx index 339c1544..d85ef6dc 100644 --- a/client/components/passport/PassportSummary.tsx +++ b/client/components/passport/PassportSummary.tsx @@ -223,7 +223,10 @@ const PassportSummary = ({ >
- {getAchievementEmoji(achievement.icon as any, achievement.name)} + {getAchievementEmoji( + achievement.icon as any, + achievement.name, + )} {achievement.name} diff --git a/client/contexts/AuthContext.tsx b/client/contexts/AuthContext.tsx index e1966ad3..685b2861 100644 --- a/client/contexts/AuthContext.tsx +++ b/client/contexts/AuthContext.tsx @@ -331,7 +331,10 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ if (inviteProcessedRef.current) return; if (!user) return; try { - const qs = typeof window !== "undefined" ? new URLSearchParams(window.location.search) : null; + const qs = + typeof window !== "undefined" + ? new URLSearchParams(window.location.search) + : null; const token = qs?.get("invite"); if (!token) return; inviteProcessedRef.current = true; @@ -339,7 +342,10 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ try { await mod.aethexSocialService.acceptInvite(token, user.id); try { - aethexToast.success({ title: "Invitation accepted", description: "You're now connected." }); + aethexToast.success({ + title: "Invitation accepted", + description: "You're now connected.", + }); } catch {} } catch (e) { console.warn("Invite accept failed", e); diff --git a/client/lib/aethex-social-service.ts b/client/lib/aethex-social-service.ts index f542159e..5a7b60b6 100644 --- a/client/lib/aethex-social-service.ts +++ b/client/lib/aethex-social-service.ts @@ -10,13 +10,19 @@ export const aethexSocialService = { .limit(limit); if (error) { - console.error("Failed to load recommended profiles:", (error as any)?.message || error); + console.error( + "Failed to load recommended profiles:", + (error as any)?.message || error, + ); return []; } return (data || []) as any[]; } catch (error) { - console.error("Unexpected error loading recommended profiles:", (error as any)?.message || error); + console.error( + "Unexpected error loading recommended profiles:", + (error as any)?.message || error, + ); return []; } }, @@ -29,13 +35,19 @@ export const aethexSocialService = { .eq("follower_id", userId); if (error) { - console.error("Failed to load following list:", (error as any)?.message || error); + console.error( + "Failed to load following list:", + (error as any)?.message || error, + ); return []; } return (data as any[]).map((r: any) => r.following_id); } catch (error) { - console.error("Unexpected error loading following list:", (error as any)?.message || error); + console.error( + "Unexpected error loading following list:", + (error as any)?.message || error, + ); return []; } }, @@ -67,17 +79,27 @@ export const aethexSocialService = { const resp = await fetch("/api/invites", { method: "POST", headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ inviter_id: inviterId, invitee_email: email, message }), + body: JSON.stringify({ + inviter_id: inviterId, + invitee_email: email, + message, + }), }); if (!resp.ok) { const err = await resp.text(); throw new Error(err || "Failed to send invite"); } - return (await resp.json()) as { ok: boolean; inviteUrl: string; token: string }; + return (await resp.json()) as { + ok: boolean; + inviteUrl: string; + token: string; + }; }, async listInvites(inviterId: string) { - const resp = await fetch(`/api/invites?inviter_id=${encodeURIComponent(inviterId)}`); + const resp = await fetch( + `/api/invites?inviter_id=${encodeURIComponent(inviterId)}`, + ); if (!resp.ok) return []; return await resp.json(); }, @@ -129,7 +151,9 @@ export const aethexSocialService = { async endorseSkill(endorserId: string, endorsedId: string, skill: string) { const payload = { endorser_id: endorserId, endorsed_id: endorsedId, skill }; - const { error } = await supabase.from("endorsements").insert(payload as any); + const { error } = await supabase + .from("endorsements") + .insert(payload as any); if (error) throw new Error(error.message || "Unable to endorse"); await this.applyReward(endorsedId, "endorsement_received", 2); }, diff --git a/client/pages/Network.tsx b/client/pages/Network.tsx index 5ceb203f..2c7e6460 100644 --- a/client/pages/Network.tsx +++ b/client/pages/Network.tsx @@ -82,7 +82,11 @@ export default function Network() { toast({ description: "Invitation sent" }); setInviteEmail(""); } catch (e: any) { - toast({ variant: "destructive", title: "Failed to send invite", description: e?.message || "Try again later" }); + toast({ + variant: "destructive", + title: "Failed to send invite", + description: e?.message || "Try again later", + }); } finally { setInviteSending(false); } @@ -94,7 +98,11 @@ export default function Network() { await aethexSocialService.endorseSkill(user.id, targetId, skill); toast({ description: `Endorsed for ${skill}` }); } catch (e: any) { - toast({ variant: "destructive", title: "Failed to endorse", description: e?.message || "Try again later" }); + toast({ + variant: "destructive", + title: "Failed to endorse", + description: e?.message || "Try again later", + }); } }; @@ -252,7 +260,10 @@ export default function Network() { const p = (c as any).user_profiles || {}; const display = p.full_name || p.username || c.connection_id; return ( -
+
@@ -260,15 +271,21 @@ export default function Network() {
{display}
-
Connected
+
+ Connected +
- +
); })} {connections.length === 0 && ( -
No connections yet.
+
+ No connections yet. +
)} @@ -330,14 +347,19 @@ export default function Network() { Endorsements - Recognize skills of your peers + + Recognize skills of your peers + {connections.slice(0, 6).map((c) => { const p = (c as any).user_profiles || {}; const display = p.full_name || p.username || c.connection_id; return ( -
+
@@ -346,8 +368,22 @@ export default function Network() {
{display}
- {(["Leadership","Systems","Frontend","Backend"] as const).map((skill) => ( - ))} diff --git a/client/pages/ProfilePassport.tsx b/client/pages/ProfilePassport.tsx index c257dc4a..aa80ed12 100644 --- a/client/pages/ProfilePassport.tsx +++ b/client/pages/ProfilePassport.tsx @@ -431,13 +431,17 @@ const ProfilePassport = () => {
{((): string => { - const key = String(achievement.icon || achievement.name || "").toLowerCase(); + const key = String( + achievement.icon || achievement.name || "", + ).toLowerCase(); if (/founding|founder/.test(key)) return "🎖️"; - if (/trophy|award|medal|badge/.test(key)) return "🏆"; + if (/trophy|award|medal|badge/.test(key)) + return "🏆"; if (/welcome/.test(key)) return "🎉"; if (/star/.test(key)) return "⭐"; if (/rocket|launch/.test(key)) return "🚀"; - return typeof achievement.icon === "string" && achievement.icon.length <= 3 + return typeof achievement.icon === "string" && + achievement.icon.length <= 3 ? (achievement.icon as string) : "🏅"; })()} @@ -487,14 +491,26 @@ const ProfilePassport = () => { ) : profile.email ? ( - ) : ( - diff --git a/server/index.ts b/server/index.ts index fd9b7e32..5603844e 100644 --- a/server/index.ts +++ b/server/index.ts @@ -621,10 +621,11 @@ export function createServer() { // Invites API const baseUrl = - process.env.PUBLIC_BASE_URL || process.env.SITE_URL || "https://aethex.biz"; + process.env.PUBLIC_BASE_URL || + process.env.SITE_URL || + "https://aethex.biz"; - const safeEmail = (v?: string | null) => - (v || "").trim().toLowerCase(); + const safeEmail = (v?: string | null) => (v || "").trim().toLowerCase(); const accrue = async ( userId: string, @@ -731,7 +732,8 @@ export function createServer() { app.get("/api/invites", async (req, res) => { const inviter = String(req.query.inviter_id || ""); - if (!inviter) return res.status(400).json({ error: "inviter_id required" }); + if (!inviter) + return res.status(400).json({ error: "inviter_id required" }); try { const { data, error } = await adminSupabase .from("invites") @@ -751,7 +753,9 @@ export function createServer() { acceptor_id?: string; }; if (!token || !acceptor_id) { - return res.status(400).json({ error: "token and acceptor_id required" }); + return res + .status(400) + .json({ error: "token and acceptor_id required" }); } try { const { data: invite, error } = await adminSupabase @@ -766,7 +770,11 @@ export function createServer() { const now = new Date().toISOString(); const { error: upErr } = await adminSupabase .from("invites") - .update({ status: "accepted", accepted_by: acceptor_id, accepted_at: now }) + .update({ + status: "accepted", + accepted_by: acceptor_id, + accepted_at: now, + }) .eq("id", (invite as any).id); if (upErr) return res.status(500).json({ error: upErr.message }); @@ -785,10 +793,14 @@ export function createServer() { if (inviterId) { await accrue(inviterId, "xp", 100, "invite_accepted", { token }); await accrue(inviterId, "loyalty", 50, "invite_accepted", { token }); - await accrue(inviterId, "reputation", 2, "invite_accepted", { token }); + await accrue(inviterId, "reputation", 2, "invite_accepted", { + token, + }); } await accrue(acceptor_id, "xp", 50, "invite_accepted", { token }); - await accrue(acceptor_id, "reputation", 1, "invite_accepted", { token }); + await accrue(acceptor_id, "reputation", 1, "invite_accepted", { + token, + }); return res.json({ ok: true }); } catch (e: any) {