feat(search): integrate playlists into search page
- Add playlists to unified search results (SearchAllResults) - Add dedicated Playlists tab in jump-nav - Create SearchPlaylistCard with album-like overlay (heart/play/menu) - Add playlist menu: Play next, Add to queue, Copy to library, Share - Add offset parameter to search_playlists command - Add PlaylistGenre and extra fields to Playlist model - Update searchState with Playlist type and playlistResults UI changes: - Remove glyphs from search tabs - Reduce tab spacing (gap 8px→4px, padding 16px→12px) - Reduce filter font size (13px→12px)
This commit is contained in:
1 parent
f6d2a6bddd
commit
61dd071326
7 files changed
+531
-15
No files matched your search
@@ -0,0 +1,363 @@
|
||||
<script lang="ts">
|
||||
import { tick } from 'svelte';
|
||||
import { Play, Heart, MoreHorizontal, ListPlus, Library, Share2, ListMusic } from 'lucide-svelte';
|
||||
import PlaylistCollage from './PlaylistCollage.svelte';
|
||||
import type { Playlist } from '$lib/stores/searchState';
|
||||
|
||||
interface Props {
|
||||
playlist: Playlist;
|
||||
onclick?: () => void;
|
||||
onPlay?: () => void;
|
||||
onPlayNext?: () => void;
|
||||
onPlayLater?: () => void;
|
||||
onCopyToLibrary?: () => void;
|
||||
onShareQobuz?: () => void;
|
||||
}
|
||||
|
||||
let {
|
||||
playlist,
|
||||
onclick,
|
||||
onPlay,
|
||||
onPlayNext,
|
||||
onPlayLater,
|
||||
onCopyToLibrary,
|
||||
onShareQobuz
|
||||
}: Props = $props();
|
||||
|
||||
let menuOpen = $state(false);
|
||||
let menuTriggerRef: HTMLButtonElement | null = null;
|
||||
let menuEl: HTMLDivElement | null = null;
|
||||
let menuStyle = $state('');
|
||||
|
||||
// Ticker animation for long titles
|
||||
let titleRef: HTMLDivElement | null = $state(null);
|
||||
let titleTextRef: HTMLSpanElement | null = $state(null);
|
||||
let titleOverflow = $state(0);
|
||||
const tickerSpeed = 40;
|
||||
const titleOffset = $derived(titleOverflow > 0 ? `-${titleOverflow + 16}px` : '0px');
|
||||
const titleDuration = $derived(titleOverflow > 0 ? `${(titleOverflow + 16) / tickerSpeed}s` : '0s');
|
||||
let overflowMeasured = false;
|
||||
|
||||
function measureOverflowOnce() {
|
||||
if (!overflowMeasured && titleRef && titleTextRef) {
|
||||
const overflow = titleTextRef.scrollWidth - titleRef.clientWidth;
|
||||
titleOverflow = overflow > 0 ? overflow : 0;
|
||||
overflowMeasured = true;
|
||||
}
|
||||
}
|
||||
|
||||
function getPlaylistImage(): string {
|
||||
// Prefer images300 for better quality, fallback to images150, then images
|
||||
if (playlist.images300?.length) return playlist.images300[0];
|
||||
if (playlist.images150?.length) return playlist.images150[0];
|
||||
if (playlist.images?.length) return playlist.images[0];
|
||||
return '';
|
||||
}
|
||||
|
||||
function getGenreLabel(): string {
|
||||
if (playlist.genres?.length) return playlist.genres[0].name;
|
||||
return '';
|
||||
}
|
||||
|
||||
function handlePlay(event: MouseEvent) {
|
||||
event.stopPropagation();
|
||||
onPlay?.();
|
||||
}
|
||||
|
||||
function handleCardClick(event: MouseEvent) {
|
||||
if ((event.target as HTMLElement).closest('.action-buttons')) return;
|
||||
onclick?.();
|
||||
}
|
||||
|
||||
// Portal for menu
|
||||
function portal(node: HTMLElement) {
|
||||
document.body.appendChild(node);
|
||||
return {
|
||||
destroy() {
|
||||
if (node.parentNode) node.parentNode.removeChild(node);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async function positionMenu() {
|
||||
await tick();
|
||||
if (!menuTriggerRef || !menuEl) return;
|
||||
const triggerRect = menuTriggerRef.getBoundingClientRect();
|
||||
const menuRect = menuEl.getBoundingClientRect();
|
||||
let left = triggerRect.right - menuRect.width;
|
||||
let top = triggerRect.bottom + 8;
|
||||
if (left < 8) left = 8;
|
||||
if (left + menuRect.width > window.innerWidth - 8) {
|
||||
left = window.innerWidth - menuRect.width - 8;
|
||||
}
|
||||
if (top + menuRect.height > window.innerHeight - 8) {
|
||||
top = triggerRect.top - menuRect.height - 8;
|
||||
}
|
||||
menuStyle = `left: ${left}px; top: ${top}px;`;
|
||||
}
|
||||
|
||||
function toggleMenu(event: MouseEvent) {
|
||||
event.stopPropagation();
|
||||
menuOpen = !menuOpen;
|
||||
if (menuOpen) positionMenu();
|
||||
}
|
||||
|
||||
function closeMenu() {
|
||||
menuOpen = false;
|
||||
}
|
||||
|
||||
// Close menu on click outside
|
||||
function handleClickOutside(event: MouseEvent) {
|
||||
if (menuOpen && menuEl && !menuEl.contains(event.target as Node) &&
|
||||
menuTriggerRef && !menuTriggerRef.contains(event.target as Node)) {
|
||||
menuOpen = false;
|
||||
}
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
if (menuOpen) {
|
||||
document.addEventListener('click', handleClickOutside);
|
||||
return () => document.removeEventListener('click', handleClickOutside);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="playlist-card"
|
||||
class:menu-open={menuOpen}
|
||||
onclick={handleCardClick}
|
||||
onmouseenter={measureOverflowOnce}
|
||||
onfocus={measureOverflowOnce}
|
||||
role="button"
|
||||
tabindex="0"
|
||||
onkeydown={(e) => e.key === 'Enter' && onclick?.()}
|
||||
>
|
||||
<div class="artwork-container">
|
||||
{#if getPlaylistImage()}
|
||||
<img src={getPlaylistImage()} alt={playlist.name} loading="lazy" />
|
||||
{:else}
|
||||
<PlaylistCollage artworks={playlist.images || []} size={162} />
|
||||
{/if}
|
||||
|
||||
<div class="action-overlay">
|
||||
{#if getGenreLabel()}
|
||||
<div class="overlay-info">
|
||||
<span class="overlay-genre">{getGenreLabel()}</span>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="action-buttons">
|
||||
<button class="overlay-btn overlay-btn--minor" type="button" title="Add to favorites">
|
||||
<Heart size={18} />
|
||||
</button>
|
||||
<button class="overlay-btn" type="button" onclick={handlePlay} title="Play">
|
||||
<Play size={18} fill="white" />
|
||||
</button>
|
||||
<button
|
||||
class="overlay-btn overlay-btn--minor"
|
||||
type="button"
|
||||
bind:this={menuTriggerRef}
|
||||
onclick={toggleMenu}
|
||||
title="More options"
|
||||
>
|
||||
<MoreHorizontal size={18} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-info">
|
||||
<div
|
||||
class="card-title"
|
||||
class:scrollable={titleOverflow > 0}
|
||||
style="--ticker-offset: {titleOffset}; --ticker-duration: {titleDuration};"
|
||||
bind:this={titleRef}
|
||||
>
|
||||
<span class="title-text" bind:this={titleTextRef}>{playlist.name}</span>
|
||||
</div>
|
||||
<div class="card-subtitle">
|
||||
<span class="owner">{playlist.owner.name}</span>
|
||||
<span class="separator">-</span>
|
||||
<span class="tracks">{playlist.tracks_count} tracks</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if menuOpen}
|
||||
<div class="playlist-menu" bind:this={menuEl} style={menuStyle} use:portal>
|
||||
<button class="menu-item" onclick={() => { onPlayNext?.(); closeMenu(); }}>
|
||||
<ListPlus size={14} /> <span>Play next</span>
|
||||
</button>
|
||||
<button class="menu-item" onclick={() => { onPlayLater?.(); closeMenu(); }}>
|
||||
<ListMusic size={14} /> <span>Add to queue</span>
|
||||
</button>
|
||||
<div class="menu-separator"></div>
|
||||
<button class="menu-item" onclick={() => { onCopyToLibrary?.(); closeMenu(); }}>
|
||||
<Library size={14} /> <span>Copy to library</span>
|
||||
</button>
|
||||
<div class="menu-separator"></div>
|
||||
<button class="menu-item" onclick={() => { onShareQobuz?.(); closeMenu(); }}>
|
||||
<Share2 size={14} /> <span>Share (Qobuz)</span>
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.playlist-card {
|
||||
width: 162px;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.artwork-container {
|
||||
width: 162px;
|
||||
height: 162px;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: var(--bg-tertiary);
|
||||
}
|
||||
|
||||
.artwork-container img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.action-overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 40%, transparent 60%, rgba(0,0,0,0.6) 100%);
|
||||
opacity: 0;
|
||||
transition: opacity 150ms ease;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.playlist-card:hover .action-overlay,
|
||||
.playlist-card.menu-open .action-overlay {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.overlay-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.overlay-genre {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: white;
|
||||
text-shadow: 0 1px 3px rgba(0,0,0,0.8);
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.overlay-btn {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 50%;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.85);
|
||||
transition: all 150ms ease;
|
||||
}
|
||||
|
||||
.overlay-btn:hover {
|
||||
background: rgba(0,0,0,0.3);
|
||||
box-shadow: inset 0 0 0 1px var(--accent-primary);
|
||||
}
|
||||
|
||||
.overlay-btn--minor {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
.card-info {
|
||||
padding: 10px 4px 4px;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.card-title.scrollable {
|
||||
mask-image: linear-gradient(to right, black calc(100% - 24px), transparent);
|
||||
}
|
||||
|
||||
.card-title.scrollable:hover .title-text {
|
||||
animation: ticker var(--ticker-duration) linear infinite;
|
||||
}
|
||||
|
||||
@keyframes ticker {
|
||||
0%, 20% { transform: translateX(0); }
|
||||
80%, 100% { transform: translateX(var(--ticker-offset)); }
|
||||
}
|
||||
|
||||
.card-subtitle {
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
margin-top: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.separator {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.playlist-menu {
|
||||
position: fixed;
|
||||
z-index: 10000;
|
||||
background: var(--bg-elevated);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 8px;
|
||||
padding: 6px 0;
|
||||
min-width: 180px;
|
||||
box-shadow: 0 8px 32px rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
padding: 8px 14px;
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-primary);
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.menu-item:hover {
|
||||
background: var(--bg-hover);
|
||||
}
|
||||
|
||||
.menu-separator {
|
||||
height: 1px;
|
||||
background: var(--border-subtle);
|
||||
margin: 4px 0;
|
||||
}
|
||||
</style>
|
||||
@@ -3,10 +3,11 @@
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { Search, Disc3, Music, Mic2, User, X, ChevronLeft, ChevronRight, Crown, Heart, Play, MoreHorizontal, ListPlus } from 'lucide-svelte';
|
||||
import AlbumCard from '../AlbumCard.svelte';
|
||||
import SearchPlaylistCard from '../SearchPlaylistCard.svelte';
|
||||
import ViewTransition from '../ViewTransition.svelte';
|
||||
import TrackMenu from '../TrackMenu.svelte';
|
||||
import QualityBadge from '../QualityBadge.svelte';
|
||||
import { getSearchState, setSearchState, subscribeSearchFocus, subscribeSearchQuery, setSearchQuery, type SearchResults, type SearchAllResults, type SearchTab, type SearchFilterType } from '$lib/stores/searchState';
|
||||
import { getSearchState, setSearchState, subscribeSearchFocus, subscribeSearchQuery, setSearchQuery, type SearchResults, type SearchAllResults, type SearchTab, type SearchFilterType, type Playlist } from '$lib/stores/searchState';
|
||||
import { setPlaybackContext } from '$lib/stores/playbackContextStore';
|
||||
import { togglePlay } from '$lib/stores/playerStore';
|
||||
import { t } from '$lib/i18n';
|
||||
@@ -226,6 +227,12 @@
|
||||
onTrackReDownload?: (track: Track) => void;
|
||||
checkTrackDownloaded?: (trackId: number) => boolean;
|
||||
onArtistClick?: (artistId: number) => void;
|
||||
onPlaylistClick?: (playlistId: number) => void;
|
||||
onPlaylistPlay?: (playlistId: number) => void;
|
||||
onPlaylistPlayNext?: (playlistId: number) => void;
|
||||
onPlaylistPlayLater?: (playlistId: number) => void;
|
||||
onPlaylistCopyToLibrary?: (playlistId: number) => void;
|
||||
onPlaylistShareQobuz?: (playlistId: number) => void;
|
||||
activeTrackId?: number | null;
|
||||
isPlaybackActive?: boolean;
|
||||
}
|
||||
@@ -258,6 +265,12 @@
|
||||
onTrackReDownload,
|
||||
checkTrackDownloaded,
|
||||
onArtistClick,
|
||||
onPlaylistClick,
|
||||
onPlaylistPlay,
|
||||
onPlaylistPlayNext,
|
||||
onPlaylistPlayLater,
|
||||
onPlaylistCopyToLibrary,
|
||||
onPlaylistShareQobuz,
|
||||
activeTrackId = null,
|
||||
isPlaybackActive = false
|
||||
}: Props = $props();
|
||||
@@ -308,6 +321,7 @@
|
||||
let albumResults = $state<SearchResults<Album> | null>(cachedState.albumResults ?? null);
|
||||
let trackResults = $state<SearchResults<Track> | null>(cachedState.trackResults ?? null);
|
||||
let artistResults = $state<SearchResults<Artist> | null>(cachedState.artistResults ?? null);
|
||||
let playlistResults = $state<SearchResults<Playlist> | null>(cachedState.playlistResults ?? null);
|
||||
let allResults = $state<SearchAllResults<Album, Track, Artist> | null>(cachedState.allResults ?? null);
|
||||
|
||||
let searchTimeout: ReturnType<typeof setTimeout> | null = null;
|
||||
@@ -320,6 +334,7 @@
|
||||
let hasMoreAlbums = $derived(albumResults ? albumResults.offset + albumResults.items.length < albumResults.total : false);
|
||||
let hasMoreTracks = $derived(trackResults ? trackResults.offset + trackResults.items.length < trackResults.total : false);
|
||||
let hasMoreArtists = $derived(artistResults ? artistResults.offset + artistResults.items.length < artistResults.total : false);
|
||||
let hasMorePlaylists = $derived(playlistResults ? playlistResults.offset + playlistResults.items.length < playlistResults.total : false);
|
||||
|
||||
// Most popular result comes directly from Qobuz's catalog/search API
|
||||
// No heuristics needed - Qobuz determines the most relevant result
|
||||
@@ -376,6 +391,7 @@
|
||||
albumResults,
|
||||
trackResults,
|
||||
artistResults,
|
||||
playlistResults,
|
||||
allResults
|
||||
});
|
||||
});
|
||||
@@ -486,6 +502,15 @@
|
||||
if (query.trim() !== searchQuery) return;
|
||||
artistResults = results;
|
||||
console.log('Artist results:', artistResults);
|
||||
} else if (activeTab === 'playlists') {
|
||||
const results = await invoke<SearchResults<Playlist>>('search_playlists', {
|
||||
query: searchQuery,
|
||||
limit: PAGE_SIZE,
|
||||
offset: 0
|
||||
});
|
||||
if (query.trim() !== searchQuery) return;
|
||||
playlistResults = results;
|
||||
console.log('Playlist results:', playlistResults);
|
||||
}
|
||||
} catch (err) {
|
||||
// Only show error if this is still the latest search
|
||||
@@ -548,6 +573,18 @@
|
||||
items: [...artistResults.items, ...moreResults.items],
|
||||
offset: 0
|
||||
};
|
||||
} else if (activeTab === 'playlists' && playlistResults && hasMorePlaylists) {
|
||||
const newOffset = playlistResults.offset + playlistResults.items.length;
|
||||
const moreResults = await invoke<SearchResults<Playlist>>('search_playlists', {
|
||||
query: query.trim(),
|
||||
limit: PAGE_SIZE,
|
||||
offset: newOffset
|
||||
});
|
||||
playlistResults = {
|
||||
...moreResults,
|
||||
items: [...playlistResults.items, ...moreResults.items],
|
||||
offset: 0
|
||||
};
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Load more error:', err);
|
||||
@@ -762,7 +799,6 @@
|
||||
class:active={activeTab === 'all'}
|
||||
onclick={() => handleTabChange('all')}
|
||||
>
|
||||
<Search size={18} />
|
||||
<span>All</span>
|
||||
</button>
|
||||
<button
|
||||
@@ -770,7 +806,6 @@
|
||||
class:active={activeTab === 'albums'}
|
||||
onclick={() => handleTabChange('albums')}
|
||||
>
|
||||
<Disc3 size={18} />
|
||||
<span>{$t('search.albums')}</span>
|
||||
</button>
|
||||
<button
|
||||
@@ -778,7 +813,6 @@
|
||||
class:active={activeTab === 'tracks'}
|
||||
onclick={() => handleTabChange('tracks')}
|
||||
>
|
||||
<Music size={18} />
|
||||
<span>{$t('search.tracks')}</span>
|
||||
</button>
|
||||
<button
|
||||
@@ -786,9 +820,15 @@
|
||||
class:active={activeTab === 'artists'}
|
||||
onclick={() => handleTabChange('artists')}
|
||||
>
|
||||
<Mic2 size={18} />
|
||||
<span>{$t('search.artists')}</span>
|
||||
</button>
|
||||
<button
|
||||
class="tab"
|
||||
class:active={activeTab === 'playlists'}
|
||||
onclick={() => handleTabChange('playlists')}
|
||||
>
|
||||
<span>Playlists</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{#if hasResults}
|
||||
@@ -1370,6 +1410,31 @@
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Playlists Section (in unified view) -->
|
||||
{#if allResults.playlists && allResults.playlists.items.length > 0}
|
||||
<div class="playlists-section">
|
||||
<div class="section-header">
|
||||
<h3>Playlists</h3>
|
||||
<button class="view-all-link" onclick={() => handleTabChange('playlists')}>
|
||||
View all ({allResults.playlists.total})
|
||||
</button>
|
||||
</div>
|
||||
<div class="playlists-preview-grid">
|
||||
{#each allResults.playlists.items.slice(0, 6) as playlist}
|
||||
<SearchPlaylistCard
|
||||
{playlist}
|
||||
onclick={() => onPlaylistClick?.(playlist.id)}
|
||||
onPlay={() => onPlaylistPlay?.(playlist.id)}
|
||||
onPlayNext={() => onPlaylistPlayNext?.(playlist.id)}
|
||||
onPlayLater={() => onPlaylistPlayLater?.(playlist.id)}
|
||||
onCopyToLibrary={() => onPlaylistCopyToLibrary?.(playlist.id)}
|
||||
onShareQobuz={() => onPlaylistShareQobuz?.(playlist.id)}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{:else if activeTab === 'albums' && albumResults}
|
||||
{#if albumResults.items.length === 0}
|
||||
@@ -1551,6 +1616,32 @@
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{:else if activeTab === 'playlists' && playlistResults}
|
||||
{#if playlistResults.items.length === 0}
|
||||
<div class="no-results">No playlists found for "{query}"</div>
|
||||
{:else}
|
||||
<div class="playlists-grid">
|
||||
{#each playlistResults.items as playlist}
|
||||
<SearchPlaylistCard
|
||||
{playlist}
|
||||
onclick={() => onPlaylistClick?.(playlist.id)}
|
||||
onPlay={() => onPlaylistPlay?.(playlist.id)}
|
||||
onPlayNext={() => onPlaylistPlayNext?.(playlist.id)}
|
||||
onPlayLater={() => onPlaylistPlayLater?.(playlist.id)}
|
||||
onCopyToLibrary={() => onPlaylistCopyToLibrary?.(playlist.id)}
|
||||
onShareQobuz={() => onPlaylistShareQobuz?.(playlist.id)}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
{#if hasMorePlaylists}
|
||||
<div class="load-more-container">
|
||||
<button class="load-more-btn" onclick={loadMore} disabled={isLoadingMore}>
|
||||
{isLoadingMore ? $t('actions.loading') : $t('artist.loadMore') + ` (${playlistResults.items.length} / ${playlistResults.total})`}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1720,14 +1811,13 @@
|
||||
|
||||
.tabs {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.tab {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 10px 16px;
|
||||
padding: 10px 12px;
|
||||
background: none;
|
||||
border: none;
|
||||
border-bottom: 2px solid transparent;
|
||||
@@ -1760,7 +1850,7 @@
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary);
|
||||
transition: color 150ms ease;
|
||||
}
|
||||
@@ -1966,6 +2056,23 @@
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.playlists-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(162px, 1fr));
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.playlists-section {
|
||||
margin-top: 32px;
|
||||
}
|
||||
|
||||
.playlists-preview-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(162px, 1fr));
|
||||
gap: 24px;
|
||||
max-width: calc(162px * 6 + 24px * 5);
|
||||
}
|
||||
|
||||
.artist-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export type SearchTab = 'all' | 'albums' | 'tracks' | 'artists';
|
||||
export type SearchTab = 'all' | 'albums' | 'tracks' | 'artists' | 'playlists';
|
||||
|
||||
// Search filter types supported by Qobuz API
|
||||
export type SearchFilterType = 'MainArtist' | 'Performer' | 'Composer' | 'Label' | 'ReleaseName' | null;
|
||||
@@ -16,10 +16,27 @@ export type MostPopularItem<Album, Track, Artist> =
|
||||
| { type: 'tracks'; content: Track }
|
||||
| { type: 'artists'; content: Artist };
|
||||
|
||||
export interface Playlist {
|
||||
id: number;
|
||||
name: string;
|
||||
description?: string;
|
||||
owner: { id: number; name: string };
|
||||
images?: string[];
|
||||
images150?: string[];
|
||||
images300?: string[];
|
||||
tracks_count: number;
|
||||
duration: number;
|
||||
is_public: boolean;
|
||||
genres?: { id: number; name: string; slug?: string }[];
|
||||
slug?: string;
|
||||
users_count?: number;
|
||||
}
|
||||
|
||||
export interface SearchAllResults<Album, Track, Artist> {
|
||||
albums: SearchResults<Album>;
|
||||
tracks: SearchResults<Track>;
|
||||
artists: SearchResults<Artist>;
|
||||
playlists: SearchResults<Playlist>;
|
||||
most_popular: MostPopularItem<Album, Track, Artist> | null;
|
||||
}
|
||||
|
||||
@@ -30,6 +47,7 @@ export interface SearchState<Album, Track, Artist> {
|
||||
albumResults: SearchResults<Album> | null;
|
||||
trackResults: SearchResults<Track> | null;
|
||||
artistResults: SearchResults<Artist> | null;
|
||||
playlistResults: SearchResults<Playlist> | null;
|
||||
allResults: SearchAllResults<Album, Track, Artist> | null;
|
||||
}
|
||||
|
||||
@@ -40,6 +58,7 @@ let searchState: SearchState<unknown, unknown, unknown> = {
|
||||
albumResults: null,
|
||||
trackResults: null,
|
||||
artistResults: null,
|
||||
playlistResults: null,
|
||||
allResults: null,
|
||||
};
|
||||
|
||||
@@ -96,6 +115,7 @@ export function clearSearchState(): void {
|
||||
albumResults: null,
|
||||
trackResults: null,
|
||||
artistResults: null,
|
||||
playlistResults: null,
|
||||
allResults: null,
|
||||
};
|
||||
queryListeners.forEach(fn => fn(''));
|
||||
|
||||
Reference in new issue
Block a user