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:
1 parent
9ec6d49f3e
commit
9ca22f52ac
3 files changed
+33
-1
No files matched your search
@@ -17,6 +17,7 @@
|
|||||||
FolderOpen,
|
FolderOpen,
|
||||||
RefreshCw
|
RefreshCw
|
||||||
} from 'lucide-svelte';
|
} from 'lucide-svelte';
|
||||||
|
import { shouldHidePlaylistFeatures } from '$lib/utils/offlineHelpers';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
onPlayNow?: () => void;
|
onPlayNow?: () => void;
|
||||||
@@ -283,7 +284,7 @@
|
|||||||
<span>Add to favorites</span>
|
<span>Add to favorites</span>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
{#if onAddToPlaylist}
|
{#if onAddToPlaylist && !shouldHidePlaylistFeatures()}
|
||||||
<button class="menu-item" onclick={() => handleAction(onAddToPlaylist)}>
|
<button class="menu-item" onclick={() => handleAction(onAddToPlaylist)}>
|
||||||
<ListMusic size={14} />
|
<ListMusic size={14} />
|
||||||
<span>Add to playlist</span>
|
<span>Add to playlist</span>
|
||||||
|
|||||||
@@ -1823,6 +1823,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</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 -->
|
<!-- Scan Progress -->
|
||||||
{#if scanning && scanProgress}
|
{#if scanning && scanProgress}
|
||||||
<div class="scan-progress">
|
<div class="scan-progress">
|
||||||
@@ -2705,6 +2713,24 @@
|
|||||||
to { transform: rotate(360deg); }
|
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 */
|
||||||
.scan-progress {
|
.scan-progress {
|
||||||
background: var(--bg-secondary);
|
background: var(--bg-secondary);
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import { isOffline } from '$lib/stores/offlineStore';
|
||||||
|
|
||||||
|
export function shouldHidePlaylistFeatures(): boolean {
|
||||||
|
return isOffline();
|
||||||
|
}
|
||||||
Reference in new issue
Block a user