Repository navigation
feat(website): tell returning visitors what is new (features and dictionaries) - #66
Merged
Merged
Conversation
A «الجديد» button in the 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). Two kinds of news: - dictionaries added since the last visit, detected from the dictionary ids built into every page (getDictionaryIndex(), one cheap query per build), so a new dictionary announces itself on the next deploy; - features, from the hand-written FEATURES list in src/lib/whatsNew.ts, 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 the page number 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. Same mechanism as the one added to wikitermbase, with its own list.
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.Two kinds of news:
getDictionaryIndex()indb.ts, one cheap query cached per build, ~1 KB per page), so a new dictionary announces itself on the next deploy with no code change.FEATURESlist inwebsite/src/lib/whatsNew.ts, meant for what a non-technical reader notices (never dependency / build changes). The first entry is the page links to the archive.org scans (feat: link page numbers to the paper dictionaries' scans on archive.org #65), with a small CSS animation of a pointer clicking the page number in the term table and the scanned page opening underneath. No video asset: it follows the theme, 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.
Same mechanism as forzagreen/wikitermbase#122, with this site's own list and wording (قاموس, not معجم).
How to add a feature later
Append an entry to
FEATURESinwebsite/src/lib/whatsNew.ts: a stableid, a date, a title and a sentence in plain Arabic, optionallymedia. Prune entries after a few months. Documented in CLAUDE.md.Tested
npm run build(700 pages, 1 m 17 s, same as before) and headless Chromium againstastro preview: first visit (no panel, state recorded), returning visitor with 5 new dictionaries + the feature (panel opens, Esc closes it, state updated, dot gone), a dictionary page in dark mode, manual reopen, desktop/phone (bottom sheet). Unrelated and pre-existing: the home page overflows horizontally on a 390 px phone because of the dictionary table.