- Add search_all command to Rust backend (parallel search execution) - Create SearchAllResults type for unified search results - Add 'all' tab as new default in search view - Implement unified results layout: - Most Popular section (top artist or album) - Artists section (up to 5 artist cards) - Albums carousel (horizontal scroll, 10 albums) - Tracks section (top 8 tracks) - Add View all links to navigate to individual tabs - Update search state store to include allResults - Maintain existing tab functionality (albums, tracks, artists) - Add responsive grid layout for unified view cp
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
export type SearchTab = 'all' | 'albums' | 'tracks' | 'artists';
|
|
|
|
export interface SearchResults<T> {
|
|
items: T[];
|
|
total: number;
|
|
offset: number;
|
|
limit: number;
|
|
}
|
|
|
|
export interface SearchAllResults<Album, Track, Artist> {
|
|
albums: SearchResults<Album>;
|
|
tracks: SearchResults<Track>;
|
|
artists: SearchResults<Artist>;
|
|
}
|
|
|
|
export interface SearchState<Album, Track, Artist> {
|
|
query: string;
|
|
activeTab: SearchTab;
|
|
albumResults: SearchResults<Album> | null;
|
|
trackResults: SearchResults<Track> | null;
|
|
artistResults: SearchResults<Artist> | null;
|
|
allResults: SearchAllResults<Album, Track, Artist> | null;
|
|
}
|
|
|
|
let searchState: SearchState<unknown, unknown, unknown> = {
|
|
query: '',
|
|
activeTab: 'all',
|
|
albumResults: null,
|
|
trackResults: null,
|
|
artistResults: null,
|
|
allResults: null,
|
|
};
|
|
|
|
export function getSearchState<Album, Track, Artist>(): SearchState<Album, Track, Artist> {
|
|
return searchState as SearchState<Album, Track, Artist>;
|
|
}
|
|
|
|
export function setSearchState<Album, Track, Artist>(next: SearchState<Album, Track, Artist>): void {
|
|
searchState = next as SearchState<unknown, unknown, unknown>;
|
|
}
|