Repository navigation
[v36] Store: "New" badge and New tab for recently added items - #6499
Open
openfront-backport[bot] wants to merge 1 commit into
Open
openfront-backport[bot] wants to merge 1 commit into
openfront-backport[bot] wants to merge 1 commit into
Conversation
## What this does
Cosmetics and bundles that were just added to the store now get a
**"New" badge** on their card. The store also gets a **New** section, so
players can see what was added.
- **Where new comes from:** the API decides, in the companion infra PR.
It sends `newUntil` on each cosmetic and pack added in the last 14 days.
The client only compares that with the clock (`isNew` in
`src/client/Cosmetics.ts`), because the catalog is cached.
- **The New tab:** Cosmetics gets a New sub-tab, first in the bar and
shown only while something is new.
- It works like On sale: skins and patterns, flags, crowns, effects and
bundles in one place, newest first.
- Items the player already owns aren't listed.
- `#modal=store&tab=cosmetics&sub=new` opens it directly.
- **The badge:** a gold "New" ribbon in the artwork's top-right corner,
the same corner as the sale ribbon, so everything that marks a card out
sits in one place. It uses Masters gold (`cyber-yellow`) so it reads
differently from the sale's blue, with a dark edge so it stands out on a
legendary card's gold border.
- On its own, New takes the sale band's usual spot.
- With a sale running, the discount keeps the outer band and a slimmer
New band runs directly beneath it, touching. The pair sits further into
the corner so it covers less of the artwork. A sale with nothing new
keeps its band where it is today.
- The "?" details button and the preview (eye) button stay where they
are on `main`.
- The badge only shows in the store (`showNewBadge`). The post-game
pattern offer, which also uses cosmetic cards, doesn't show it.
- **Expiry while the store is open:** a timer fires when the soonest
item stops being new. It drops the badges, and the New tab with its last
item, without a refetch.
- **Flash sale banner and labels:**
- The flash sale's banner line names the item ("Troll Face: 90% off")
instead of "90% off one item". It falls back to the old line if the
catalog doesn't carry the item.
- The flash deadline had three labels for one time: "Next item in" on
the banner, "left" on the card and "NEXT ITEM IN" on the hero. All three
now say "Ends in", which counts down this deal rather than the next
item. The hero's text still explains that the deal then moves to another
item.
- The flash hero holds the price and the buy button, enlarged, under the
offer. Before, they were only on the card, in its smallest text. The
hero's card no longer has its own button, so there is just one.
Purchases from it are still placed as `flash`.
- On the home screen the whole sale banner opens the store, and it now
ends in an arrow (›) to show that.
- Text: `store.flash_ends_in`, `store.flash_sale_item_banner` and
`store.flash_sale_item_row` are new in `en.json`; the unused
`store.flash_next_in` and `store.flash_left` are gone.
- **Analytics:** clicks and purchases from the tab are sent as `subTab:
"new"`. The schema is copied in infra, and the infra PR accepts it.
- **Text:** `store.new_tab` and `store.new_badge` are in `en.json`.
## Screenshots
This branch's dev server. cosmetics.json is the live public catalog with
**sample** `newUntil` values added to six items, and a **sample** 25%
sale on Troll Face. There is no local API.
**Cosmetics → New:** an effect, patterns, a flag and a bundle, newest
first. Troll Face is new and on sale, so it shows both bands, joined.
<img
src="https://github.com/user-attachments/assets/09a46658-8c6e-4f58-ad6c-ad12452933a5"
width="640">
**Skins tab:** new patterns keep their badge where they normally sit.
<img
src="https://github.com/user-attachments/assets/b7dee536-fa4c-4c94-9e35-8d0a9d429475"
width="640">
**Mobile width.**
<img
src="https://github.com/user-attachments/assets/f3a3c8d0-c4c0-45fe-9d5f-e86bc6dff298"
width="240">
**Flash sale, home screen:** alone, and as the row under a weekend sale.
Sample sales in both.
<img
src="https://github.com/user-attachments/assets/0b024dfa-dbb2-439f-980b-698f1657787b"
width="640">
<img
src="https://github.com/user-attachments/assets/7429b6ad-d88b-4b09-a239-6cfe344c78e1"
width="640">
**Flash sale, store:** one "Ends in" on the banner, the card and the
hero, and the price with its buy button beside the offer.
<img
src="https://github.com/user-attachments/assets/ff73d746-b55d-4aed-a67f-afd2911a305b"
width="640">
<img
src="https://github.com/user-attachments/assets/1daf8a0f-f40d-47ee-848a-7c3578ac8e26"
width="240">
## Tests
- `tests/client/StoreModal.test.ts`, New tab:
- Lists new cosmetics, effects and bundles, newest first, with placement
`subTab: "new"`.
- Hidden when nothing is new.
- Leaves out owned items.
- Drops the badges and the tab when the items expire, with no refetch.
- `sub=new` deep link.
- `tests/client/components/SaleBanner.test.ts`: names the flash item for
patterns, flags, effects and bundles, and falls back without one. The
banner line and the row under another sale both name it and say "Ends
in". Home-screen banners end in an arrow.
- `tests/client/StoreModal.test.ts`, flash sale: the banner, hero and
card all say "Ends in", and the old labels are gone. The hero has
exactly one purchase button, outside its card, at the flash price.
- `tests/client/CosmeticCard.test.ts`: the badge shows on a buyable new
item. It doesn't show on an owned or expired one, or where the store
didn't ask for it. The ribbon is a gold band in the top-right corner.
With a sale it sits inside the sale band, and the "?" and eye keep their
usual corners.
`npm run typecheck`, oxlint and oxfmt are clean. `npm run test:changed`:
6570/6571 pass. The one failure is
`tests/perf/client/ClientRenderPipelinePerf.test.ts` (`WebGLTexture is
not defined` in `RailroadPass`). That test imports nothing this PR
changes.
**Needs openfrontio/infra#1222 deployed first.**
Until then the API sends no `newUntil`, so nothing shows.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 9a03a45)
Adjusted for v36 by Claude: the clean pick failed typecheck.
Contributor
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick of #6468 onto
v36. It applied cleanly but failed typecheck onv36, and Claude fixed it.Typecheck, format and lint pass on the result.
Check the fix before merging.