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