Keep mobile Builder market in dialog
This commit is contained in:
parent
35e0b1397b
commit
46cf889856
3 changed files with 26 additions and 11 deletions
|
|
@ -956,6 +956,32 @@ try {
|
|||
(s) => host.emit("state", s),
|
||||
E.stripSecret(buildingChoice, 0),
|
||||
);
|
||||
if (width <= 760) {
|
||||
assert.equal(
|
||||
await page.locator(".board-layout > .building-market").isVisible(),
|
||||
false,
|
||||
"Builder does not replace the mobile board with an inline market",
|
||||
);
|
||||
assert.equal(
|
||||
await page.locator(".player-board").isVisible(),
|
||||
true,
|
||||
"Builder preserves the player board and its tabs",
|
||||
);
|
||||
assert.equal(await page.locator(".board-player-tabs").count(), 1);
|
||||
assert.equal(await page.locator(".action-dock [data-market]").isVisible(), true);
|
||||
await page.locator(".player-board").scrollIntoViewIfNeeded();
|
||||
const beforeMarketScroll = await page.evaluate(() => scrollY);
|
||||
await page.locator(".action-dock [data-market]").click();
|
||||
assert.equal(await page.locator(".pr-modal").isVisible(), true);
|
||||
assert.equal(await page.locator(".pr-modal .building-market").isVisible(), true);
|
||||
await page.keyboard.press("Escape");
|
||||
assert.equal(await page.locator(".pr-modal").isVisible(), false);
|
||||
assert.ok(
|
||||
Math.abs((await page.evaluate(() => scrollY)) - beforeMarketScroll) < 2,
|
||||
"closing the market restores the mobile board scroll position",
|
||||
);
|
||||
assert.equal(await page.locator(".board-player-tabs").count(), 1);
|
||||
}
|
||||
const passBounds = await page.locator(".dock-pass").boundingBox();
|
||||
assert.ok(
|
||||
Math.abs(
|
||||
|
|
|
|||
|
|
@ -1853,13 +1853,6 @@ body:has(.pr-game) {
|
|||
width: 100%;
|
||||
margin-top: 12px;
|
||||
}
|
||||
.pr-game.is-building .board-layout > .building-market {
|
||||
display: block;
|
||||
order: 1;
|
||||
}
|
||||
.pr-game.is-building .action-panel {
|
||||
display: none;
|
||||
}
|
||||
.pr-game .modal-body .building-market {
|
||||
display: block;
|
||||
padding: 0;
|
||||
|
|
|
|||
|
|
@ -1040,10 +1040,6 @@ export function mountGame(
|
|||
hide(modal);
|
||||
view = Math.min(view, state.players.length - 1);
|
||||
draftInit();
|
||||
shell.classList.toggle(
|
||||
"is-building",
|
||||
isTurn() && ["build", "draft"].includes(state.tasks[0]?.kind),
|
||||
);
|
||||
const html = `<div class="pr-content"><header class="game-header"><div class="wordmark"><span>PUERTO RICO</span><small>${t("metadata.subtitle")}</small></div><span class="round-indicator">${t("round")} <b>${state.round}</b></span><nav>${["rules", "journal", ...(chat && !preferences.analysis ? ["chat"] : [])].map((id) => `<button class="icon-button" data-panel="${id}" title="${esc(t(id))}" aria-label="${esc(t(id))}">${icon(id)}${id === "chat" ? '<span class="chat-unread" aria-hidden="true" hidden></span>' : ""}</button>`).join("")}</nav></header><div class="player-strip${state.players.length > 3 ? " many-players" : ""}">${state.players.map(playerCard).join("")}</div>${playerSummary()}${localControls ? `<div class="local-controls"><span>${t("local")}</span><button data-local="undo" title="${esc(t("undo"))}" aria-label="${esc(t("undo"))}">${icon("undo", 18)}</button><button data-local="opponents" title="${esc(t("opponents"))}" aria-label="${esc(t("opponents"))}">${icon("pass", 18)}</button><button data-local="reset" title="${esc(t("newGame"))}" aria-label="${esc(t("newGame"))}">${icon("reset", 18)}</button>${FORCE_DARK_THEME ? "" : `<button data-local="dark" title="${esc(t("toggleTheme"))}" aria-label="${esc(t("toggleTheme"))}">${icon("dark", 18)}</button>`}</div>` : ""}<div class="board-layout">${sharedBoard()}${playerBoard()}${market()}</div>${bottom()}</div>`;
|
||||
morphdom(content, html, {
|
||||
childrenOnly: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue