Skip to content

Commit

Permalink
fix: Hide Listen Count and Playlist Count if the value is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
anshg1214 committed Sep 16, 2024
1 parent 5f6962c commit ef311fc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion frontend/css/donors-page.less
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
margin-bottom: 0;
}

.donation-amount {
.donation-user {
font-weight: 600;
font-size: 1.75rem;
margin-bottom: 0.5rem;
Expand Down
23 changes: 10 additions & 13 deletions frontend/js/src/donors/Donors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import Loader from "../components/Loader";
type DonorLoaderData = {
data: {
id: number;
name: string;
donated_at: string;
donation: number;
currency: "usd" | "eur";
Expand Down Expand Up @@ -93,20 +92,18 @@ function Donors() {
{donors?.map((donor) => (
<div key={donor.id} className="donor-card">
<div className="donor-info">
<p className="donation-amount">
{donor.musicbrainz_id}{" "}
{donor.musicbrainz_id ? (
<>
&#040;
<p className="donation-user">
{donor.musicbrainz_id &&
(donor.is_listenbrainz_user ? (
<Link
to={`/user/${donor.musicbrainz_id}`}
className="donor-name"
>
{donor.musicbrainz_id}
</Link>
&#041;
</>
) : null}
) : (
<span>{donor.musicbrainz_id}</span>
))}
</p>
<p className="donation-date">
<FontAwesomeIcon icon={faCalendar} />
Expand All @@ -123,24 +120,24 @@ function Donors() {
</p>
{donor.musicbrainz_id && donor.is_listenbrainz_user ? (
<div className="recent-listens">
{donor.listenCount && (
{donor.listenCount ? (
<Link
className="listen-item"
to={`/user/${donor.musicbrainz_id}/stats/?range=all_time`}
>
<FontAwesomeIcon icon={faMusic} />
{formatListenCount(donor.listenCount)} Listens
</Link>
)}
{donor.playlistCount && (
) : null}
{donor.playlistCount ? (
<Link
className="listen-item"
to={`/user/${donor.musicbrainz_id}/playlists/`}
>
<FontAwesomeIcon icon={faListAlt} />
{formatListenCount(donor.playlistCount)} Playlists
</Link>
)}
) : null}
</div>
) : null}
</div>
Expand Down

0 comments on commit ef311fc

Please sign in to comment.