Skip to content

feat(docs): badge the four newest items per type in the sidebar - #27

Merged
Arifulislam5577 merged 1 commit into
feat/loader-and-testimonial-blocksfrom
feat/new-badge-sidebar
Oct 7, 2026
Merged

Arifulislam5577 merged 1 commit into
feat/loader-and-testimonial-blocksfrom
feat/new-badge-sidebar

Conversation

@moshiur01

Copy link
Copy Markdown
Contributor

Moves the "New" badge into the sidebar and makes it automatic: the four newest components and the four newest blocks wear it, and adding a fifth pushes the oldest off.

Stacked on #26 (it dates the three blocks that PR adds). Once #26 merges, this retargets to main.

What changes

  • addedAt replaces isNew. Every registry entry now records the day it joined, as YYYY-MM-DD. It's required by the type and checked by the registry test, so no new item can skip it. All 48 entries are backfilled from the day each item's source file was first committed.
  • One rule, in lib/new-items.ts. newestOfType sorts by addedAt, newest first, and breaks a same-day tie by registry order (the entry appended later counts as newer), then keeps NEW_LIMIT = 4. Components and blocks are counted separately.
  • Sidebar badge. flattenSections takes an isNew picker and marks matching catalog pages on the server. The client sidebar only reads a boolean per row and never imports the registry.
  • Gallery. The separate "New" section is gone. Cards keep their badge through the same rule.
  • Dark mode. Both badges use the tween-accent token (deep teal in light, soft teal in dark). The old card badge hard-coded the light teal, which was faint on the dark background.

Worth calling out in review

  • Why not registry order alone: registry-ui.ts isn't in the order items were added. Magnetic Button and Dot Bloom Button were added last but sit among the other buttons, so array position couldn't tell "newest" apart.
  • The result today matches the hand-set flags for components (Dot Bloom Button, Magnetic Button, Morphing Text, Wordmark Reveal). For blocks, the flag had drifted onto eight items. It's now the four newest: Testimonial Ring, Loader Iris Ring, Loader Line Fold and Footer Wordmark Rise.
  • Adding an item: set addedAt to today. Nothing else needs touching; the oldest badge drops on its own.

Checks

Typecheck is clean, registry:build passes and the full suite passes (956 tests). The new tests cover the limit, the fifth-item rollover, same-day ties, per-type counting, the live registry, the sidebar marking and a valid date on every entry. Checked in headless Chrome: exactly 4 + 4 badges in the sidebar and on the cards, in light and dark themes, with no "New" section. next build was not run locally.

Replace the hand-set `isNew` flag with an `addedAt` date on every
registry entry, backfilled from the day each item's source file was
first committed. One rule now picks the four newest components and the
four newest blocks: newest `addedAt` first, a same-day tie going to the
entry appended later. Adding a fifth item pushes the oldest badge off,
with nothing to clear by hand.

The badge moves into the sidebar: `flattenSections` takes a picker and
marks matching catalog pages on the server, so the client sidebar never
loads the registry. Gallery cards keep their badge through the same
rule, and both now use the theme's accent token, so the badge reads in
dark mode too. The gallery's separate "New" section is removed.

Tests cover the limit, the fifth-item rollover, same-day ties, separate
counting per type, the live registry, the sidebar marking, and a valid
`addedAt` on every entry.
@vercel

vercel Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tween-ui Ready Ready Preview Oct 7, 2026 6:06am UTC

@Arifulislam5577
Arifulislam5577 merged commit d09663b into feat/loader-and-testimonial-blocks Oct 7, 2026
3 checks passed

This branch was successfully deployed

1 active deployment
Preview — a8f4f523 Deployed Oct 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants