From e89b4e5a5ce3df04a12ed9f5c784a95f83546516 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 12 Mar 2026 03:19:37 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20test=20role=20switcher=20in=20sidebar?= =?UTF-8?q?=20(admin=20only)=20=E2=80=94=20amber=20banner=20when=20imperso?= =?UTF-8?q?nating?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- portal/templates/layouts/app.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/portal/templates/layouts/app.html b/portal/templates/layouts/app.html index c60a05a..d1a0d1b 100644 --- a/portal/templates/layouts/app.html +++ b/portal/templates/layouts/app.html @@ -18,6 +18,7 @@ {{block "header-left" .}} Dealspace {{end}} +
{{block "header-right-extra" .}}{{end}} @@ -82,6 +83,22 @@ function escHtml(s) { if (!s) return ''; const d = document.createElement('div'); d.textContent = s; return d.innerHTML; } // Theme switcher + function setTestRole(role) { + localStorage.setItem('ds_test_role', role); + document.getElementById('testRoleSelect').value = role; + // Show banner when impersonating + const banner = document.getElementById('testRoleBanner'); + if (banner) { banner.textContent = role ? '⚠ Viewing as: ' + role : ''; banner.style.display = role ? 'block' : 'none'; } + } + // Restore test role select on load + (function(){ + const r = localStorage.getItem('ds_test_role') || ''; + const sel = document.getElementById('testRoleSelect'); + if (sel) sel.value = r; + const banner = document.getElementById('testRoleBanner'); + if (banner && r) { banner.textContent = '⚠ Viewing as: ' + r; banner.style.display = 'block'; } + })(); + function setTheme(t){document.documentElement.setAttribute('data-theme',t);localStorage.setItem('ds_theme',t);document.querySelectorAll('#ds-theme-bar button').forEach(b=>b.classList.toggle('active',b.getAttribute('data-t')===t))} setTheme(localStorage.getItem('ds_theme')||'midnight');