Repository navigation
Optimize the site: SEO, data loading, UX, PWA, and tests - #59
Merged
Merged
Conversation
The manifest sha256 turned out to be the publisher's own change-detection key — the hash covers the items serialization only, not the served file (docs/integrations/cdn.md, JsonCdnFeaturePublisher). Verifying it against the response body fails on every fresh load and fixing it would mean re-serializing the items array byte-for-byte like kotlinx does — too fragile for a client check. A truncated upload still fails JSON.parse, and the fetch timeout covers the hang case.
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 optimization sweep over the static site — one commit per concern:
SEO
Add robots.txt, the canonical URL and the theme color— metadata routes withforce-static(required by the static export),alternates.canonical, and a light/darkthemeColorvia the Viewport export.Add the apple-touch-icon— iOS homescreen ignores SVG favicons and pinned a page screenshot instead.Add server-rendered content for search engines— the page was a bare loading placeholder in the export; now a server-rendered (visually hidden) h1 + description with the region names is the page's indexable face.app/page.tsxbecame a server component, the client shell moved tocomponents/HomeClient.tsx.Brand the 404 page in Russian with a way back— GitHub Pages serves 404.html for every unmatched URL.Data loading
Start the CDN data fetch in parallel with the map bootstrap— the fetch no longer trails the style/tile load.Time the CDN fetch out after 15 seconds— a hung CDN used to mean an eternal loading face; now it lands on the error state with a retry.Drop the client-side checksum verification— the manifest's sha256 turned out to be the publisher's own change-detection key (items-serialization hash, per the pipeline'sdocs/integrations/cdn.md), not a served-bytes checksum. Verified against the live CDN, then removed with the contract documented in the commit message.UX
Move the data status onto the map: error card and freshness pill— the status used to hide inside the closed filters panel; now an alert card with retry (errors) and a pill showing loading/freshness ("Данные от 15 ноября", stale after a week) live on the map.Remember the layer toggles across visits— localStorage, same pattern as the theme and the banner.Add a share button to the detail panel—navigator.shareon mobile, clipboard + "Скопировано" fallback on desktop; the?marker=URL was always shareable, now there's an affordance for it.Keep the map interactive on desktop while the panel is open—inertnow applies only under the 768px sheet breakpoint.Lead the store banner with the platform's store— UA sniff, both badges stay.Search objects by name and road in the filters panel— substring search over all three collections, picking a hit opens the detail and flies to the sign.Filter the map by region: markers through the tiers, lines through the sources— theregionfield finally got a UI.Show a name tooltip when hovering the overlay lines— the canvas lines get the dot-tier markers' hover affordance.PWA
Add the PWA manifest, icons and an offline service worker— manifest + 192/512 icons rendered from the logo artwork; the worker does network-first for navigations and CDN data (last snapshot survives offline), cache-first for hashed static assets. Map tiles are deliberately not cached. Production-only registration.Hygiene
Test the lib helpers with vitest— 27 tests over routing, banner TTL, layer toggles, CDN loading and search;npm testwired into CI.Fix the stale satellite mention and the maplibre version in the README.Verification
npm run lint,npx tsc --noEmit,npm test(27/27),npm run build— clean; CI covers all four.out/locally in a browser: map draws with data fetched through the parallel path; filters panel shows the search, the region select (Гродненская hides 149 of 266 markers) and the counters; the freshness pill reads "Данные от 15 ноября"; search pick opens the detail and flies to the sign; the error card was live-verified against the real checksum mismatch before the revert; 404.html renders the branded page.out/index.htmlships canonical + theme-color pair + manifest link;out/robots.txt,out/manifest.webmanifest,out/sw.js,out/apple-touch-icon.pngall present.