feat: add public player profile page

This commit is contained in:
2026-03-06 13:49:14 -08:00
committed by Naomi Carrigan
parent f734176965
commit 32c13f73c4
5 changed files with 313 additions and 1 deletions
+11
View File
@@ -2,6 +2,12 @@ import { useState } from "react";
import { GameProvider } from "./context/GameContext.js";
import { GameLayout } from "./components/game/GameLayout.js";
import { LoginPage } from "./components/game/LoginPage.js";
import { ProfilePage } from "./components/game/ProfilePage.js";
const getProfileDiscordId = (): string | null => {
const match = /^\/profile\/(\d+)$/.exec(window.location.pathname);
return match?.[1] ?? null;
};
const handleAuthCallback = (): boolean => {
if (window.location.pathname !== "/auth/callback") {
@@ -27,6 +33,11 @@ const isAuthenticated = (): boolean => {
export const App = (): React.JSX.Element => {
const [loggedIn, setLoggedIn] = useState(isAuthenticated);
const profileDiscordId = getProfileDiscordId();
if (profileDiscordId) {
return <ProfilePage discordId={profileDiscordId} />;
}
if (!loggedIn) {
return <LoginPage onLogin={() => { setLoggedIn(true); }} />;
}