Landing: explain Edit War and add a Play button

Upstream WikiDeck/wikideck#3 ("No homepage"). A landing block at the top of
Discover explains the game in three steps, tells new players they can start
with a starter deck (matches are off-chain), and its Play now button opens
the Play view. App.tsx: one import and one element. Mobile-first: no hover
states, a 44 px tap target, full-width button under 480 px, theme colours.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 00:35:50 -05:00
co-authored by Claude Opus 5.5
parent 361efaa1d6
commit d028a2838f
4 changed files with 57 additions and 0 deletions
+2
View File
@@ -16,6 +16,7 @@ import { IS_MAINNET, NETWORK_GENESIS_TIME, NETWORK_LABEL } from '../shared/netwo
import { StateClient } from '../shared/rpc-client.ts';
import { PlaySection } from './game/PlaySection.tsx';
import { isNativeApp } from './native.ts';
import { Landing } from './Landing.tsx';
import './App.css';
import './testnet.css';
@@ -182,6 +183,7 @@ export default function App() {
<div className="hero-copy"><span className="eyebrow"><span /> MINE · COLLECT · TRADE CARDS</span><h1>Mine with your CPU.<br />Collect <span>the world.</span></h1><p>Turn illustrated Wikipedia discoveries into collectible cards. Mine with RandomX, build a collection around what you love, and trade cards directly with other collectors.</p><div className="hero-actions"><button className="button dark" onClick={goMine}><Pickaxe size={17} /> Explore mining <ArrowUpRight size={17} /></button><button className="text-button" onClick={() => setDialog('guide')}>How it works <ArrowRight size={16} /></button></div><div className="hero-foot"><span><Check size={13} /> CPU-friendly RandomX</span><span><Check size={13} /> Direct card-for-card trades</span></div></div>
<div className="hero-visual"><div className="orbit orbit-one" /><div className="orbit orbit-two" /><span className="orbit-spark spark-one">✳</span><span className="orbit-spark spark-two">+</span><div className="floating-label label-top"><Sparkles size={12} /> Preview cards · not owned</div><div className="hero-card back-card"><Card card={samples[2]} onClick={() => setSelected(samples[2])} /></div><div className="hero-card front-card"><Card card={samples[0]} onClick={() => setSelected(samples[0])} /></div><div className="floating-label label-bottom"><Sparkles size={15} /> A world worth collecting <ArrowUpRight size={13} /></div></div>
</section>
<Landing onPlay={() => setView('Play')} />
<section className="metrics" aria-label="Canonical chain statistics">
<div><span className="metric-icon"><Layers3 size={19} /></span><div><span>Native NFTs minted</span><strong>{snapshot?.blocks.length.toLocaleString() ?? '—'}<small>canonical chain</small></strong></div></div>
<div><span className="metric-icon"><Globe2 size={19} /></span><div><span>Block height</span><strong>{snapshot ? `#${snapshot.blocks.at(-1)?.height ?? 0}` : '—'}<small>current tip</small></strong></div></div>
+24
View File
@@ -0,0 +1,24 @@
import { BookOpen, Globe2, Megaphone, Play, Swords } from 'lucide-react';
import './landing.css';
/** Game landing block (upstream WikiDeck/wikideck#3): explains Edit War and leads into Play. */
export function Landing({ onPlay, onHowToPlay }: { onPlay: () => void; onHowToPlay?: () => void }) {
return <section className="game-landing" aria-labelledby="game-landing-title">
<div className="game-landing-copy">
<div className="section-eyebrow"><Swords size={12} /> PLAY · EDIT WAR</div>
<h2 id="game-landing-title">Your cards are a deck. Play it.</h2>
<p>Edit War is a quick two-player card game, about 3–6 minutes a match. Each card is a Wikipedia article.
Its power comes from how famous the article is, and it is strongest in a Topic that matches its best stat.</p>
<ol className="game-landing-steps">
<li><span>1</span><div><strong>Three Topics</strong><p>Each is judged on one stat: <Megaphone size={12} aria-hidden="true" /> attention, <BookOpen size={12} aria-hidden="true" /> depth or <Globe2 size={12} aria-hidden="true" /> reach.</p></div></li>
<li><span>2</span><div><strong>Six turns</strong><p>Energy grows each turn. You and your opponent plan at the same time, then cards reveal one by one.</p></div></li>
<li><span>3</span><div><strong>Win two Topics</strong><p>Lead in more Topics than your opponent when turn 6 ends.</p></div></li>
</ol>
<p className="game-landing-note">No cards yet? Pick a starter deck and play right away. Matches are off-chain: no card is ever moved or burned.</p>
<div className="game-landing-actions">
<button className="button dark game-landing-play" onClick={onPlay}><Play size={15} /> Play now</button>
{onHowToPlay && <button className="text-button" onClick={onHowToPlay}>How to play</button>}
</div>
</div>
</section>;
}
+15
View File
@@ -0,0 +1,15 @@
.game-landing{margin:24px 0;padding:24px;border:1px solid var(--theme-border);border-radius:12px;background:var(--ctp-mantle)}
.game-landing .section-eyebrow{display:flex;align-items:center;gap:6px;color:var(--theme-accent)}
.game-landing h2{font-size:24px;line-height:1.25;letter-spacing:-.5px;margin:12px 0}
.game-landing p{font-size:13px;line-height:1.75;color:var(--ctp-subtext0);margin:0 0 14px;max-width:720px}
.game-landing-steps{list-style:none;padding:0;margin:18px 0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.game-landing-steps li{display:flex;gap:12px;align-items:flex-start;padding:14px;border-radius:10px;background:var(--ctp-base);border:1px solid var(--theme-border)}
.game-landing-steps li>span{flex:none;display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--theme-accent);color:var(--ctp-base);font-weight:700;font-size:13px}
.game-landing-steps strong{display:block;font-size:14px;color:var(--ctp-text);margin-bottom:4px}
.game-landing-steps p{font-size:12px;line-height:1.6;margin:0}
.game-landing-steps svg{vertical-align:-2px}
.game-landing-note{font-size:12px!important}
.game-landing-actions{display:flex;align-items:center;gap:18px;flex-wrap:wrap}
.game-landing .game-landing-play{min-height:44px;height:auto;padding:12px 22px;font-size:12px;gap:8px}
@media(max-width:800px){.game-landing-steps{grid-template-columns:1fr}}
@media(max-width:480px){.game-landing{padding:18px 16px}.game-landing h2{font-size:20px}.game-landing .game-landing-play{width:100%;justify-content:center}}
+16
View File
@@ -0,0 +1,16 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
test('landing explains Edit War and offers a thumb-sized Play button (upstream #3)', async () => {
const read = (file: string) => readFile(new URL(`../${file}`, import.meta.url), 'utf8');
const [landing, css, app] = await Promise.all([read('src/Landing.tsx'), read('src/landing.css'), read('src/App.tsx')]);
assert.match(app, /<Landing onPlay=\{\(\) => setView\('Play'\)\} \/>/, 'App mounts the landing block and its button opens Play');
assert.match(landing, /export function Landing\(\{ onPlay/);
assert.match(landing, /onClick=\{onPlay\}/);
assert.match(landing, /Play now/);
for (const idea of ['Three Topics', 'Six turns', 'Win two Topics', 'starter deck', 'off-chain']) assert.ok(landing.includes(idea), idea);
assert.doesNotMatch(css, /:hover/, 'no hover-only interactions');
assert.match(css, /min-height:44px/, 'tap target is at least 44px');
assert.doesNotMatch(css, /#[0-9a-f]{3,6}\b/i, 'colours come from the Catppuccin theme variables');
});