mirror of
https://github.com/markuryy/shark.git
synced 2025-12-12 19:51:01 +00:00
refactor(ui): remove in-library status from spotify collection view
This commit is contained in:
@@ -9,7 +9,6 @@
|
|||||||
metadata?: string;
|
metadata?: string;
|
||||||
coverImageUrl?: string;
|
coverImageUrl?: string;
|
||||||
tracks: Track[];
|
tracks: Track[];
|
||||||
trackExistsMap?: Map<string, boolean>;
|
|
||||||
selectedTrackIndex?: number | null;
|
selectedTrackIndex?: number | null;
|
||||||
onTrackClick?: (index: number) => void;
|
onTrackClick?: (index: number) => void;
|
||||||
onDownloadTrack?: (index: number) => void;
|
onDownloadTrack?: (index: number) => void;
|
||||||
@@ -23,7 +22,6 @@
|
|||||||
metadata,
|
metadata,
|
||||||
coverImageUrl,
|
coverImageUrl,
|
||||||
tracks,
|
tracks,
|
||||||
trackExistsMap = new Map(),
|
|
||||||
selectedTrackIndex = null,
|
selectedTrackIndex = null,
|
||||||
onTrackClick,
|
onTrackClick,
|
||||||
onDownloadTrack,
|
onDownloadTrack,
|
||||||
@@ -47,19 +45,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Spotify track ID for existence checking
|
|
||||||
function getSpotifyTrackId(track: Track): string | undefined {
|
|
||||||
return (track as any).spotifyId?.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
function isTrackInLibrary(track: Track): boolean {
|
|
||||||
const trackId = getSpotifyTrackId(track);
|
|
||||||
if (!trackId) return false;
|
|
||||||
return trackExistsMap.get(trackId) ?? false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isTrackDownloading(track: Track): boolean {
|
function isTrackDownloading(track: Track): boolean {
|
||||||
const trackId = getSpotifyTrackId(track);
|
const trackId = (track as any).spotifyId?.toString();
|
||||||
if (!trackId) return false;
|
if (!trackId) return false;
|
||||||
return downloadingTrackIds.has(trackId);
|
return downloadingTrackIds.has(trackId);
|
||||||
}
|
}
|
||||||
@@ -119,7 +106,6 @@
|
|||||||
<th>Album</th>
|
<th>Album</th>
|
||||||
<th>Duration</th>
|
<th>Duration</th>
|
||||||
{#if $deezerAuth.loggedIn}
|
{#if $deezerAuth.loggedIn}
|
||||||
<th style="width: 80px;">In Library</th>
|
|
||||||
<th style="width: 100px;">Actions</th>
|
<th style="width: 100px;">Actions</th>
|
||||||
{/if}
|
{/if}
|
||||||
</tr>
|
</tr>
|
||||||
@@ -144,9 +130,6 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
{#if $deezerAuth.loggedIn}
|
{#if $deezerAuth.loggedIn}
|
||||||
<td class="in-library">
|
|
||||||
{isTrackInLibrary(track) ? '✓' : '✗'}
|
|
||||||
</td>
|
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
<button
|
<button
|
||||||
onclick={(e) => handleDownloadClick(i, e)}
|
onclick={(e) => handleDownloadClick(i, e)}
|
||||||
@@ -329,12 +312,6 @@
|
|||||||
color: #c00;
|
color: #c00;
|
||||||
}
|
}
|
||||||
|
|
||||||
.in-library {
|
|
||||||
text-align: center;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 1.2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.actions {
|
.actions {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
let playlistTracks = $state<SpotifyPlaylistTrack[]>([]);
|
let playlistTracks = $state<SpotifyPlaylistTrack[]>([]);
|
||||||
let selectedTrackIndex = $state<number | null>(null);
|
let selectedTrackIndex = $state<number | null>(null);
|
||||||
let coverImageUrl = $state<string | undefined>(undefined);
|
let coverImageUrl = $state<string | undefined>(undefined);
|
||||||
let trackExistsMap = $state(new Map<string, boolean>());
|
|
||||||
let downloadingTrackIds = $state(new Set<string>());
|
let downloadingTrackIds = $state(new Set<string>());
|
||||||
|
|
||||||
// Convert Spotify tracks to Track type for CollectionView
|
// Convert Spotify tracks to Track type for CollectionView
|
||||||
@@ -290,7 +289,6 @@
|
|||||||
metadata="{playlist.track_count} tracks"
|
metadata="{playlist.track_count} tracks"
|
||||||
{coverImageUrl}
|
{coverImageUrl}
|
||||||
{tracks}
|
{tracks}
|
||||||
{trackExistsMap}
|
|
||||||
{selectedTrackIndex}
|
{selectedTrackIndex}
|
||||||
{downloadingTrackIds}
|
{downloadingTrackIds}
|
||||||
onTrackClick={handleTrackClick}
|
onTrackClick={handleTrackClick}
|
||||||
|
|||||||
Reference in New Issue
Block a user