Skip to content

feat: tell returning visitors what is new (features and dictionaries) - #122

Merged
forzagreen merged 2 commits into
mainfrom
feat/whats-new
Oct 16, 2026
Merged

forzagreen merged 2 commits into
mainfrom
feat/whats-new

Conversation

@forzagreen

Copy link
Copy Markdown
Owner

What

A «الجديد» (what's new) button in the site header, with a panel that opens by itself once when there is news the visitor's browser has not seen, and can be reopened from the button at any time. Closing it (✕, Esc, or a click anywhere else) marks the news as seen. "Seen" lives in localStorage like the theme: nothing is sent anywhere and no account is needed.

Two kinds of news:

  • Dictionaries added since the last visit — detected automatically from the dictionary ids returned by /api/v1/dicts, so a DB import announces itself with no code change. The 13 KB list is only fetched when number_dictionaries from /api/v1/stats (already fetched by the page) has moved.
  • Features — the hand-written FEATURES list in src/whatsNew.js, meant for what a non-technical reader notices (never dependabot / CI changes). The first entry is the page links to the archive.org scans (feat: link page numbers to the dictionary's scan on archive.org #120), with a small CSS animation of a pointer clicking «ص. 412» and the scanned page opening underneath. No video asset: it follows the theme and the font, weighs nothing, and shows a still end state under prefers-reduced-motion.

A first visit records the state silently — everything is new to a first-time visitor, so the panel would only be noise.

How to add a feature later

Append an entry to FEATURES in src/whatsNew.js: a stable id, a date, a title and a sentence in plain Arabic, optionally a Media component. Prune entries after a few months. Documented in CLAUDE.md.

Also

  • src/api.js: the two metadata endpoints are fetched at most once per page load, shared by the landing cards, the dictionaries page and the panel.
  • dist/ rebuilt.

Tested

Built and run against the production API in headless Chromium: first visit (no panel, no dot, state recorded), returning visitor with 5 new dictionaries + the feature (panel opens, Esc closes it, state updated, dot gone), dictionaries page, manual reopen, light/dark, desktop/phone (bottom sheet). npm run lint adds no error (the 32 prop-types errors are pre-existing on main).

A «الجديد» button in the site header with a panel that opens by itself
when there is news the browser has not seen yet, and closes into
localStorage (nothing is sent anywhere, no account). Two kinds of news:

- dictionaries added since the last visit, detected from the ids of
  /api/v1/dicts, so a DB import announces itself. The 13 KB list is
  only fetched when number_dictionaries from /api/v1/stats moved;
- features, from the hand-written FEATURES list in src/whatsNew.js,
  meant for what a non-technical reader notices. The first entry is
  the page links to the archive.org scans, with a small CSS animation
  of a click on «ص. 412» opening the scanned page.

A first visit records the state silently: everything is new to a
first-time visitor. The button reopens the whole list at any time.

The metadata endpoints are now fetched through src/api.js, once per
page load, so the panel and the landing cards share one request.
The «منظومة حوسبة اللغة العربية» page (#82) was a big addition and
predates the panel, so returning visitors get told about it too. An
entry may now carry a `link` to a page of the site, rendered as a
small arrow link under the text. Tools.jsx fetches the counts through
api.js like the other pages, so the panel and the page share them.
@forzagreen
forzagreen merged commit f1bdc0d into main Oct 16, 2026
5 checks passed
@forzagreen
forzagreen deleted the feat/whats-new branch October 16, 2026 15:18
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.

1 participant