Standardise city hubs: reflect real communities + stories data - #14
Merged
Conversation
City hub quick-stats and the Community Stories card were hardcoded on the 12 "coming soon" cities — e.g. Chennai showed "0 Communities" and a Coming Soon stories card despite a live Chennai story, and Pune showed "0" while it actually has 1 community. Only the Bengaluru hub was data-driven. Add a shared /assets/js/pages/city-hub.js (mirrors Bengaluru's inline pattern: load all, filter by city.toLowerCase()) that, on every city hub: - sets the Communities stat to the real per-city DB count, and - flips the Community Stories card to Live (linking to the city's /stories/ page) when the city has at least one story, else leaves it Coming Soon. Wire it into the 12 coming-soon hubs by adding data-stat="communities" to the Communities stat tile, data-feature="stories" to the stories card, and the script tag after data-loader.js. Chennai's stories card (made statically Live in the previous PR) is reverted to the shared Coming Soon default so all hubs are identical and the script drives the state uniformly. Climate Sectors and Wards Tracked are unchanged (they count built infrastructure, not DB content). No new i18n keys; reuses existing cityHub.features.stories.* and cityHub.features.map.statusLive. Bengaluru left as-is. Verified in headless Chrome: Chennai -> 0 communities + Live stories card; Pune -> 1 community + Coming Soon. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Problem
City hub quick-stats and the "Community Stories" card were hardcoded on the 12 "coming soon" cities. Chennai showed
0 Communitiesand aComing Soonstories card despite a live Chennai story; Pune showed0while it actually has 1 community. Only the Bengaluru hub was data-driven.Follows up on the earlier Chennai stories PR — the user asked to standardise this across all cities the way Bengaluru does it.
Approach
New shared
/assets/js/pages/city-hub.js(mirrors Bengaluru's inline pattern: load all, filter bycity.toLowerCase()). On every city hub it:/stories/page) when the city has ≥1 story, otherwise leaves it Coming Soon.Wired into the 12 coming-soon hubs via three small hooks each:
data-stat="communities"on the Communities tile,data-feature="stories"on the stories card, and the script tag afterdata-loader.js. Chennai's stories card (made statically Live in the previous PR) is reverted to the shared Coming-Soon default so all hubs are identical and the script drives state uniformly (and correctly reverts if a story is removed).Deliberately unchanged
cityHub.features.stories.*,cityHub.features.map.statusLive).Verification (headless Chrome vs live Supabase)
0(real) · Community Stories Live + Read Stories link →/cities/chennai/stories/.1(was a hardcoded0hiding a real community) · Community Stories Coming Soon (no stories).Note: the only expected red check is the pre-existing communities-search flake, fixed separately in #13.
🤖 Generated with Claude Code