portrait-only: drop landscape rotate prompt + lock to portrait
- Remove RotatePrompt (the "rotate to landscape" overlay) — the app is portrait now, so it only blocked the UI. - page.tsx: best-effort orientation lock switched landscape → portrait. - Add Playwright-based store-screenshot + icon scripts (scripts/shots.js, game.js, icon.js); generated images are gitignored. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
// Capture several frames of an actual vs-computer game so we can pick the best
|
||||
// "gameplay" shot (hand fanned at the bottom, trump chosen, a trick in play).
|
||||
const { chromium } = require("playwright");
|
||||
const path = require("path");
|
||||
const OUT = path.join(__dirname, "shots");
|
||||
const URL = process.env.SHOT_URL || "http://localhost:3025/";
|
||||
|
||||
(async () => {
|
||||
const browser = await chromium.launch({ channel: "chrome" });
|
||||
const ctx = await browser.newContext({
|
||||
viewport: { width: 430, height: 932 },
|
||||
deviceScaleFactor: 2,
|
||||
locale: "fa-IR",
|
||||
isMobile: true,
|
||||
hasTouch: true,
|
||||
});
|
||||
const page = await ctx.newPage();
|
||||
await page.goto(URL, { waitUntil: "networkidle" }).catch(() => {});
|
||||
await page.waitForTimeout(2500);
|
||||
|
||||
await page.getByText("بازی با کامپیوتر", { exact: false }).first().click();
|
||||
// Capture a frame every few seconds through deal → hakem → trump → play.
|
||||
const stamps = [6, 10, 14, 18, 24, 30];
|
||||
let prev = 0;
|
||||
for (const s of stamps) {
|
||||
await page.waitForTimeout((s - prev) * 1000);
|
||||
prev = s;
|
||||
await page.screenshot({ path: path.join(OUT, `game-${String(s).padStart(2, "0")}s.png`) });
|
||||
// If it's our turn to choose trump, pick the first suit so play proceeds.
|
||||
try {
|
||||
const trump = page.getByText("حکم را انتخاب", { exact: false });
|
||||
if (await trump.count()) {
|
||||
const suit = page.locator("button").filter({ hasText: /♠|♥|♦|♣/ }).first();
|
||||
if (await suit.count()) await suit.click({ timeout: 1500 }).catch(() => {});
|
||||
}
|
||||
} catch {}
|
||||
console.log("frame", s + "s");
|
||||
}
|
||||
await browser.close();
|
||||
console.log("DONE");
|
||||
})().catch((e) => { console.error("FATAL", e); process.exit(1); });
|
||||
Reference in New Issue
Block a user