Skip to content

Standardise city hubs: reflect real communities + stories data - #14

Merged
Ashwask merged 1 commit into
mainfrom
standardise-city-hubs
Jul 31, 2026
Merged

Standardise city hubs: reflect real communities + stories data#14
Ashwask merged 1 commit into
mainfrom
standardise-city-hubs

Conversation

@Ashwask

@Ashwask Ashwask commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Problem

City hub quick-stats and the "Community Stories" card were hardcoded on the 12 "coming soon" cities. Chennai showed 0 Communities and a Coming Soon stories card despite a live Chennai story; Pune showed 0 while 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 by city.toLowerCase()). On every city hub it:

  • 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 ≥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 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 state uniformly (and correctly reverts if a story is removed).

Deliberately unchanged

  • Climate Sectors and Wards Tracked — they count built infrastructure, not DB content, so they stay as-is (Chennai Climate = 0).
  • Communities feature card stays Coming Soon — only the stat number goes live (there's no per-city communities directory page to link to yet).
  • Bengaluru hub left as-is (already richer/dynamic).
  • No new i18n keys (reuses cityHub.features.stories.*, cityHub.features.map.statusLive).

Verification (headless Chrome vs live Supabase)

  • Chennai: Communities 0 (real) · Community Stories Live + Read Stories link → /cities/chennai/stories/.
  • Pune: Communities 1 (was a hardcoded 0 hiding a real community) · Community Stories Coming Soon (no stories).
  • No console errors; script guards every lookup and is wrapped in try/catch.
  • No visual-regression specs cover city hub pages, so no baselines change.

Note: the only expected red check is the pre-existing communities-search flake, fixed separately in #13.

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
notf Ready Ready Preview Jul 31, 2026 10:41am

@Ashwask
Ashwask merged commit 53fe5a4 into main Jul 31, 2026
2 of 3 checks passed
@Ashwask
Ashwask deleted the standardise-city-hubs branch July 31, 2026 10:44
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.

2 participants