[object Object]

← back to Wallco Ai

fix(design page): gate theme1/theme2 toggle to admin-only

c26ba53e922d052535580ca1f700f712454f363a · 2026-05-29 13:01:34 -0700 · Steve Abrams

Per Steve 2026-05-29 'all for the admin account level' — public visitors
were seeing the placeholder theme2 styling and the toggle UI. Now the
entire block (data-page-theme attr, scoped CSS, toggle UI, persistence JS)
renders ONLY when _isAdmin is true. Public users see vanilla theme1
markup with no toggle.

Files touched

Diff

commit c26ba53e922d052535580ca1f700f712454f363a
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Fri May 29 13:01:34 2026 -0700

    fix(design page): gate theme1/theme2 toggle to admin-only
    
    Per Steve 2026-05-29 'all for the admin account level' — public visitors
    were seeing the placeholder theme2 styling and the toggle UI. Now the
    entire block (data-page-theme attr, scoped CSS, toggle UI, persistence JS)
    renders ONLY when _isAdmin is true. Public users see vanilla theme1
    markup with no toggle.
---
 server.js | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/server.js b/server.js
index 8621556..fa7bdb9 100644
--- a/server.js
+++ b/server.js
@@ -11351,11 +11351,13 @@ app.get('/design/:id', (req, res) => {
   })}
 <body>
 ${htmlHeader('/designs')}
-<main class="detail-main" id="detail-main" data-page-theme="theme2">
-<!-- Theme toggle (theme1 / theme2). Server-renders data-page-theme="theme2"
-     so theme2 is the default on first load (Steve 2026-05-28). The inline
-     script below upgrades to theme1 only when localStorage says so. Scope
-     is the product page only — does NOT touch global data-theme light/dark. -->
+<main class="detail-main" id="detail-main"${_isAdmin ? ' data-page-theme="theme2"' : ''}>
+${_isAdmin ? `
+<!-- Theme toggle (theme1 / theme2) — ADMIN-ONLY preview surface
+     (Steve 2026-05-29: "all for the admin account level"). Public visitors
+     see vanilla theme1 (no attribute, no CSS overrides, no toggle UI, no JS).
+     Admins see theme2 by default + toggle to flip. Scope stays at
+     #detail-main; never touches global data-theme light/dark. -->
 <style id="page-theme-css">
   #detail-main[data-page-theme="theme2"]{
     --bg:         #ffffff;
@@ -11379,7 +11381,7 @@ ${htmlHeader('/designs')}
     background:var(--card-bg); border:1px solid var(--line); box-shadow:none;
   }
   #page-theme-toggle{
-    position:fixed; top:${_isAdmin ? '60px' : '14px'}; right:14px; z-index:90;
+    position:fixed; top:60px; right:14px; z-index:90;
     display:inline-flex; gap:0; align-items:center;
     background:rgba(255,255,255,.92); border:1px solid #d8d2c5;
     border-radius:999px; padding:3px; backdrop-filter:blur(6px);
@@ -11424,6 +11426,7 @@ ${htmlHeader('/designs')}
   });
 })();
 </script>
+` : ''}
 ${_isAdmin ? `
 <!-- Admin quick-action toolbar — Steve 2026-05-28: surface unpublish/fix/etsy
      prominently on the front-end instead of buried in the Distribute drawer.

← b75d7f3 audit: bulk Bad 39 flagged-live designs from haiku full-swee  ·  back to Wallco Ai  ·  fix(blank-guard): un-blank 3510/3529 (imperial-garden colorw 925a444 →