feat: add lifetime stats to player profile

Introduce six lifetime stat fields (gold, clicks, bosses, quests,
adventurers, achievements) that accumulate across all prestige and
transcendence resets and are never cleared.

- schema: add six new Float fields to the Player model
- prestige route: capture current-run totals and increment lifetime
  fields before resetting per-run counters to zero
- profile route: return lifetime fields as the All Time section data;
  add four new ProfileSettings toggles for visibility control
- ProfilePage: display lifetime bosses/quests/adventurers/achievements
  in All Time section; remove GameProvider dependency by importing
  formatNumber directly (fixes crash on public profile pages)
- EditProfileModal: add four new All Time stat toggles
- types: update Player, ProfileSettings, and PublicProfileResponse
This commit is contained in:
2026-03-07 02:08:41 -08:00
committed by Naomi Carrigan
parent 3cded34f4b
commit 298e1f4604
9 changed files with 213 additions and 39 deletions
@@ -8,14 +8,29 @@ interface EditProfileModalProps {
onClose: () => void;
}
const STAT_TOGGLES: { key: keyof ProfileSettings; label: string; icon: string }[] = [
{ key: "showTotalGold", label: "Total Gold Earned", icon: "πŸͺ™" },
{ key: "showTotalClicks", label: "Total Clicks", icon: "πŸ‘†" },
interface StatToggle {
key: keyof ProfileSettings;
label: string;
icon: string;
}
const CURRENT_RUN_TOGGLES: StatToggle[] = [
{ key: "showCurrentGold", label: "Gold Earned This Run", icon: "πŸͺ™" },
{ key: "showCurrentClicks", label: "Clicks This Run", icon: "πŸ‘†" },
{ key: "showPrestige", label: "Prestige Level", icon: "⭐" },
{ key: "showBossesDefeated", label: "Bosses Defeated", icon: "πŸ’€" },
{ key: "showQuestsCompleted", label: "Quests Completed", icon: "πŸ“œ" },
{ key: "showAdventurersRecruited", label: "Adventurers Recruited", icon: "βš”οΈ" },
{ key: "showAchievementsUnlocked", label: "Achievements Unlocked", icon: "πŸ†" },
];
const ALL_TIME_TOGGLES: StatToggle[] = [
{ key: "showTotalGold", label: "Total Gold Earned", icon: "πŸͺ™" },
{ key: "showTotalClicks", label: "Total Clicks", icon: "πŸ‘†" },
{ key: "showLifetimeBossesDefeated", label: "Bosses Defeated", icon: "πŸ’€" },
{ key: "showLifetimeQuestsCompleted", label: "Quests Completed", icon: "πŸ“œ" },
{ key: "showLifetimeAdventurersRecruited", label: "Adventurers Recruited", icon: "βš”οΈ" },
{ key: "showLifetimeAchievementsUnlocked", label: "Achievements Unlocked", icon: "πŸ†" },
{ key: "showGuildFounded", label: "Guild Founded Date", icon: "πŸ“…" },
];
@@ -126,8 +141,27 @@ export const EditProfileModal = ({ onClose }: EditProfileModalProps): React.JSX.
<div className="edit-profile-section">
<p className="edit-profile-label">Visible Stats</p>
<p className="edit-profile-sublabel">Choose which stats appear on your public profile.</p>
<p className="edit-profile-stat-group-heading">Current Run</p>
<div className="stat-toggles">
{STAT_TOGGLES.map(({ key, label, icon }) => (
{CURRENT_RUN_TOGGLES.map(({ key, label, icon }) => (
<button
key={key}
className={`stat-toggle-btn ${settings[key] ? "stat-toggle-on" : "stat-toggle-off"}`}
onClick={() => { toggleSetting(key); }}
type="button"
>
<span>{icon} {label}</span>
<span className="stat-toggle-indicator">
{settings[key] ? "βœ“ Shown" : "Hidden"}
</span>
</button>
))}
</div>
<p className="edit-profile-stat-group-heading">All Time</p>
<div className="stat-toggles">
{ALL_TIME_TOGGLES.map(({ key, label, icon }) => (
<button
key={key}
className={`stat-toggle-btn ${settings[key] ? "stat-toggle-on" : "stat-toggle-off"}`}