Stack desktop panels in independent columns

The desktop grid shared rows with the board, so the decision/hand column and
the chains column stretched to the board's height and left large empty areas.
Group the panels into columns that stack independently: board and players;
decision, hand and chains; history and chat. Tablets keep the board and
players beside the decision, hand and chains, with history and chat below.
Phones place the panels individually as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claude 2026-11-04 06:58:56 -07:00 • committed by Mike Isom
commit 2ffadb9ae4
2 changed files with 91 additions and 59 deletions

View file

@ -18,35 +18,43 @@
<main class="acquire" data-theme={store.theme} lang={store.locale} dir={store.rightToLeft ? "rtl" : "ltr"}>
{#if store.state}
{@const state = store.view!}
<!-- Each column stacks its panels independently on wider screens, so a short panel never stretches
to the board's height; phones place the panels individually (the columns are display: contents). -->
<div class="layout">
<div class="controls">
<Status {state} seats={store.seats} />
<ActionPanel {store} />
</div>
<div class="board">
<Board
{state}
selected={store.selected}
onplace={(tile) => store.send({ type: "place", tile: tileLabel(tile) })}
/>
</div>
{#if store.seats.length > 0 && store.replayAt === undefined}
<div class="hand">
<Hand {store} />
<div class="hand-confirm"><PlaceConfirm {store} nearHand /></div>
<div class="column turn-column">
<div class="controls">
<Status {state} seats={store.seats} />
<ActionPanel {store} />
</div>
{#if store.seats.length > 0 && store.replayAt === undefined}
<div class="hand">
<Hand {store} />
<div class="hand-confirm"><PlaceConfirm {store} nearHand /></div>
</div>
{/if}
<div class="market">
<ChainTable {state} seats={store.seats} />
<PriceTable {state} />
</div>
{/if}
<div class="market">
<ChainTable {state} seats={store.seats} />
<PriceTable {state} />
</div>
<div class="players">
<Players {state} seats={store.seats} />
<div class="column board-column">
<div class="board">
<Board
{state}
selected={store.selected}
onplace={(tile) => store.send({ type: "place", tile: tileLabel(tile) })}
/>
</div>
<div class="players">
<Players {state} seats={store.seats} />
</div>
</div>
<div class="column talk-column">
<div class="history"><Log {state} /></div>
{#if !store.analysis}
<div class="conversation"><Chat /></div>
{/if}
</div>
{#if !store.analysis}
<div class="conversation"><Chat /></div>
{/if}
<div class="history"><Log {state} /></div>
</div>
{:else}
<p>{store.lang.t("loading")}</p>
@ -54,7 +62,7 @@
</main>
<style>
/* Keep the decision and board together on narrow screens. */
/* Phones: one column that keeps the decision, board and hand together. */
.layout {
display: grid;
gap: 20px;
@ -62,7 +70,11 @@
grid-template-areas: "controls" "board" "hand" "market" "players" "conversation" "history";
align-items: start;
}
.layout > div {
.column {
display: contents;
}
.column,
.column > div {
min-width: 0;
}
.controls {
@ -74,12 +86,6 @@
.hand {
grid-area: hand;
}
/* Phones show the decision above the board: repeat the placement confirmation under the rack. */
@media (min-width: 700px) {
.hand-confirm {
display: none;
}
}
.market {
grid-area: market;
display: grid;
@ -97,29 +103,44 @@
.history {
grid-area: history;
}
/* Tablets and phones in landscape: the board beside the decision and hand. */
/* Tablets and phones in landscape: the board and players beside the decision, hand and chains;
history and chat below. */
@media (min-width: 700px) {
.layout {
grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr);
grid-template-areas:
"board controls"
"board hand"
"market players"
"history conversation";
grid-template-rows: auto 1fr auto auto;
grid-template-areas: "main turn" "history conversation";
}
.board-column,
.turn-column {
display: flex;
flex-direction: column;
gap: 20px;
}
.board-column {
grid-area: main;
}
.turn-column {
grid-area: turn;
}
/* Placing a tile needs no second confirmation here: the decision is right above the hand. */
.hand-confirm {
display: none;
}
}
/* Desktop: keep the market beside the board; spread the supporting panels across a second row
instead of letting chat and history make one very tall sidebar. */
/* Desktop: three independent columns (board and players; decision, hand and chains; history and
chat), so none of them leaves an empty area beside the board. */
@media (min-width: 1200px) {
.layout {
row-gap: 16px;
grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr) minmax(320px, 1fr);
grid-template-areas:
"board controls market"
"board hand market"
"players history conversation";
grid-template-rows: auto 1fr auto;
grid-template-areas: "main turn talk";
}
.column {
display: flex;
flex-direction: column;
gap: 16px;
}
.talk-column {
grid-area: talk;
}
}
</style>

View file

@ -668,7 +668,7 @@ try {
await open(`players=4&moves=95&publicHoldings=1&theme=${theme}`);
const geometry = await page.evaluate(() => {
const main = document.querySelector("main");
const column = document.querySelector(".layout > .board");
const column = document.querySelector(".board-column > .board");
const frame = column.querySelector(".frame");
return {
margin: getComputedStyle(document.body).margin,
@ -1028,17 +1028,28 @@ try {
"desktop/phone undo, repeated private revisions, refresh, no undo network calls, one saved turn and one clock increment"
);
// The desktop used to stack every supporting panel in one tall sidebar. Check the rendered
// arrangement and height, not only horizontal overflow, before creating gallery images.
// The desktop used to stack every supporting panel in one tall sidebar, and later left empty
// areas beside the board. Each column now stacks its own panels; check the rendered arrangement.
await page.setViewportSize({ width: 1280, height: 900 });
await open("players=4&moves=95&publicHoldings=1");
const board = await page.locator(".layout > .board").boundingBox();
const panels = await Promise.all(
[".players", ".history", ".conversation"].map((selector) => page.locator(`.layout > ${selector}`).boundingBox())
);
for (const panel of panels) {
assert.ok(panel.y >= board.y + board.height, "supporting panels sit below the board");
assert.ok(Math.abs(panel.y - panels[0].y) < 1, "supporting panels share a desktop row");
const box = (selector) => page.locator(`.layout ${selector}`).boundingBox();
const columns = [
[".board-column > .board", ".board-column > .players"],
[".turn-column > .controls", ".turn-column > .hand", ".turn-column > .market"],
[".talk-column > .history", ".talk-column > .conversation"],
];
let previousColumn;
for (const column of columns) {
const boxes = await Promise.all(column.map(box));
for (const [index, panel] of boxes.entries()) {
assert.ok(Math.abs(panel.x - boxes[0].x) < 1, `${column[index]} stays in its column`);
if (index > 0) {
const gap = panel.y - (boxes[index - 1].y + boxes[index - 1].height);
assert.ok(gap >= 0 && gap < 40, `${column[index]} follows the panel above it without an empty area`);
}
}
assert.ok(!previousColumn || boxes[0].x > previousColumn.x + previousColumn.width, "desktop columns side by side");
previousColumn = boxes[0];
}
assert.ok((await page.locator("main").boundingBox()).height <= 900, "desktop game fits within 900px");
assert.equal(await page.locator(".log li").count(), 8);
@ -1046,7 +1057,7 @@ try {
assert.ok((await page.locator(".log li").count()) > 100, "full history remains available");
await page.locator(".history button").click();
assert.equal(await page.locator(".log li").count(), 8);
report.scenarios.push("balanced desktop panels, compact recent history and expandable full log");
report.scenarios.push("independent desktop columns, compact recent history and expandable full log");
for (const [name, params, width, height] of [
["overview", "players=4&moves=95&publicHoldings=1", 1280, 900],
@ -1057,7 +1068,7 @@ try {
for (const theme of ["light", "dark"]) {
await open(`${params}&theme=${theme}`);
const main = await page.locator("main").boundingBox();
const hand = await page.locator(".layout > .hand").boundingBox();
const hand = await page.locator(".turn-column > .hand").boundingBox();
// Desktop shows the whole compact layout. On phones frame the complete decision, board
// and hand, without appending a long column of tables, chat and history to the image.
const captureHeight = Math.ceil(width < 700 ? hand.y + hand.height + 12 : main.height);