Skip to content

Commit f8e1383

Browse files
committed
feat(examples-chat): dark map via colorScheme, drop cloud-style dependency
The map's dark theme was a cloud-based map style bound to a specific GCP Map ID — brittle (lives in the Console, tied to one project/billing acct, invisible to git). Replace it with an in-code colorScheme: DARK on the vector map, which keeps AdvancedMarkers, works with any mapId (incl. the DEMO_MAP_ID fallback), and is version-controlled + project-independent. Kept as a plain string so the field carries no runtime google.maps reference (map-canvas builds under jsdom in the shell specs).
1 parent 3fb99b4 commit f8e1383

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

examples/chat/angular/src/app/map-canvas.component.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,24 @@ export class MapCanvasComponent {
8686
private readonly destroyRef = inject(DestroyRef);
8787
protected readonly center = signal<google.maps.LatLngLiteral>(PARIS_CENTER);
8888
protected readonly zoom = signal<number>(12);
89-
// A mapId is REQUIRED for advanced markers; a mapId map ignores inline JSON
90-
// `styles`, so the dark theme is a cloud-based map style tied to this id.
91-
// DEMO_MAP_ID lets a fresh clone run (light map) with no Console setup.
89+
// A mapId is REQUIRED for advanced markers. The dark theme is applied IN CODE
90+
// via `colorScheme: DARK` below — NOT a cloud-based map style — so there is no
91+
// Google Cloud Console style setup to maintain and ANY mapId works.
92+
// DEMO_MAP_ID lets a fresh clone run with no Console setup at all.
9293
protected readonly mapId = environment.googleMapsMapId || 'DEMO_MAP_ID';
93-
protected readonly mapOptions: google.maps.MapOptions = {
94+
protected readonly mapOptions = {
9495
mapId: this.mapId,
96+
// Dark map in code — no cloud-style dependency. 'DARK' is the runtime value
97+
// of the google.maps.ColorScheme enum; kept as a plain string so this field
98+
// initializer holds no runtime `google.maps` reference (map-canvas builds
99+
// under jsdom in the shell specs, before the Maps API loads). The whole
100+
// literal is cast so it typechecks regardless of the installed
101+
// @types/google.maps version; the live Maps JS from Google's CDN honors it.
102+
colorScheme: 'DARK',
95103
disableDefaultUI: true,
96104
zoomControl: true,
97105
clickableIcons: false,
98-
};
106+
} as google.maps.MapOptions;
99107
// AdvancedMarkerElement is NOT clickable by default (unlike the legacy
100108
// Marker) — without gmpClickable it never fires click/gmp-click, so the
101109
// wrapper's (mapClick) output stays silent and the info window can't open.

0 commit comments

Comments
 (0)