diff --git a/src/client/components/Badges.tsx b/src/client/components/Badges.tsx index 71399115..bf5b0f7e 100644 --- a/src/client/components/Badges.tsx +++ b/src/client/components/Badges.tsx @@ -86,14 +86,12 @@ export const ComponentStateBadge = (props: ComponentProps & { setComponentState(data.state); },[data.state, setComponentState]); - if(props.componentId !== undefined && props.live) { - const client = useSSEContext(); - const connection = useSSEEvent(client, 'componentUpdate', (payload) => { - if(payload.componentId === props.componentId && payload.data.state !== undefined) { - setComponentState(payload.data.state); - } - }); - } + const client = useSSEContext(); + const connection = useSSEEvent(client, 'componentUpdate', (payload) => { + if(props.componentId !== undefined && props.live && payload.componentId === props.componentId && payload.data.state !== undefined) { + setComponentState(payload.data.state); + } + }); let badgeColor = undefined; diff --git a/src/client/components/chakraPlayer/Player.tsx b/src/client/components/chakraPlayer/Player.tsx index 2da01d2f..f705bbc7 100644 --- a/src/client/components/chakraPlayer/Player.tsx +++ b/src/client/components/chakraPlayer/Player.tsx @@ -18,6 +18,7 @@ import LinearProgress from '@mui/material/LinearProgress'; import { InfoTip, ToggleTip } from "../ToggleTip"; import { tanQueries } from "../../queries"; import dayjs from "dayjs"; +import { MSErrorBoundary } from "../ErrorBoundary"; export interface PlayerProps { data: SourcePlayerJson & {expiration?: string} @@ -149,45 +150,49 @@ export const ChakraPlayer = (props: PlayerProps) => { const bufferTip = positionBuffer !== undefined ? : null; - return - - - {playArt !== undefined ? : null} -
- - {calculated !== 'stopped' ? track : '-'} - {calculated !== 'stopped' ? artists.map(x => x.name).join(' / ') : '-'} - -
-
- - {positionTimestamp} - - - - {durationTimestamp} - - {/* - - {positionTimestamp} - - - - {durationTimestamp} - - */} - - {['unknown', 'playing'].includes(calculated) && isNowPlaying ? 'Now Playing' : capitalize(calculated)}{!isNowPlaying ? bufferTip : null} - - Listened: {isNowPlaying !== true && calculated !== 'stopped' && listenedDuration !== null ? `${listenedDuration.toFixed(0)}s` : '-'}{durPer} - -
-
+ return ( + + + + + {playArt !== undefined ? : null} +
+ + {calculated !== 'stopped' ? track : '-'} + {calculated !== 'stopped' ? artists.map(x => x.name).join(' / ') : '-'} + +
+
+ + {positionTimestamp} + + + + {durationTimestamp} + + {/* + + {positionTimestamp} + + + + {durationTimestamp} + + */} + + {['unknown', 'playing'].includes(calculated) && isNowPlaying ? 'Now Playing' : capitalize(calculated)}{!isNowPlaying ? bufferTip : null} + + Listened: {isNowPlaying !== true && calculated !== 'stopped' && listenedDuration !== null ? `${listenedDuration.toFixed(0)}s` : '-'}{durPer} + +
+
+
+ ) } diff --git a/src/client/components/msComponent/MSComponentDetailed.tsx b/src/client/components/msComponent/MSComponentDetailed.tsx index 80a656e1..127f7798 100644 --- a/src/client/components/msComponent/MSComponentDetailed.tsx +++ b/src/client/components/msComponent/MSComponentDetailed.tsx @@ -73,28 +73,6 @@ export const MSComponentStats = (props: { data?: ComponentCommonApiJson, live?: const stateIsStarted = (state: ComponentState): boolean => state <= COMPONENT_STATE.MUTED; -const ComponentSettings = (props: { data: ComponentCommonApiJson }) => { - const [startChecked, setStartChecked] = useState(stateIsStarted(props.data.state)); - return ( - - setStartChecked(e.checked)} - > - - - - }> - - - - - Start - - - ) -} - const componentStateMenuItem = (Icon: IconType, value: string, name?: string) => (props: Pick = {}) => { return ({name ?? capitalize(value)}); } @@ -208,9 +186,9 @@ export const ComponentDetailedDesktop = (props: {data?: ComponentCommonApiJson, - {props.live ? : } + {props.live ? : } {isComponentTypeSource(props.data.mode) ? 'Plays' : 'Scrobbles'} - + )