web-player: use playlist totals from the API, cache genres and parallelize explore requests

This commit is contained in:
2026-09-24 05:21:29 +02:00
parent b011ccdd5b
commit e89463fb83
10 changed files with 61 additions and 84 deletions
+6 -14
View File
@@ -1,15 +1,6 @@
import { describe, expect, it } from 'vitest';
import type { components } from '$lib/api/schema';
import {
toAlbum,
toDatedTrack,
toLikedTrack,
toMix,
toPage,
toPlaylist,
toPlaylistSummary,
toTrack
} from './mappers';
import { toAlbum, toDatedTrack, toLikedTrack, toMix, toPage, toPlaylist, toTrack } from './mappers';
const trackDto: components['schemas']['TrackApplicationResponse'] = {
id: 't1',
@@ -107,24 +98,25 @@ describe('toPlaylist', () => {
largeImageKeyName: null,
ownerUserId: '42',
visibility: 'Public',
trackCount: '7',
durationSeconds: '90.5',
createdAt: '',
updatedAt: 'u',
coverTrackIds: []
};
it('drops storage keys', () => {
it('drops storage keys and normalizes totals', () => {
expect(toPlaylist(dto)).toEqual({
id: 'p1',
name: 'List',
description: 'd',
visibility: 'Public',
ownerUserId: '42',
trackCount: 7,
durationSeconds: 90.5,
coverTrackIds: [],
updatedAt: 'u'
});
});
it('adds the track count in summaries', () => {
expect(toPlaylistSummary(dto, 7).trackCount).toBe(7);
});
});
describe('toPage', () => {