66545bf8c3
Models: - history_event.dart (HistoryEvent + HistoryPage envelope) - quarantine_mine.dart (QuarantineMineRow for /api/quarantine/mine) - Renamed Page<T> -> Paged<T> to avoid collision with Material's Page Endpoints: - library_lists.dart: listArtists / listAlbums (paged) - me.dart: history + quarantineMine - likes.dart: extended with listTracks/Albums/Artists (paged) UI: - library_screen.dart: TabBar over 5 tabs - Artists tab: 3-col grid - Albums tab: 2-col grid - History tab: list with relative-time formatting (matches HistoryRow.svelte) - Liked tab: 3 stacked sections (artists scroll-row, albums scroll-row, tracks list) - Hidden tab: list of quarantined tracks with reason pill - /library route + library_music icon on home AppBar First page only for v1 (limit 50). Infinite scroll deferred.
39 lines
1.2 KiB
Dart
39 lines
1.2 KiB
Dart
import 'album.dart';
|
|
import 'artist.dart';
|
|
import 'page.dart';
|
|
import 'track.dart';
|
|
|
|
/// Mirrors internal/api/search.go SearchResponse — three pages keyed by
|
|
/// facet, each independently paged. The mobile UI usually only walks
|
|
/// the first page of each facet (limit 20-50); infinite scroll within a
|
|
/// facet is a future enhancement, not v1.
|
|
class SearchResponse {
|
|
const SearchResponse({
|
|
required this.artists,
|
|
required this.albums,
|
|
required this.tracks,
|
|
});
|
|
|
|
final Paged<ArtistRef> artists;
|
|
final Paged<AlbumRef> albums;
|
|
final Paged<TrackRef> tracks;
|
|
|
|
factory SearchResponse.fromJson(Map<String, dynamic> j) => SearchResponse(
|
|
artists: Paged.fromJson(
|
|
(j['artists'] as Map?)?.cast<String, dynamic>() ?? const {},
|
|
ArtistRef.fromJson,
|
|
),
|
|
albums: Paged.fromJson(
|
|
(j['albums'] as Map?)?.cast<String, dynamic>() ?? const {},
|
|
AlbumRef.fromJson,
|
|
),
|
|
tracks: Paged.fromJson(
|
|
(j['tracks'] as Map?)?.cast<String, dynamic>() ?? const {},
|
|
TrackRef.fromJson,
|
|
),
|
|
);
|
|
|
|
bool get isEmpty =>
|
|
artists.items.isEmpty && albums.items.isEmpty && tracks.items.isEmpty;
|
|
}
|