diff --git a/src/utils/Message.js b/src/utils/Message.js index 67b8c087..2aa723f8 100644 --- a/src/utils/Message.js +++ b/src/utils/Message.js @@ -35,8 +35,8 @@ const Message = ({ children, loading = false, noMargin = false, type = 'default'

{loading && } - {loading && !children && Loading...} - {children} + {loading && {children || 'Loading...'}} + {!loading && children}

diff --git a/src/utils/helpers/numbers.js b/src/utils/helpers/numbers.js index 7cfe751b..b9e0757f 100644 --- a/src/utils/helpers/numbers.js +++ b/src/utils/helpers/numbers.js @@ -1,4 +1,8 @@ const TEN_ROUNDING_NUMBER = 10; const { ceil } = Math; +const formatter = new Intl.NumberFormat('en-US'); + +export const prettify = (number) => formatter.format(number); + export const roundTen = (number) => ceil(number / TEN_ROUNDING_NUMBER) * TEN_ROUNDING_NUMBER; diff --git a/src/visits/ShortUrlVisits.js b/src/visits/ShortUrlVisits.js index d18dbd66..5a5ed3ec 100644 --- a/src/visits/ShortUrlVisits.js +++ b/src/visits/ShortUrlVisits.js @@ -78,6 +78,7 @@ const ShortUrlVisits = ( render() { const { shortUrlVisits, shortUrlDetail } = this.props; const { visits, loading, loadingLarge, error } = shortUrlVisits; + const showTableControls = !loading && visits.length > 0; const renderVisitsContent = () => { if (loading) { @@ -166,7 +167,7 @@ const ShortUrlVisits = ( />
- {visits.length > 0 && ( + {showTableControls && (