diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 94ac652be..afba679a1 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -169,10 +169,8 @@ "middleware": "Middleware" }, "navidrome": { - "user": "User", - "artist": "Artist", - "song": "Song", - "album": "Album" + "nothing_streaming": "No Active Streams", + "please_wait": "Please Wait" }, "npm": { "enabled": "Enabled", diff --git a/src/widgets/navidrome/component.jsx b/src/widgets/navidrome/component.jsx index 360dac97e..f4f3e6721 100644 --- a/src/widgets/navidrome/component.jsx +++ b/src/widgets/navidrome/component.jsx @@ -1,9 +1,24 @@ import { useTranslation } from "next-i18next"; import Container from "components/services/widget/container"; -import Block from "components/services/widget/block"; import useWidgetAPI from "utils/proxy/use-widget-api"; +function SinglePlayingEntry({ entry }) { + const { username, artist, title, album } = entry; + let fullTitle = title; + if (artist) fullTitle = `${artist} - ${title}`; + if (album) fullTitle += ` — ${album}`; + if (username) fullTitle += ` (${username})`; + + return ( +
+
+
{fullTitle}
+
+
+ ); +} + export default function Component({ service }) { const { t } = useTranslation(); @@ -17,37 +32,25 @@ export default function Component({ service }) { if (!navidromeData) { return ( - - - - - - + ); } - const nowPlaying = navidromeData["subsonic-response"].nowPlaying; + const { nowPlaying } = navidromeData["subsonic-response"]; if (!nowPlaying.entry) { // nothing playing return ( - + ); } const nowPlayingEntries = Object.values(nowPlaying.entry); - const songList = []; - - nowPlayingEntries.forEach(userPlay => { - const playing = ( - - - - - - - ); - songList.unshift(playing); - }); - - return songList; + + return ( +
+ {nowPlayingEntries.map((entry) => ( + + ))} +
+ ); }