Skip to content

feat(frontend): add the map picker - #117

Merged
gac0812 merged 2 commits into
1024XEngineer:MVPfrom
gac0812:feat/frontend-map-picker
Aug 1, 2026
Merged

feat(frontend): add the map picker#117
gac0812 merged 2 commits into
1024XEngineer:MVPfrom
gac0812:feat/frontend-map-picker

Conversation

@gac0812

@gac0812 gac0812 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add the Baidu Map picker for web and native (MapPicker.*, overlay, services)
  • include the WebView document bridge used by the native map build
  • land ahead of the create-sheet and today flows that select a location

Validation

  • npm ci
  • npm run check
  • npx expo export --platform android --output-dir dist

Fourth of eight. Location picking is self-contained enough to read on its
own: a Baidu Maps integration with two implementations behind one shared
types/services/styles trio. The web build loads the JS SDK directly; the
native build drives the same SDK inside a WebView and talks to it over a
message bridge.

MapPicker.tsx is a single-line re-export of the web build. It resolves on
neither platform, since Metro takes .native.tsx on device and .web.tsx on
web, so its only real effect is to point tsc at the web implementation and
leave the native one unchecked. Recorded as-is; the refactor fixes it.

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

Found three concrete issues in the new map-picker implementation; details are attached inline.

Verification

  • npm run check passes (ESLint, Prettier, TypeScript).

};
const initialJson = JSON.stringify(initialLocation);
const centerJson = JSON.stringify(center);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P1] Escape values before embedding them into the HTML script. initialLocation can contain a user-controlled address, and JSON.stringify() does not neutralize </script>. An address such as </script><script>...</script> therefore breaks out of this script block and executes inside the WebView (and can forge bridge messages). Serialize for an HTML-script context, e.g. replace < with \u003c (and handle the other script-sensitive characters) before interpolation.

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.

Fixed in f97a12c. Initial location and map center values now use HTML-safe inline-script serialization for <, >, &, U+2028, and U+2029. npm run check passes.

@@ -0,0 +1 @@
export { MapPicker } from './MapPicker.web';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P1] Wire the picker into an existing screen or navigation flow. Nothing outside these newly added files imports MapPicker; App.tsx still renders only HomeScreen, so this PR has no user-reachable map-picker UI on either web or native.

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.

Fixed in f97a12c. HomeScreen now exposes a real map-picker entry, preserves the selected location, and lets the user reopen and edit it. npm run check passes.

@@ -0,0 +1,26 @@
import type { MapLocation } from './MapPicker.types';

export const BAIDU_MAP_AK = process.env.EXPO_PUBLIC_BAIDU_MAP_AK?.trim() ?? '';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P2] Document the required public map key. The component now depends on EXPO_PUBLIC_BAIDU_MAP_AK, but frontend/.env.example contains only the API URL. A fresh setup therefore always reaches the missing-key error with no documented configuration path; add the variable and any required Baidu JSAPI/referrer setup instructions.

@gac0812
gac0812 merged commit fba55f7 into 1024XEngineer:MVP Aug 1, 2026
1 check passed
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