diff --git a/drb-frontend/app/profile/page.tsx b/drb-frontend/app/profile/page.tsx new file mode 100644 index 0000000..9827391 --- /dev/null +++ b/drb-frontend/app/profile/page.tsx @@ -0,0 +1,218 @@ +"use client"; + +import { useEffect, useState } from "react"; +import { useRouter } from "next/navigation"; +import { useAuth } from "@/components/AuthProvider"; +import { c2api } from "@/lib/c2api"; + +interface LinkStatus { + linked: boolean; + discord_user_id?: string; + discord_username?: string; + linked_at?: string; +} + +function fmtDate(iso: string) { + return new Date(iso).toLocaleDateString("en-US", { + month: "short", day: "numeric", year: "numeric", + }); +} + +function Initials({ name }: { name: string }) { + const parts = name.trim().split(/\s+/); + const letters = parts.length >= 2 + ? parts[0][0] + parts[parts.length - 1][0] + : name.slice(0, 2); + return ( +
{user.email}
+ )} + {isAdmin && ( + + Admin + + )} +Account
+Discord
+ + {linkLoading ? ( +Loading…
+ ) : linkStatus?.linked ? ( ++ Link your Discord account to access private trips from both the web and Discord. +
+ {code ? ( ++ Run /link {code} in Discord. Code expires in {codeExpiry} minutes. +
+ +Sign out of this device
+ +Link your Discord account
-- Required to access private trips from Discord or the web. -
-