Skip to content

Commit b9760e9

Browse files
authored
docs: make sure to run ui-kit example in alpha version (#766)
1 parent 1008a39 commit b9760e9

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

examples/places-ui-kit/src/app.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ const MAP_CONFIG = {
3535
};
3636

3737
const App = () => {
38+
const nonAlphaVersionLoaded = Boolean(
39+
globalThis &&
40+
globalThis.google?.maps?.version &&
41+
!globalThis.google?.maps?.version.endsWith('-alpha')
42+
);
43+
44+
if (nonAlphaVersionLoaded) {
45+
location.reload();
46+
return;
47+
}
48+
3849
const [places, setPlaces] = useState<google.maps.places.Place[]>([]);
3950
const [selectedPlaceId, setSelectedPlaceId] = useState<string | null>(null);
4051
const [locationId, setLocationId] = useState<string | null>(null);
@@ -61,7 +72,7 @@ const App = () => {
6172
<APIProvider apiKey={API_KEY} version="alpha">
6273
<div className="places-ui-kit">
6374
<div className="place-list-wrapper">
64-
{/*
75+
{/*
6576
PlaceListWebComponent displays a list of places based on:
6677
- The selected place type (restaurant, cafe, etc.)
6778
- The current map location and bounds
@@ -75,15 +86,15 @@ const App = () => {
7586
</div>
7687

7788
<div className="map-container">
78-
{/*
89+
{/*
7990
The Map component renders the Google Map
8091
Clicking on the map background will deselect any selected place
8192
*/}
8293
<Map {...MAP_CONFIG} onClick={() => setSelectedPlaceId(null)}>
8394
{placeMarkers}
8495
</Map>
8596

86-
{/*
97+
{/*
8798
SearchBar allows users to:
8899
- Select the type of place they want to find
89100
- Search for a specific location to center the map on
@@ -94,7 +105,7 @@ const App = () => {
94105
setLocationId={setLocationId}
95106
/>
96107

97-
{/*
108+
{/*
98109
ControlPanel provides UI controls for adjusting the size of place details
99110
displayed in the InfoWindow
100111
*/}

0 commit comments

Comments
 (0)