feat(maps): show where an Amap hit came from, and keep its id

An Amap row now carries the same source mark the TREK index, OpenStreetMap
and Google rows get, named per locale because 高德地图 is the name it goes
by where it matters. The "search is on OpenStreetMap" notices and the
key hint in the details column are gone with the keys dev had already
removed, and the client-side provider mirror with them.

amap_poi_id travels with a picked result into the form, the details
column and the shadow log, so a saved place keeps the id it was found
by. A pasted Amap link goes to the resolver like a Google one.
This commit is contained in:
Maurice
2026-09-12 13:56:48 +02:00
parent 43a6c30325
commit 84c277993c
35 changed files with 148 additions and 459 deletions
@@ -17,6 +17,7 @@ export interface PlaceFormData {
google_place_id?: string
google_ftid?: string
osm_id?: string
amap_poi_id?: string
// Hero image picked from the detail column. Optional and absent from
// DEFAULT_FORM on purpose: the mobile sheet shares this type and never sets
// it, and places.service already writes image_url through on create/update.
@@ -55,6 +56,26 @@ export function isGoogleMapsUrl(input: string): boolean {
}
}
/**
* Amap's own hosts, the same set the server resolves (amap.provider.ts). An
* exact list rather than a shape: Amap has no ccTLD family, so a pattern would
* only widen what the search box hands to the resolver.
*/
const AMAP_HOSTS = new Set(['amap.com', 'www.amap.com', 'uri.amap.com', 'wb.amap.com', 'surl.amap.com', 'gaode.com', 'www.gaode.com'])
export function isAmapUrl(input: string): boolean {
try {
return AMAP_HOSTS.has(new URL(input.trim()).hostname.toLowerCase())
} catch {
return false
}
}
/** A pasted link the server can turn into a place, from either provider. */
export function isMapUrl(input: string): boolean {
return isGoogleMapsUrl(input) || isAmapUrl(input)
}
export const DEFAULT_FORM: PlaceFormData = {
name: '',
description: '',
@@ -81,6 +102,7 @@ export const RESULT_FIELDS = [
'google_place_id',
'google_ftid',
'osm_id',
'amap_poi_id',
'website',
'phone',
] as const