forked from WikiDeck/wikideck
[ui-a] Play section: lobby, deck builder, match, results, tutorial #26
@@ -4,12 +4,14 @@ 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;
|
||||
const lost = result.lanes.filter(l => l.winner === 1).length;
|
||||
const tiebreak = result.reason === 'lanes' && won === lost;
|
||||
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>
|
||||
: `You won ${won} of ${result.lanes.length} lanes${tiebreak ? ', so total power decided it' : ''}.`}</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>
|
||||
|
||||
+2
-1
@@ -165,7 +165,8 @@
|
||||
/* Phones: the match takes the whole screen so the board and the thumb dock both fit. */
|
||||
@media(max-width:760px){
|
||||
.match{position:fixed;inset:0;z-index:30;margin:0;max-width:none;border:0;border-radius:0;padding-top:env(safe-area-inset-top);overflow:hidden}
|
||||
.match .lanes{flex:1 1 auto;overflow-y:auto;align-content:start}
|
||||
.match .lanes{flex:1 1 auto;overflow-y:auto;align-content:stretch}
|
||||
.match .lane-side{flex:1 1 auto}
|
||||
.match-dock{position:static;border-radius:0}
|
||||
.lane-side{min-height:84px}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user