Skip to content

[v35] feat(store): show running sales and flash sales in the store - #6267

Merged
Celant merged 1 commit into
v35from
cherry-pick/v35/pr-6234
Nov 4, 2026
Merged

Celant merged 1 commit into
v35from
cherry-pick/v35/pr-6234

Conversation

@openfront-backport

Copy link
Copy Markdown

Cherry-pick of #6234 onto v35. It conflicted, and Claude resolved it.

Conflicted files:

  • src/client/Store.ts
  • src/client/components/CosmeticCard.ts

Typecheck, format and lint pass on the result.

Check the fix before merging.

**Add approved & assigned issue number here:**

Resolves #6233

Shows the player when a store sale is running, and adds flash sales.
While a sale covers an item, the API serves the sale price in
`priceHard`/`priceSoft`, so prices and charges were already right. This
PR makes the sale visible. The server side is openfrontio/infra#1084.

- **Sale banner:** a strip under the store header for each running sale:
a `-30%` badge, the sale's name, "30% off selected items" (or
"store-wide" when it covers everything), and an "Ends in 2d 5h"
countdown. The countdown turns yellow in the sale's last 24 hours.
- **"On sale" tab:** a first sub-tab listing everything discounted. It
shows only while something is on sale. Discounted items are also sorted
first on the other tabs.
- **Sale ribbon:** a diagonal `-30%` band across the top-right corner of
a discounted item's artwork, in the brand Aquarius blue (orange under
the Halloween theme).
- **Buy buttons:** the new price, with the old price struck through
underneath it. Screen readers hear "Now 70, was 100".
- **The "?" info button** moves to the card's top-left so it doesn't sit
under the ribbon.

A flash sale discounts one for-sale item at a time, at a deeper
discount, and moves on to another item every slot (for example every 2
hours). It's the same item for every player.

- **In the banner:** a slim "Flash sale" row under the regular sale
strip, or a full strip if it's the only sale. Clicking it opens the On
sale tab.
- **At the top of the On sale tab:** the flash item with a title and a
live `1:23:45` clock to the next item.
- **On the card:** a pulsing glow with a spinning edge, and a "1:23:45
left" timer along the bottom of the artwork. Under reduced motion it's a
static outline.

- **Schemas** (`packages/shared/src/CosmeticSchemas.ts`): a
`PromotionSchema` (with optional `kind: "flash"`); optional
`listPriceHard`/`listPriceSoft`/`promotion` on cosmetics and packs; an
optional top-level `promotions` list. All optional, so an older
`cosmetics.json` still parses.
- **`activeSale()`** (`Cosmetics.ts`) decides whether an item is on sale
right now: its promotion hasn't ended and its list price is above its
price.
- **`<sale-countdown>`** (`components/SaleCountdown.ts`) ticks on its
own (every 30s, or every second for the clock), so the store doesn't
re-render to update a timer.
- **Ended sales:** a sale whose end has passed is hidden straight away,
items fall back to their list price, and the catalog is refetched. When
the store opens, a catalog older than 60s is refetched. Every store
fetch (opening, sign-in, a sale ending) goes through `loadCatalog`,
which keeps only the newest request's answer, so an older response
landing last can't replace a newer catalog.
- **i18n:** new `store.*` keys in `en.json` for the banner, countdowns,
the On sale tab and flash sales. `store.sale_banner` is removed.

**On sale tab with a flash sale:** the banner, the flash item leading
the tab with its countdown, and the glowing flash card.

<img width="1538" height="784" alt="store-on-sale-flash"
src="https://github.com/user-attachments/assets/b676e24e-b125-474d-b666-9daeb26c8d18"
/>

**Sale cards:** the corner ribbon and the struck-through list price on
each buy button.

<img width="1538" height="784" alt="store-sale-cards"
src="https://github.com/user-attachments/assets/5b100f1f-83da-47b8-b51f-5e740796451f"
/>

**Halloween theme, Skins tab:** the same UI follows the theme (orange),
and items on sale sort first, the flash item leading.

<img width="1538" height="784" alt="store-halloween-skins"
src="https://github.com/user-attachments/assets/3df857c1-6a38-496a-a502-c3f80b1a987c"
/>

- [x] I have added screenshots for all UI updates (above, from a local
build against a fake catalog API).
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory:
- `StoreModal`: the banner, store-wide vs selected items, the On sale
tab and its ordering, the flash row and hero, ended sales hidden, the
countdown text and clock;
- `CosmeticCard`: the ribbon, the flash glow, ring and timer, "?" on the
top-left;
- `PurchaseButton`: the struck list price with its screen-reader labels,
nothing when the list price isn't above the price;
- `CosmeticsStaleRefresh`: a fresh catalog is kept and a stale one is
refetched.

`npm run typecheck` and `npm run lint` are clean, and the 139 store,
card and purchase tests pass.

regression is found:

DISCORD_USERNAME

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: iamlewis <lewismmmm@gmail.com>
(cherry picked from commit 74832f3)

Conflicts resolved for v35 by Claude.
@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a6f362d2-ed50-4918-8fbe-5ae1370e5a4c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@Celant
Celant merged commit 678e5f3 into v35 Nov 4, 2026
18 of 19 checks passed
@Celant
Celant deleted the cherry-pick/v35/pr-6234 branch November 4, 2026 18:42
@github-project-automation github-project-automation Bot moved this from Triage to Complete in OpenFront Release Management Nov 4, 2026

This branch was successfully deployed

1 active and 1 inactive deployments
backport — 4e32edfc Deployed Nov 4, 2026 by Celant via Cherry-pick #831
staging — 4e32edfc Deployed Nov 3, 2026 by openfrontio[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

2 participants