Skip to content

feat(home): AppHome landing page with Google Maps region selector - #16

Merged
mosoriob merged 4 commits into
developfrom
feat/home
Jun 6, 2026
Merged

mosoriob merged 4 commits into
developfrom
feat/home

Conversation

@mosoriob

@mosoriob mosoriob commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Summary

1:1 port of AppHome landing page from LitElement to React.

Deliverables

  • AppHome page with Google Map integration
  • Region selector functionality (select region on map → navigate)
  • User greeting/status display
  • Matching existing UI layout with Tailwind/shadcn

Closes kanban card t_abfce889.

@vercel

vercel Bot commented Jun 6, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
monorepo Ready Ready Preview, Comment Jun 6, 2026 1:34pm
monorepo-flal Ready Ready Preview, Comment Jun 6, 2026 1:34pm

@mosoriob mosoriob left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review - PR #16: AppHome landing page with Google Maps region selector

Checklist

  • TypeScript strict -- no untyped any (typed casts used appropriately)
  • No hardcoded secrets or API keys
  • No debug statements (console.log, debugger)
  • No AI/authorship indicators in code or commits
  • Apollo query follows established patterns (gql tag, typed generic)
  • Runtime config follows the window.__MINT_CONFIG__ ?? import.meta.env.VITE_* pattern
  • @types/google.maps present as transitive dep -- TypeScript compilation works
  • Tests cover: welcome message, loading state, signed-in username, unauthenticated, empty regions, welcome fallback
  • Route registration not changed (existing /regions/:id path is used correctly)
  • CSS layout classes undefined (see Warning 1 below)
  • Map container height (see Warning 1 below)
  • GeoJSON accumulation on reload (see Warning 2 below)

Warnings (should fix before merge)

1. Undefined CSS layout classes -- layout will be unstyled

AppHome.tsx uses several class names that are not defined in globals.css or Tailwind config:

  • content-page, main-content, middle2main, gray-section, concept-grid, concept-card

These appear to be legacy class names from the old LitElement app. Since they are not in globals.css and not Tailwind utility classes, they compile away silently -- no error, but no styling either. The two-column layout (concept-grid), the full-bleed grey section (gray-section), and the map container width (middle2main) will all be unstyled.

Fix option A: define these as @layer components rules in globals.css.
Fix option B: replace with Tailwind utility classes directly (e.g. concept-grid is already duplicated inline as grid gap-6 md:grid-cols-[1fr_420px] -- just remove the custom class).

Note: mapContainerClassName="middle2main" on <GoogleMap> is particularly risky -- if the class sets no height, the map renders at 0px despite the outer style={{ height: 500 }} wrapper. Fix: set mapContainerStyle={{ width: '100%', height: '100%' }} so the Google Maps DOM element fills the parent div.

2. GeoJSON layers accumulate on re-render without clearing

In onLoad, map.data.addGeoJson() is called for each region. If regions or onRegionClick changes (e.g. Apollo re-fetches), onLoad re-fires and all features get added a second time. Clicking a region would then trigger onRegionClick multiple times.

The eslint-disable on the dep array is acceptable since onLoad only fires once per GoogleMap mount -- but if the parent unmounts/remounts the map (e.g. mapReady flipping false then true), features double up.

Fix: add map.data.forEach(f => map.data.remove(f)) at the top of onLoad before adding features, OR ensure <RegionMap> is mounted only once (use display: none / visibility: hidden instead of conditional rendering so the map instance is preserved).


Suggestions (non-blocking)

  • Missing error state -- useQuery returns { data, loading, error } but error is ignored. If Hasura is unreachable the user sees a spinner forever. A brief "Could not load regions" message using error would improve robustness.

  • Inline magic numbers -- { lat: 0, lng: 20 } and zoom: 3 hardcoded in JSX. Consider named constants or a window.__MINT_CONFIG__ key if the default viewport will vary by deployment.


Looks Good

  • Clean separation between RegionMap (Google Maps rendering) and AppHome (data-fetching, navigation).
  • window.__MINT_CONFIG__ runtime override pattern applied consistently, matching existing convention.
  • vite-env.d.ts extended correctly with optional GOOGLE_MAPS_KEY and WELCOME_MESSAGE keys.
  • GraphQL query is well-scoped: top-level regions only (parent_region_id: { _is_null: true }), minimal fields.
  • Tests are meaningful and cover the key branches.
  • No dependency on the legacy LitElement stack.
  • Commit message is clean.

Verdict: Changes Requested -- the two warnings (undefined CSS layout classes breaking the page layout, and GeoJSON accumulation risk) need to be addressed before merge.

Port app-home.ts (265 LOC) from LitElement to React.

- AppHome page with full DYNAMO description text and Getting Started card
- Google Maps integration via @react-google-maps/api
- Region selector: loads top-level regions from Hasura, renders GeoJSON
  polygons on the map, highlights on hover/click, navigates to region page
- User greeting shows authenticated username via useAuth
- Welcome message and Maps API key from window.__MINT_CONFIG__ / VITE_ env
- Map styles ported from legacy map-style.ts (terrain, desaturated)
- LIST_TOP_REGIONS Apollo query with geometry support
- 9 unit tests covering rendering, auth state, empty state, loading state
@mosoriob
mosoriob merged commit a284f53 into develop Jun 6, 2026
2 checks passed

This branch was successfully deployed

3 active (2 outdated) deployments
Preview — 9f327a06 Deployed Jun 6, 2026 by vercel[bot]
Preview – monorepo — 4b364194 Deployed Jun 6, 2026 by vercel[bot]
Preview – monorepo-flal — 4b364194 Deployed Jun 6, 2026 by vercel[bot]
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.

1 participant