forked from WikiDeck/wikideck
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>
25 lines
1.6 KiB
TypeScript
25 lines
1.6 KiB
TypeScript
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>;
|
||
}
|