Files
wikideck/src/game/Results.tsx
T
claudeandClaude Opus 5.5 b6dcd74cc3 Play section: lobby, deck builder, match, results, tutorial
Mobile-first game UI in src/game/, built against a UI-side EngineAdapter.
A temporary mock 3-lane engine (src/game/mock/) stands in until
shared/game lands. Tap a card, then tap a lane; bottom thumb dock; bottom
sheets instead of hover; full-screen match on phones. Lobby lists local
and peer modes (GET /api/game/modes, parsed defensively) and shows the
eom.dev login state through a stub hook for the SSO team.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 23:16:18 -05:00

25 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { ArrowLeft, RotateCcw, Trophy } from 'lucide-react';
import type { ResultView } from './types.ts';
export function Results({ result, modeName, onRematch, onLobby }: { result: ResultView; modeName: string; onRematch: () => void; onLobby: () => void }) {
const outcome = result.winner === null ? 'draw' : result.winner === 0 ? 'win' : 'loss';
const won = result.lanes.filter(l => l.winner === 0).length;
return <section className={`play-panel results ${outcome}`} aria-labelledby="result-title">
<div className="result-mark" aria-hidden="true"><Trophy size={34} /></div>
<div className="section-eyebrow">{modeName.toUpperCase()} · {result.turns} TURNS</div>
<h2 id="result-title">{outcome === 'win' ? 'Victory!' : outcome === 'loss' ? 'Defeat' : 'Draw'}</h2>
<p className="muted">{result.reason === 'concede' ? (outcome === 'win' ? 'Your opponent conceded.' : 'You conceded.')
: `You won ${won} of ${result.lanes.length} lanes.`}</p>
<ol className="result-lanes">
{result.lanes.map(l => <li key={l.name} className={l.winner === 0 ? 'won' : l.winner === 1 ? 'lost' : 'tied'}>
<span>{l.name}</span><b>{l.myPower} – {l.theirPower}</b><small>{l.winner === 0 ? 'Won' : l.winner === 1 ? 'Lost' : 'Tied'}</small>
</li>)}
</ol>
<p className="muted small">Matches are off-chain. No card was moved or burned.</p>
<div className="play-actions">
<button className="button outline" onClick={onLobby}><ArrowLeft size={16} /> Lobby</button>
<button className="button dark" onClick={onRematch}><RotateCcw size={16} /> Rematch</button>
</div>
</section>;
}