feat: show 24 genre pills on desktop, 12 on mobile
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
6894e8a94a
commit
790f02e5b4
1 file changed
+3
-3
+3
-3
@@ -168,7 +168,7 @@ function _genreColor(name) {
|
|||||||
|
|
||||||
let _allGenres = [];
|
let _allGenres = [];
|
||||||
let _genresExpanded = false;
|
let _genresExpanded = false;
|
||||||
const GENRE_LIMIT = 15;
|
const GENRE_LIMIT = () => window.innerWidth >= 700 ? 24 : 12;
|
||||||
|
|
||||||
async function loadGenreSection() {
|
async function loadGenreSection() {
|
||||||
const el = document.getElementById('home-genres');
|
const el = document.getElementById('home-genres');
|
||||||
@@ -180,14 +180,14 @@ async function loadGenreSection() {
|
|||||||
.filter(g => (g.songCount || 0) > 0)
|
.filter(g => (g.songCount || 0) > 0)
|
||||||
.sort((a, b) => (b.songCount || 0) - (a.songCount || 0));
|
.sort((a, b) => (b.songCount || 0) - (a.songCount || 0));
|
||||||
_renderGenres();
|
_renderGenres();
|
||||||
if (_allGenres.length > GENRE_LIMIT && more) more.style.display = '';
|
if (_allGenres.length > GENRE_LIMIT() && more) more.style.display = '';
|
||||||
} catch { el.style.display = 'none'; }
|
} catch { el.style.display = 'none'; }
|
||||||
}
|
}
|
||||||
|
|
||||||
function _renderGenres() {
|
function _renderGenres() {
|
||||||
const el = document.getElementById('home-genres');
|
const el = document.getElementById('home-genres');
|
||||||
if (!el) return;
|
if (!el) return;
|
||||||
const list = _genresExpanded ? _allGenres : _allGenres.slice(0, GENRE_LIMIT);
|
const list = _genresExpanded ? _allGenres : _allGenres.slice(0, GENRE_LIMIT());
|
||||||
el.innerHTML = '';
|
el.innerHTML = '';
|
||||||
list.forEach(g => {
|
list.forEach(g => {
|
||||||
const card = document.createElement('div');
|
const card = document.createElement('div');
|
||||||
|
|||||||
Reference in new issue
Block a user