diff --git a/webui/static/script.js b/webui/static/script.js index a08b209d..bc59183e 100644 --- a/webui/static/script.js +++ b/webui/static/script.js @@ -1251,21 +1251,71 @@ async function openPersonalSettings() { const lbData = await lbRes.json(); const spotifyData = await spotifyRes.json(); - // Build sections body.innerHTML = ''; - // Spotify + Tidal + server library per-profile only shown for non-admin profiles - if (currentProfile && !currentProfile.is_admin) { - renderPersonalSettingsSpotify(body, spotifyData); - renderPersonalSettingsTidal(body); - try { - const libRes = await fetch('/api/profiles/me/server-library'); - const libData = await libRes.json(); - renderPersonalSettingsServerLibrary(body, libData); - } catch (e) { - console.debug('Failed to load server library settings:', e); - } + const isNonAdmin = currentProfile && !currentProfile.is_admin; + + if (isNonAdmin) { + // Tabbed layout for non-admin with multiple sections + const tabs = [ + { id: 'music', label: 'Music Services' }, + { id: 'server', label: 'Server' }, + { id: 'scrobble', label: 'Scrobbling' }, + ]; + const tabBar = document.createElement('div'); + tabBar.className = 'ps-tabbar'; + tabs.forEach((t, i) => { + const btn = document.createElement('button'); + btn.className = 'ps-tab' + (i === 0 ? ' active' : ''); + btn.textContent = t.label; + btn.onclick = () => { + tabBar.querySelectorAll('.ps-tab').forEach(b => b.classList.remove('active')); + btn.classList.add('active'); + body.querySelectorAll('.ps-tab-content').forEach(c => c.classList.remove('active')); + const target = document.getElementById(`ps-tab-${t.id}`); + if (target) target.classList.add('active'); + }; + tabBar.appendChild(btn); + }); + body.appendChild(tabBar); + + // Music Services tab + const musicTab = document.createElement('div'); + musicTab.id = 'ps-tab-music'; + musicTab.className = 'ps-tab-content active'; + renderPersonalSettingsSpotify(musicTab, spotifyData); + renderPersonalSettingsTidal(musicTab); + body.appendChild(musicTab); + + // Server tab + const serverTab = document.createElement('div'); + serverTab.id = 'ps-tab-server'; + serverTab.className = 'ps-tab-content'; + serverTab.innerHTML = '