Show featured stations in search tab empty state
This commit is contained in:
parent
35d979a06a
commit
6c1d95ea90
2 changed files with 19 additions and 0 deletions
|
|
@ -831,6 +831,24 @@ const CURATED_LISTS = [
|
|||
function initCuratedLists() {
|
||||
const container = document.getElementById('curated-lists');
|
||||
if (!container) return;
|
||||
|
||||
if (INITIAL_FEATURED && INITIAL_FEATURED.length) {
|
||||
const section = document.createElement('div');
|
||||
section.className = 'curated-section';
|
||||
section.innerHTML = `<div class="curated-label">★ Featured</div>`;
|
||||
const ul = document.createElement('ul');
|
||||
ul.className = 'curated-stations';
|
||||
INITIAL_FEATURED.forEach(s => {
|
||||
const li = document.createElement('li');
|
||||
li.innerHTML = `<button class="btn btn-sm" onclick="playStation('${escapeAttr(s.url)}', '${escapeAttr(s.name)}', null)">▶</button>
|
||||
<span class="curated-name">${escapeHtml(s.name)}</span>
|
||||
${s.description ? `<span class="muted" style="font-size:0.78rem">${escapeHtml(s.description)}</span>` : ''}`;
|
||||
ul.appendChild(li);
|
||||
});
|
||||
section.appendChild(ul);
|
||||
container.appendChild(section);
|
||||
}
|
||||
|
||||
CURATED_LISTS.forEach(list => {
|
||||
const section = document.createElement('div');
|
||||
section.className = 'curated-section';
|
||||
|
|
|
|||
|
|
@ -202,6 +202,7 @@
|
|||
<script>
|
||||
// Pass Django context into JS
|
||||
const INITIAL_SAVED = {{ saved_stations|safe }};
|
||||
const INITIAL_FEATURED = {{ featured_stations|safe }};
|
||||
const IS_AUTHENTICATED = {{ user.is_authenticated|yesno:"true,false" }};
|
||||
</script>
|
||||
<script src="/static/js/app.js"></script>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue