feat: add race/class to character sheet, public /character/:id page

Players can now set their character's race and class in the Character
tab. A new public page at /character/:id displays the full character
sheet — name, pronouns, race, class, bio, and guild lore.
This commit is contained in:
2026-03-07 13:54:13 -08:00
committed by Naomi Carrigan
parent 924b9f541d
commit 8f0d038da1
7 changed files with 416 additions and 1 deletions
+11
View File
@@ -1,5 +1,6 @@
import { useState } from "react";
import { GameProvider } from "./context/GameContext.js";
import { CharacterPage } from "./components/game/CharacterPage.js";
import { GameLayout } from "./components/game/GameLayout.js";
import { LoginPage } from "./components/game/LoginPage.js";
import { ProfilePage } from "./components/game/ProfilePage.js";
@@ -9,6 +10,11 @@ const getProfileDiscordId = (): string | null => {
return match?.[1] ?? null;
};
const getCharacterDiscordId = (): string | null => {
const match = /^\/character\/(\d+)$/.exec(window.location.pathname);
return match?.[1] ?? null;
};
const handleAuthCallback = (): boolean => {
if (window.location.pathname !== "/auth/callback") {
return false;
@@ -38,6 +44,11 @@ export const App = (): React.JSX.Element => {
return <ProfilePage discordId={profileDiscordId} />;
}
const characterDiscordId = getCharacterDiscordId();
if (characterDiscordId) {
return <CharacterPage discordId={characterDiscordId} />;
}
if (!loggedIn) {
return <LoginPage onLogin={() => { setLoggedIn(true); }} />;
}