diff --git a/src/client/components/player/Player.tsx b/src/client/components/player/Player.tsx index 61081eb9..4c4f223d 100644 --- a/src/client/components/player/Player.tsx +++ b/src/client/components/player/Player.tsx @@ -69,7 +69,6 @@ const Player = (props: PlayerProps) => { }, [viewMode, setViewMode]); return ( -
-
); } diff --git a/src/client/components/skeleton/SkeletonTitle.tsx b/src/client/components/skeleton/SkeletonTitle.tsx index 797d255a..1344013f 100644 --- a/src/client/components/skeleton/SkeletonTitle.tsx +++ b/src/client/components/skeleton/SkeletonTitle.tsx @@ -1,8 +1,12 @@ import React from 'react'; - -const SkeletonTitle = () => { +export interface SkeletonTitleProps { + show?: boolean +} +const SkeletonTitle = (props?: SkeletonTitleProps) => { + const {show = true} = props; + const cn = `max-w-sm animate-pulse${show ? '' : ' hidden'}`; return ( -
+
); diff --git a/src/client/components/statusCard/ClientStatusCard.tsx b/src/client/components/statusCard/ClientStatusCard.tsx index f9815f61..d7c4f920 100644 --- a/src/client/components/statusCard/ClientStatusCard.tsx +++ b/src/client/components/statusCard/ClientStatusCard.tsx @@ -14,8 +14,14 @@ const ClientStatusCard = (props: ClientStatusCardData) => { const { loading = false, data, + data: { + name, + type, + display, + status + } = {} } = props; - let header: string | undefined = undefined; + let header: string | undefined = display; let body = ; if(data !== undefined) { const { @@ -23,17 +29,17 @@ const ClientStatusCard = (props: ClientStatusCardData) => { name, type } = data; - header = `(Client) ${data.display} - ${data.name}` + if(type === 'lastfm' || type === 'listenbrainz') + header = `${display} (Client)`; // TODO links body = ( -
Status: {data.status}
Tracks Scrobbled (since app started): {data.tracksDiscovered}
{hasAuth ? (Re)authenticate or initialize : null}
); } return ( - + {body} ); diff --git a/src/client/components/statusCard/SourceStatusCard.tsx b/src/client/components/statusCard/SourceStatusCard.tsx index 844d765c..ea0b9596 100644 --- a/src/client/components/statusCard/SourceStatusCard.tsx +++ b/src/client/components/statusCard/SourceStatusCard.tsx @@ -6,6 +6,7 @@ import {sourceAdapter} from "../../status/ducks"; import {RootState} from "../../store"; import {connect, ConnectedProps} from "react-redux"; import Player from "../player/Player"; +import './statusCard.scss'; export interface SourceStatusCardData extends StatusCardSkeletonData, PropsFromRedux { loading?: boolean @@ -14,9 +15,14 @@ export interface SourceStatusCardData extends StatusCardSkeletonData, PropsFromR const SourceStatusCard = (props: SourceStatusCardData) => { const { loading = false, - data + data, + data: { + display, + name, + status, + } = {} } = props; - let header: string | undefined = undefined; + let header: string | undefined = display; let body = ; const poll = useCallback(async () => { const params = new URLSearchParams({type: data.type, name: data.name}); @@ -26,7 +32,6 @@ const SourceStatusCard = (props: SourceStatusCardData) => { },[data]); if(data !== undefined) { - const className = data.type !== 'spotify' ? 'md:pt-6' : ''; const { display, name, @@ -39,14 +44,15 @@ const SourceStatusCard = (props: SourceStatusCardData) => { type, players = {} } = data; - header = `(Source) ${display} - ${name}` + if(type === 'listenbrainz' || type === 'lastfm') { + header = `${display} (Source)`; + } const platformIds = Object.keys(players); // TODO links - body = (
+ body = (
{platformIds.map(x => )} -
Status: {status}
Tracks Discovered (since app started): {tracksDiscovered}
{canPoll && (!hasAuth || authed) ?
See recently played tracks returned by API
: null} {canPoll && hasAuthInteraction ? (Re)authenticate and (re)start polling : null} @@ -54,7 +60,7 @@ const SourceStatusCard = (props: SourceStatusCardData) => {
); } return ( - + {body} ); diff --git a/src/client/components/statusCard/StatusCardSkeleton.tsx b/src/client/components/statusCard/StatusCardSkeleton.tsx index 6250d654..b0df1b46 100644 --- a/src/client/components/statusCard/StatusCardSkeleton.tsx +++ b/src/client/components/statusCard/StatusCardSkeleton.tsx @@ -5,19 +5,34 @@ import SkeletonParagraph from "../skeleton/SkeletonParagraph"; export interface StatusCardSkeletonData { loading?: boolean header?: string + title?: string + subtitle?: string + status?: string } const StatusCardSkeleton = (props: PropsWithChildren) => { const { loading, header, + status = null, + title, + subtitle, children } = props || {}; + const showLoading = loading || (header === undefined && title === undefined); return ( -
-
-

{loading || header === undefined ? : header}

+
+
+ +
+
+ {header ?
{header}
: null} + {title ?
{title}
: null} + {subtitle ?
{subtitle}
: null} +
+
{status}
+
{loading ? : children} diff --git a/src/client/components/statusCard/statusCard.scss b/src/client/components/statusCard/statusCard.scss new file mode 100644 index 00000000..9e82fe21 --- /dev/null +++ b/src/client/components/statusCard/statusCard.scss @@ -0,0 +1,7 @@ +.statusCardBody { + article { + &:last-of-type { + margin-bottom: 1rem; + } + } +} diff --git a/src/client/status/StatusSection.tsx b/src/client/status/StatusSection.tsx index 26c58884..7f6d4bb5 100644 --- a/src/client/status/StatusSection.tsx +++ b/src/client/status/StatusSection.tsx @@ -26,11 +26,11 @@ const StatusSection = (props: PropsFromRedux) => { return ( -
+
{isLoading ? : undefined} {props.sourceIds.map(x => )}
-
+
{!isLoading ? props.clientIds.map(x => ) : null}