feat: v1 prototype — core game systems #30

Merged
naomi merged 84 commits from feat/prototype into main 2026-03-08 15:53:39 -07:00
Showing only changes of commit 42db6e1991 - Show all commits
@@ -1,5 +1,7 @@
import type { Adventurer } from "@elysium/types";
import { useState } from "react";
import { useGame } from "../../context/GameContext.js";
import { LockToggle } from "../ui/LockToggle.js";
const CLASS_ICONS: Record<string, string> = {
warrior: "🗡️",
@@ -48,22 +50,31 @@ const AdventurerCard = ({ adventurer, currentGold }: AdventurerCardProps): React
export const AdventurerPanel = (): React.JSX.Element => {
const { state } = useGame();
const [showLocked, setShowLocked] = useState(true);
if (!state) return <section className="panel"><p>Loading...</p></section>;
const locked = state.adventurers.filter((a) => !a.unlocked);
const visible = showLocked ? state.adventurers : state.adventurers.filter((a) => a.unlocked);
return (
<section className="panel adventurer-panel">
<h2>Adventurers</h2>
<div className="panel-header">
<h2>Adventurers</h2>
<LockToggle
lockedCount={locked.length}
showLocked={showLocked}
onToggle={() => { setShowLocked((v) => !v); }}
/>
</div>
<div className="adventurer-list">
{state.adventurers
.filter((a) => a.unlocked)
.map((adventurer) => (
<AdventurerCard
key={adventurer.id}
adventurer={adventurer}
currentGold={state.resources.gold}
/>
))}
{visible.map((adventurer) => (
<AdventurerCard
key={adventurer.id}
adventurer={adventurer}
currentGold={state.resources.gold}
/>
))}
</div>
</section>
);