diff --git a/CHANGELOG.md b/CHANGELOG.md index 832d2e8..2680c6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,8 @@ placeholders as well. - Expanding an artist's popular tracks scrolls to the section heading. Collapsing the list returns to the top of the artist page. -- A compact full-width banner identifies offline playback across the player. +- A compact full-width offline banner shows whether the listener enabled the + mode manually or the server is unreachable. - Personal settings group language and Last.fm side by side and bring offline storage, the cache limit and saved music together in one compact panel. - Connected devices use compact lists with counts, separate mobile tabs for diff --git a/src/i18n/phrases.rs b/src/i18n/phrases.rs index e17f1dc..ea3bbf2 100644 --- a/src/i18n/phrases.rs +++ b/src/i18n/phrases.rs @@ -293,6 +293,8 @@ translations! { player_offline_online: "Online" , "Онлайн"; player_offline_manual: "Offline" , "Офлайн"; player_offline_saved_only: "Saved music only" , "Только сохранённая музыка"; + player_offline_manual_reason: "Enabled manually" , "Включён вручную"; + player_offline_auto_reason: "Server unreachable" , "Нет связи с сервером"; player_offline_auto: "Offline · automatic" , "Офлайн · автоматически"; player_offline_manage: "Manage" , "Управление"; player_offline_manage_label: "Manage offline music" , "Управление офлайн-музыкой"; diff --git a/templates/player/offline_styles.css b/templates/player/offline_styles.css index de477b9..72280af 100644 --- a/templates/player/offline_styles.css +++ b/templates/player/offline_styles.css @@ -86,7 +86,9 @@ html:not(.offline-active) [data-offline-only], html.offline-active [data-online- } .offline-status-content svg {width:16px; height:16px; flex:none} .offline-status-content strong {font-size:13px; font-weight:650} -.offline-status-content span {padding-inline-start:9px; border-inline-start:1px solid #d8c79440; color:var(--text-secondary)} +.offline-status-reason {color:#cec5b1} +.offline-status-note {padding-inline-start:9px; border-inline-start:1px solid #d8c79440; color:var(--text-secondary)} +@media (max-width:480px) { .offline-status-note {display:none} } .offline-devices-note {padding:9px; color:var(--text-secondary); font-size:13px} @media (min-width:601px) { .offline-preferences.cache-disabled .offline-preferences-main {grid-area:1 / 1 / 2 / -1} diff --git a/templates/player/shell.html b/templates/player/shell.html index bb1da27..b9d5740 100644 --- a/templates/player/shell.html +++ b/templates/player/shell.html @@ -8,14 +8,20 @@ {% if !guest && share_token.is_empty() %}
+ title="{{ t.player_offline_saved_only }}">
{{ t.player_offline_manual }} - {{ t.player_offline_saved_only }} + + {{ t.player_offline_saved_only }}
diff --git a/tests/browser-sidebar.cjs b/tests/browser-sidebar.cjs index 4d6c0d3..639d463 100644 --- a/tests/browser-sidebar.cjs +++ b/tests/browser-sidebar.cjs @@ -257,12 +257,17 @@ async function checkOfflineControls(page, trigger, panel) { assert.ok(await panel.isVisible()); const banner = page.locator('.offline-status-banner'); assert.equal(await banner.isVisible(), false); + assert.equal(await banner.evaluate(el => el.getBoundingClientRect().height), 0); await manual.click(); assert.equal(await manual.getAttribute('aria-checked'), 'true'); await banner.getByText('Offline', {exact:true}).waitFor(); + await banner.getByText('Enabled manually', {exact:true}).waitFor(); + await banner.evaluate(el => Promise.all(el.getAnimations().map(a => a.finished))); const bounds = await banner.boundingBox(); assert.equal(bounds.x, 0); assert.equal(bounds.width, page.viewportSize().width, 'offline banner spans the player on desktop and mobile'); + assert.equal(bounds.y, 0); + assert.ok(bounds.height >= 28 && bounds.height <= 36, 'the open banner occupies one compact row'); assert.ok(await panel.isVisible(), 'toggling saved music keeps the menu open'); assert.equal(await panel.getByRole('link', {name:'My listening'}).isVisible(), false); assert.equal(await panel.getByRole('link', {name:'Followed'}).isVisible(), true); @@ -273,9 +278,11 @@ async function checkOfflineControls(page, trigger, panel) { await page.locator('.device-toggle-btn:visible').click(); assert.equal((await page.locator('.device-popover:visible').innerText()).trim(), 'Devices are unavailable offline.'); await page.locator('.device-toggle-btn:visible').click(); - await page.evaluate(() => { Alpine.store('offline').manual = false; }); + await page.evaluate(() => Object.assign(Alpine.store('offline'), {manual:false, automatic:true})); await trigger.click(); await panel.getByText('Offline · automatic').waitFor(); + await banner.getByText('Server unreachable', {exact:true}).waitFor(); + assert.equal(await banner.getByText('Enabled manually', {exact:true}).isVisible(), false); assert.ok(await banner.isVisible()); assert.equal(await manual.getAttribute('aria-checked'), 'false'); await page.evaluate(() => {