Repository navigation
feat: tell returning visitors what is new (features and dictionaries) - #122
Merged
Merged
Conversation
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.
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.
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
localStoragelike the theme: nothing is sent anywhere and no account is needed.Two kinds of news:
/api/v1/dicts, so a DB import announces itself with no code change. The 13 KB list is only fetched whennumber_dictionariesfrom/api/v1/stats(already fetched by the page) has moved.FEATURESlist insrc/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 underprefers-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
FEATURESinsrc/whatsNew.js: a stableid, a date, a title and a sentence in plain Arabic, optionally aMediacomponent. 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 lintadds no error (the 32prop-typeserrors are pre-existing onmain).