Show the shop shortfall above the buy button so buttons stay aligned
"Il vous manque … poussières." sat under the button and pushed it below the buttons of the other items in the row. The shortfall and the pending opening notice now come before the button, which stays at the bottom of every card. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e8ec657193
commit
99a438ff1d
2 changed files with 14 additions and 2 deletions
|
|
@ -509,6 +509,17 @@ test("player opens and reveals a three-card pack", async ({ page }) => {
|
|||
await expect(shopPackItem.locator('img[src="/static/img/cards/stardust/back.webp"]')).toBeVisible();
|
||||
await expect(shopPackItem.getByRole("button", { name: "Acheter et ouvrir" })).toBeDisabled();
|
||||
await expect(shopPackItem).toContainText("Il vous manque 60 poussières.");
|
||||
// Le manque s'affiche au-dessus du bouton : les boutons d'une même rangée d'articles restent alignés.
|
||||
const buyButtons = await page.locator(".nebula-shop-grid .nebula-shop-item-actions > button:last-child").evaluateAll((buttons) => buttons.map((button) => ({
|
||||
row: Math.round(button.closest(".nebula-shop-item").getBoundingClientRect().top), bottom: Math.round(button.getBoundingClientRect().bottom),
|
||||
last: button === button.parentElement.lastElementChild
|
||||
})));
|
||||
expect(buyButtons.length).toBeGreaterThan(1);
|
||||
for (const button of buyButtons) {
|
||||
expect(button.last).toBe(true);
|
||||
expect(button.bottom).toBe(buyButtons.find((other) => other.row === button.row).bottom);
|
||||
}
|
||||
await page.locator(".nebula-shop-grid").screenshot({ path: join(tmpdir(), "sokkog-cards-shop.png") });
|
||||
// Le solde ne met plus en avant les ouvertures achetées : la boutique est une grille d'articles illustrés.
|
||||
await expect(page.locator(".nebula-shop-wallet")).not.toContainText("Ouvertures achetées");
|
||||
// Le solde est sous le menu, et la page se limite à son en-tête et à ses articles.
|
||||
|
|
|
|||
|
|
@ -88,8 +88,9 @@ function QuantityItem({ id, cover, title, description, quantityLabel, rateLabel,
|
|||
<QuantityInput value={value} max={max} label={quantityLabel} busy={busy} onChange={set} />
|
||||
<span className="nebula-shop-item-rate"><StardustBalance value={price} /> {rateLabel}</span>
|
||||
</div>
|
||||
<BuyButton label={actionLabel} total={quantity * price} disabled={busy || max < 1} />
|
||||
{/* Au-dessus du bouton : il reste aligné sur ceux des autres articles. */}
|
||||
{max < 1 && <p className="nebula-form-help" role="status">Il vous manque {formatStardust(price - stardust)}.</p>}
|
||||
<BuyButton label={actionLabel} total={quantity * price} disabled={busy || max < 1} />
|
||||
</div>
|
||||
</form>
|
||||
</article>;
|
||||
|
|
@ -149,9 +150,9 @@ export function ShopPanel({ catalog, state, runMutation, busy, content, onOpenPa
|
|||
<h4>{shopPack.name}</h4>
|
||||
<p className="nebula-form-help">{content.packDescription}</p>
|
||||
<div className="nebula-shop-item-actions">
|
||||
<BuyButton label={content.packAction} total={shop.shopPackPrice} type="button" disabled={busy || packMissing > 0 || Boolean(state.pendingOpening)} onClick={buyPack} />
|
||||
{packMissing > 0 && <p className="nebula-form-help">Il vous manque {formatStardust(packMissing)}.</p>}
|
||||
{state.pendingOpening && <p className="nebula-form-help">{content.packPending}</p>}
|
||||
<BuyButton label={content.packAction} total={shop.shopPackPrice} type="button" disabled={busy || packMissing > 0 || Boolean(state.pendingOpening)} onClick={buyPack} />
|
||||
</div>
|
||||
</div>
|
||||
</article>}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue