Distinguish manual offline mode from a lost server connection

This commit is contained in:
ab committed 2026-11-24 05:19:47 +02:00
1 parent 84f234bc6e
commit d32ec66fb0
5 files changed
+24 -6

No files matched your search

+2 -1
View File
@@ -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
+2
View File
@@ -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" , "Управление офлайн-музыкой";
+3 -1
View File
@@ -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}
+9 -3
View File
@@ -8,14 +8,20 @@
{% if !guest && share_token.is_empty() %}
<div class="offline-status-banner" role="status" aria-atomic="true"
:title="$store.offline.manual ? '{{ t.player_offline_mode }}' : '{{ t.player_offline_auto }}'">
title="{{ t.player_offline_saved_only }}">
<div class="offline-status-clip">
<div class="offline-status-content">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="m3 3 18 18M7.1 7.1A7 7 0 0 0 5 12a4 4 0 0 0 0 8h12M10.2 5.2A7 7 0 0 1 19 11a4.5 4.5 0 0 1 2.5 7.4"/>
<g x-show="$store.offline.manual">
<rect x="2" y="6" width="20" height="12" rx="6"/><circle cx="15.5" cy="12" r="3" fill="currentColor" stroke="none"/>
</g>
<g x-show="!$store.offline.manual" transform="rotate(-35 12 12)">
<path d="M1 12h2m3-3h2v6H6a3 3 0 0 1 0-6ZM8 10.5h3m-3 3h3M15 9h3a3 3 0 0 1 0 6h-3ZM21 12h2"/>
</g>
</svg>
<strong>{{ t.player_offline_manual }}</strong>
<span>{{ t.player_offline_saved_only }}</span>
<span class="offline-status-reason" x-text="$store.offline.manual ? '{{ t.player_offline_manual_reason }}' : '{{ t.player_offline_auto_reason }}'"></span>
<span class="offline-status-note">{{ t.player_offline_saved_only }}</span>
</div>
</div>
</div>
+8 -1
View File
@@ -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(() => {