diff --git a/src/App.tsx b/src/App.tsx index bc95dbf..e302ace 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -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() {
MINE · COLLECT · TRADE CARDS

Mine with your CPU.
Collect the world.

Turn illustrated Wikipedia discoveries into collectible cards. Mine with RandomX, build a collection around what you love, and trade cards directly with other collectors.

CPU-friendly RandomX Direct card-for-card trades
✳+
Preview cards · not owned
setSelected(samples[2])} />
setSelected(samples[0])} />
A world worth collecting
+ setView('Play')} />
Native NFTs minted{snapshot?.blocks.length.toLocaleString() ?? '—'}canonical chain
Block height{snapshot ? `#${snapshot.blocks.at(-1)?.height ?? 0}` : '—'}current tip
diff --git a/src/Landing.tsx b/src/Landing.tsx new file mode 100644 index 0000000..933de92 --- /dev/null +++ b/src/Landing.tsx @@ -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
+
+
PLAY · EDIT WAR
+

Your cards are a deck. Play it.

+

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.

+
    +
  1. 1
    Three Topics

    Each is judged on one stat:

  2. +
  3. 2
    Six turns

    Energy grows each turn. You and your opponent plan at the same time, then cards reveal one by one.

  4. +
  5. 3
    Win two Topics

    Lead in more Topics than your opponent when turn 6 ends.

  6. +
+

No cards yet? Pick a starter deck and play right away. Matches are off-chain: no card is ever moved or burned.

+
+ + {onHowToPlay && } +
+
+
; +} diff --git a/src/landing.css b/src/landing.css new file mode 100644 index 0000000..2ffa2b7 --- /dev/null +++ b/src/landing.css @@ -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}} diff --git a/tests/ui-landing.test.ts b/tests/ui-landing.test.ts new file mode 100644 index 0000000..20546cc --- /dev/null +++ b/tests/ui-landing.test.ts @@ -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, / 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'); +});