import { getItem, getArtistAlbums } from '../embyApi.js'; import { tileHtml, escapeHtml } from '../tiles.js'; /** Route `/artist/:id` - one artist's albums, reached from a music * library's top-level grid (see library.js) via a MusicArtist tile's * "Voir les albums" link (tiles.js's DRILL_DOWN table). Structurally the * same "detail header + grid" shape as series.js, just one level up the * music hierarchy (Artist -> Album, not Series -> Season/Episode) and * with no per-item action beyond drilling further into an album (an * artist has nothing itself to start a party from). */ export async function renderArtist(root, params) { const artistId = params.id; root.innerHTML = '

Chargement...

'; let artist; let albums; try { [artist, albums] = await Promise.all([getItem(artistId), getArtistAlbums(artistId)]); } catch (err) { root.innerHTML = '

Impossible de charger cet artiste.

'; return; } root.innerHTML = `
`; root.querySelector('#back').addEventListener('click', () => history.back()); const grid = root.querySelector('#grid'); grid.innerHTML = albums.length ? albums.map(tileHtml).join('') : '

Aucun album trouvé pour cet artiste.

'; }