diff --git a/apps/web/src/pages/artist/Artist.tsx b/apps/web/src/pages/artist/Artist.tsx index d5f83d2c..f844b1bf 100644 --- a/apps/web/src/pages/artist/Artist.tsx +++ b/apps/web/src/pages/artist/Artist.tsx @@ -19,6 +19,7 @@ import Main from "../../layouts/Main"; import Albums from "./Albums"; import ArtistListeners from "./ArtistListeners"; import PopularSongs from "./PopularSongs"; +import ContentLoader from "react-content-loader"; const Group = styled.div` display: flex; @@ -134,83 +135,109 @@ const Artist = () => {
- -
- {artist?.picture && !loading && ( - - )} - {!artist?.picture && !loading && ( -
-
- -
-
- )} -
- {artist && !loading && ( -
- - {artist?.name} - -
-
- - Listeners - - - {numeral(artist?.listeners).format("0,0")} - -
-
- - Scrobbles - - + {/* Avatar circle */} + + {/* Artist name */} + + {/* Listeners label */} + + {/* Listeners count */} + + {/* Scrobbles label */} + + {/* Scrobbles count */} + + {/* View on PDSls button */} + + + )} + {!loading && ( + +
+ {artist?.picture && ( + + )} + {!artist?.picture && ( +
+
- {numeral(artist?.scrobbles).format("0,0")} - + +
- + {artist && ( +
+ + {artist?.name} + +
+
+ + Listeners + + + {numeral(artist?.listeners).format("0,0")} + +
+
+ + Scrobbles + + + {numeral(artist?.scrobbles).format("0,0")} + +
+
-
- )} -
+ )} + + )} {artist && (
@@ -226,7 +253,10 @@ const Artist = () => {
)}
- + diff --git a/apps/web/src/pages/artist/PopularSongs/PopularSongs.tsx b/apps/web/src/pages/artist/PopularSongs/PopularSongs.tsx index 5c225cc3..d61d3f4b 100644 --- a/apps/web/src/pages/artist/PopularSongs/PopularSongs.tsx +++ b/apps/web/src/pages/artist/PopularSongs/PopularSongs.tsx @@ -2,6 +2,7 @@ import styled from "@emotion/styled"; import { Link as DefaultLink } from "@tanstack/react-router"; import { TableBuilder, TableBuilderColumn } from "baseui/table-semantic"; import { HeadingSmall } from "baseui/typography"; +import ContentLoader from "react-content-loader"; const Link = styled(DefaultLink)` color: inherit; @@ -36,121 +37,190 @@ interface PopularSongsProps { albumUri?: string; artistUri?: string; }[]; + isLoading: boolean; } function PopularSongs(props: PopularSongsProps) { return ( <> - - Popular Songs - - ({ - id: x.id, - title: x.title, - artist: x.artist, - albumArtist: x.albumArtist, - albumArt: x.albumArt, - uri: x.uri, - scrobbles: x.scrobbles, - albumUri: x.albumUri, - artistUri: x.artistUri, - index, - }))} - emptyMessage="You haven't listened to any music yet." - divider="clean" - overrides={{ - TableHeadRow: { - style: { - display: "none", - }, - }, - TableBodyCell: { - style: { - verticalAlign: "center", - }, - }, - TableBodyRow: { - style: { - backgroundColor: "var(--color-background)", - ":hover": { - backgroundColor: "var(--color-menu-hover)", + {props.isLoading && ( + <> + + Popular Songs + +
+ + {/* Row 1 */} + + + + + + + {/* Row 2 */} + + + + + + + {/* Row 3 */} + + + + + + + {/* Row 4 */} + + + + + + + {/* Row 5 */} + + + + + + + {/* Row 6 */} + + + + + + +
+ + )} + {!props.isLoading && ( + <> + + Popular Songs + + ({ + id: x.id, + title: x.title, + artist: x.artist, + albumArtist: x.albumArtist, + albumArt: x.albumArt, + uri: x.uri, + scrobbles: x.scrobbles, + albumUri: x.albumUri, + artistUri: x.artistUri, + index, + }))} + emptyMessage="You haven't listened to any music yet." + divider="clean" + overrides={{ + TableHeadRow: { + style: { + display: "none", + }, }, - }, - }, - Table: { - style: { - backgroundColor: "var(--color-background)", - }, - }, - }} - > - - {(row: Row) => ( -
-
-
- {row.index + 1} -
-
- {row.albumUri && ( - - {!!row.albumArt && ( - {row.title} - )} - {!row.albumArt && ( -
- )} - - )} - {!row.albumUri && ( -
- {!!row.albumArt && ( - {row.title} + TableBodyCell: { + style: { + verticalAlign: "center", + }, + }, + TableBodyRow: { + style: { + backgroundColor: "var(--color-background)", + ":hover": { + backgroundColor: "var(--color-menu-hover)", + }, + }, + }, + Table: { + style: { + backgroundColor: "var(--color-background)", + }, + }, + }} + > + + {(row: Row) => ( +
+
+
+ {row.index + 1} +
+
+ {row.albumUri && ( + + {!!row.albumArt && ( + {row.title} + )} + {!row.albumArt && ( +
+ )} + )} - {!row.albumArt && ( -
+ {!row.albumUri && ( +
+ {!!row.albumArt && ( + {row.title} + )} + {!row.albumArt && ( +
+ )} +
)} +
+ + {row.title} + + {row.artistUri && ( + + {row.albumArtist} + + )} + {!row.artistUri && ( +
+ {row.albumArtist} +
+ )} +
)} -
- - {row.title} - - {row.artistUri && ( - - {row.albumArtist} - - )} - {!row.artistUri && ( -
- {row.albumArtist} -
- )} -
-
- )} - - - {(row: Row) =>
{row.scrobbles}
} -
- + + + {(row: Row) =>
{row.scrobbles}
} +
+ + + )} ); }