Skip to content

Add google maps and street view preview during submission review - #46

Open
tayloraj10 wants to merge 7 commits into
mainfrom
google-maps-preview
Open

tayloraj10 wants to merge 7 commits into
mainfrom
google-maps-preview

Conversation

@tayloraj10

@tayloraj10 tayloraj10 commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Add map + Street View preview to review detail, fix dev server EMFILE crash

Problem

Reviewers approving/rejecting resource edits had no way to visually confirm a submission's location without leaving the dashboard. Separately, pnpm run dev was crashing on Windows with EMFILE: too many open files — several files imported icons via the @mui/icons-material barrel export, forcing Vite to resolve/watch the entire package (thousands of files) instead of just the icons in use.

Solution

  • Added ResourceLocationPanel and ResourceStreetView components, rendering a Google Map (with a pin at the proposed lat/lng) and a Street View panel side-by-side on the /reviews/:id detail page, so reviewers can visually confirm a location before approving.
  • Street View resolves a more precise position via the resource's Google Place ID (gpId) when available, falling back to the stored lat/lng.
  • Added VITE_GOOGLE_MAPS_API_KEY (client-exposed, reused from the phlask-map repo, HTTP-referrer restricted in GCP Console) to .example.env and wired it into the Amplify build (amplify.yml).
  • Gracefully degrades to an info alert if no API key is configured, and returns null if the resource has no valid coordinates.
  • Fixed the EMFILE dev-server crash by switching from @mui/icons-material barrel imports to per-icon imports (e.g. import ArrowBack from "@mui/icons-material/ArrowBack") across ThemeToggle.tsx, _layout.tsx, dashboard.tsx, reviews/detail.tsx, login.tsx, reset-password.tsx, and chipColors.tsx.
  • Ran biome check --write to normalize CRLF line endings on the two new components to match repo formatting.

Reference

Closes #36

Screenshots

Screenshot 2026-08-18 200442

Checklist

  • Changes have been tested locally
  • Changes have been self-reviewed

Convert the "Save changes" button on the review detail page from a
bare onClick handler to a <fetcher.Form onSubmit>, matching the
approve/reject actions that already use <Form>. The payload is a
nested object rather than flat fields, so it's still sent as JSON via
fetcher.submit, but routing it through a real form gives us proper
submit semantics (Enter-to-submit, pending state, progressive
enhancement) instead of a plain button click.

Also swap the deprecated FormEvent type for SubmitEvent, and convert
logout to a POST action (was a GET loader) triggered via a <Form> in
the sidebar, since a GET route shouldn't perform a mutation like
signing out.
- Introduced new API methods for fetching edit counts and change logs, enhancing the resource edit management capabilities.
- Updated the dashboard to utilize these new methods, allowing for a comprehensive view of pending edits and historical changes.
- Modified the reviews detail page to display the change log for individual resources, improving audit trail visibility.
- Enhanced the reviews index page to show pending edit counts for resources, aiding in resource management and review prioritization.
- Introduced separate types for edit and new row data, improving type safety and clarity.
- Updated table columns to include a submitted date for both edits and new resources, enhancing the review process.
- Refactored the ReviewQueueTable component to handle sorting and rendering more efficiently.
- Improved the overall layout by incorporating a Stack component for better spacing and organization.
- Introduced ResourceLocationPanel and ResourceStreetView components to render a map and street view for resource locations on the review detail page.
- Updated .env configuration to include VITE_GOOGLE_MAPS_API_KEY for client-side access.
- Added dependencies for Google Maps API and types in package.json.
- Enhanced the build process to include the new environment variable.
- Updated the reviews detail page to incorporate the new components, improving the user experience for reviewers.
- Updated imports for MUI icons in ThemeToggle, authenticated layout, dashboard, reviews detail, login, reset-password, and chipColors files to use default imports instead of named imports, enhancing code readability and consistency.
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.

Map and Street View on Approval Page

1 participant