Disable playlist management in offline mode

- Add shouldHidePlaylistFeatures() helper function
- Hide 'Add to playlist' button in TrackMenu when offline
- Add informational banner in Local Library view
- Users can still play tracks in offline mode
- Implements Option 2 from OFFLINE_PLAYLIST_FEATURE_OPTIONS.md
This commit is contained in:
vicrodh committed 2026-01-20 15:20:02 -06:00
1 parent 9ec6d49f3e
commit 9ca22f52ac
3 files changed
+33 -1

No files matched your search

+2 -1
View File
@@ -17,6 +17,7 @@
FolderOpen,
RefreshCw
} from 'lucide-svelte';
import { shouldHidePlaylistFeatures } from '$lib/utils/offlineHelpers';
interface Props {
onPlayNow?: () => void;
@@ -283,7 +284,7 @@
<span>Add to favorites</span>
</button>
{/if}
{#if onAddToPlaylist}
{#if onAddToPlaylist && !shouldHidePlaylistFeatures()}
<button class="menu-item" onclick={() => handleAction(onAddToPlaylist)}>
<ListMusic size={14} />
<span>Add to playlist</span>
@@ -1823,6 +1823,14 @@
</div>
</div>
<!-- Offline Notice Banner -->
{#if isOffline}
<div class="offline-notice">
<AlertCircle size={16} />
<span>Playlist management is disabled in offline mode. You can still play your local tracks.</span>
</div>
{/if}
<!-- Scan Progress -->
{#if scanning && scanProgress}
<div class="scan-progress">
@@ -2705,6 +2713,24 @@
to { transform: rotate(360deg); }
}
/* Offline Notice */
.offline-notice {
background: rgba(251, 191, 36, 0.1);
border: 1px solid rgba(251, 191, 36, 0.3);
border-radius: 8px;
padding: 12px 16px;
margin-bottom: 24px;
display: flex;
align-items: center;
gap: 12px;
color: #fbbf24;
font-size: 14px;
}
.offline-notice span {
color: var(--text-primary);
}
/* Scan Progress */
.scan-progress {
background: var(--bg-secondary);
+5
View File
@@ -0,0 +1,5 @@
import { isOffline } from '$lib/stores/offlineStore';
export function shouldHidePlaylistFeatures(): boolean {
return isOffline();
}