Add all public info to merchant map pin popup

This commit is contained in:
Letícia Camara 2018-10-18 17:29:27 -03:00
parent 4283544cb2
commit be8e330d4c
2 changed files with 15 additions and 3 deletions

View file

@ -184,12 +184,16 @@ class AmbassadorsPage extends Component {
}); });
const markers = result.data.map(merchant => { const markers = result.data.map(merchant => {
const infoDescription = <div>
<div><b>Address</b>: {merchant.address}</div>
{(merchant.phone) && (<div><b>Phone</b>: {merchant.phone}</div>)}
</div>;
const marker = { const marker = {
lat: merchant.lat, lat: merchant.lat,
lng: merchant.lon, lng: merchant.lon,
withInfo: true, withInfo: true,
infoTitle: merchant.name, infoTitle: merchant.name,
infoDescription: `${merchant.address}, ${merchant.city} - ${merchant.country}`, infoDescription: infoDescription,
}; };
return marker; return marker;
}); });

View file

@ -182,6 +182,10 @@ class MerchantsPage extends Component {
}); });
result.data.map(merchant => { result.data.map(merchant => {
const infoDescription = <div>
<div><b>Address</b>: {merchant.address}</div>
{(merchant.phone) && (<div><b>Phone</b>: {merchant.phone}</div>)}
</div>;
merchant.map = <Button merchant.map = <Button
className="App-button" className="App-button"
variant="contained" variant="contained"
@ -191,7 +195,7 @@ class MerchantsPage extends Component {
}} }}
onClick={() => this.openMaps( onClick={() => this.openMaps(
merchant.name, merchant.name,
`${merchant.address}, ${merchant.city} - ${merchant.country}`, infoDescription,
merchant.lat, merchant.lat,
merchant.lon merchant.lon
)} )}
@ -238,12 +242,16 @@ class MerchantsPage extends Component {
const { ambassadorsMarkers, merchantsSearch } = this.state; const { ambassadorsMarkers, merchantsSearch } = this.state;
const merchantMarkers = merchantsSearch.map(merchant => { const merchantMarkers = merchantsSearch.map(merchant => {
const infoDescription = <div>
<div><b>Address</b>: {merchant.address}</div>
{(merchant.phone) && (<div><b>Phone</b>: {merchant.phone}</div>)}
</div>;
const marker = { const marker = {
lat: merchant.lat, lat: merchant.lat,
lng: merchant.lon, lng: merchant.lon,
withInfo: true, withInfo: true,
infoTitle: merchant.name, infoTitle: merchant.name,
infoDescription: `${merchant.address}, ${merchant.city} - ${merchant.country}`, infoDescription: infoDescription,
}; };
return marker; return marker;
}); });