Skip to content

Commit c2e79dc

Browse files
committed
Homepage: Do not show stats if count=0
1 parent e99268f commit c2e79dc

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

frontend/js/src/home/Homepage.tsx

+15-11
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { Integrations } from "@sentry/tracing";
2525
import { ToastContainer } from "react-toastify";
2626
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
2727
import { faSortDown, faSortUp } from "@fortawesome/free-solid-svg-icons";
28-
import { throttle } from "lodash";
28+
import { isNumber, throttle } from "lodash";
2929
import { getPageProps } from "../utils/utils";
3030
import ErrorBoundary from "../utils/ErrorBoundary";
3131
import GlobalAppContext from "../utils/GlobalAppContext";
@@ -117,10 +117,12 @@ function HomePage({ listenCount, artistCount }: HomePageProps) {
117117
/>
118118
<div className="homepage-upper-grey-box" />
119119

120-
<h1 className="listen-container">
121-
<NumberCounter count={listenCount} />
122-
global listens.
123-
</h1>
120+
{isNumber(listenCount) && listenCount > 0 && (
121+
<h1 className="listen-container">
122+
<NumberCounter count={listenCount} />
123+
global listens.
124+
</h1>
125+
)}
124126
<div className="homepage-info">
125127
<h1>
126128
Listen together
@@ -202,12 +204,14 @@ function HomePage({ listenCount, artistCount }: HomePageProps) {
202204
/>
203205
<div className="homepage-lower-grey-box" />
204206

205-
<h1 className="listen-container">
206-
Dig deeper with
207-
<div id="artist-count-container">
208-
<NumberCounter count={artistCount} /> artists.
209-
</div>
210-
</h1>
207+
{isNumber(artistCount) && artistCount > 0 && (
208+
<h1 className="listen-container">
209+
Dig deeper with
210+
<div id="artist-count-container">
211+
<NumberCounter count={artistCount} /> artists.
212+
</div>
213+
</h1>
214+
)}
211215
<div className="homepage-info">
212216
<h1>
213217
Connect your music

0 commit comments

Comments
 (0)