Ensured maps modal btn is not rendered when the number of located cities is 0

This commit is contained in:
Alejandro Celaya 2019-03-05 14:09:08 +01:00
parent 701c143149
commit 87a4598391

View file

@ -76,6 +76,7 @@ const ShortUrlVisits = ({ processStatsFromVisits }) => class ShortUrlVisits exte
const { os, browsers, referrers, countries, cities, citiesForMap } = processStatsFromVisits( const { os, browsers, referrers, countries, cities, citiesForMap } = processStatsFromVisits(
{ id: this.memoizationId, visits } { id: this.memoizationId, visits }
); );
const mapLocations = values(citiesForMap);
return ( return (
<div className="row"> <div className="row">
@ -109,14 +110,9 @@ const ShortUrlVisits = ({ processStatsFromVisits }) => class ShortUrlVisits exte
<SortableBarGraph <SortableBarGraph
stats={cities} stats={cities}
title="Cities" title="Cities"
extraHeaderContent={[ extraHeaderContent={
() => ( [ () => mapLocations.length > 0 && <OpenMapModalBtn modalTitle="Cities" locations={mapLocations} /> ]
<OpenMapModalBtn }
modalTitle="Cities"
locations={values(citiesForMap)}
/>
),
]}
sortingItems={{ sortingItems={{
name: 'City name', name: 'City name',
amount: 'Visits amount', amount: 'Visits amount',