From 0198a6d10b645af3f5906973f84317cd02cd505a Mon Sep 17 00:00:00 2001 From: tgiachi Date: Thu, 12 Nov 2026 14:12:57 +0100 Subject: [PATCH] fix(web): say what to do when Discover starts from a listening that is empty Found against a real server: with the setting on and nothing played, the answer is empty with no seeds. The page now says to play something or pick an artist, instead of a plain 'no suggestions'. --- web/src/i18n/locales/en.json | 1 + web/src/i18n/locales/it.json | 1 + web/src/pages/discover/SuggestionsTab.test.tsx | 7 +++++++ web/src/pages/discover/SuggestionsTab.tsx | 5 ++++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/web/src/i18n/locales/en.json b/web/src/i18n/locales/en.json index 06b4462..bc7c048 100644 --- a/web/src/i18n/locales/en.json +++ b/web/src/i18n/locales/en.json @@ -78,6 +78,7 @@ "fromListening": "Started from your listening: {{names}}", "onlyNew": "Only artists I do not have", "none": "No suggestions yet.", + "nothingPlayed": "You have not played anything to start from yet. Play something, or pick an artist above.", "partial": "Last.fm could not be reached for some artists, so this list may be shorter.", "busy": "Discover is busy with another request. Try again in a moment.", "retryIn": "Try again in {{seconds}} s", diff --git a/web/src/i18n/locales/it.json b/web/src/i18n/locales/it.json index f1c015b..7994d96 100644 --- a/web/src/i18n/locales/it.json +++ b/web/src/i18n/locales/it.json @@ -78,6 +78,7 @@ "fromListening": "Partito dai tuoi ascolti: {{names}}", "onlyNew": "Solo artisti che non ho", "none": "Ancora nessun suggerimento.", + "nothingPlayed": "Non hai ancora ascoltato niente da cui partire. Ascolta qualcosa, oppure scegli un artista qui sopra.", "partial": "Last.fm non era raggiungibile per alcuni artisti, quindi la lista può essere più corta.", "busy": "Discover è occupato con un'altra richiesta. Riprova tra poco.", "retryIn": "Riprova tra {{seconds}} s", diff --git a/web/src/pages/discover/SuggestionsTab.test.tsx b/web/src/pages/discover/SuggestionsTab.test.tsx index 4cd85fc..2a15aa9 100644 --- a/web/src/pages/discover/SuggestionsTab.test.tsx +++ b/web/src/pages/discover/SuggestionsTab.test.tsx @@ -144,6 +144,13 @@ test('when Last.fm failed for some artists the rest is shown with a warning', as expect(screen.getByText('Last.fm could not be reached for some artists, so this list may be shorter.')).toBeInTheDocument() }) +test('starting from a listening that is empty says to play something, not just "nothing"', async () => { + mockFetch(routes(true, { 'GET /api/v1/discover': () => answer({ from_listening: true, seeds: [], items: [] }) })) + renderTab() + expect(await screen.findByText('You have not played anything to start from yet. Play something, or pick an artist above.')).toBeInTheDocument() + expect(screen.queryByText('No suggestions yet.')).not.toBeInTheDocument() +}) + test('an empty answer says there is nothing yet', async () => { mockFetch(routes(true, { 'GET /api/v1/discover': () => answer({ items: [] }) })) renderTab() diff --git a/web/src/pages/discover/SuggestionsTab.tsx b/web/src/pages/discover/SuggestionsTab.tsx index f7e75a1..1da125e 100644 --- a/web/src/pages/discover/SuggestionsTab.tsx +++ b/web/src/pages/discover/SuggestionsTab.tsx @@ -101,7 +101,10 @@ export default function SuggestionsTab() {

)} {data.items.length === 0 ? ( - {t('discover.none')} + + {/* Listening was the only start and it is empty: say what to do, not just "nothing". */} + {data.from_listening && data.seeds.length === 0 && seeds.length === 0 ? t('discover.nothingPlayed') : t('discover.none')} + ) : (