Pages: niche hero SETS (4 photographic heroes per niche served from /niches, thumbnail picker in the Look panel, design.hero index) + new Gaming niche

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-08 14:41:29 -05:00
parent f59b3d2771
commit 9f4c913ae6
33 changed files with 23 additions and 16 deletions
+1
View File
@@ -49,6 +49,7 @@
// the Look panel: niche preset, design, colours, layout. Each change saves at once and the gallery/preview refresh.
const d = p.design || {}; const setLook = async patch => { try { await api('/api/my/pages/' + p.id, patch); load(true); } catch (e) { toast(e.message, true); } };
const ns = $('niche'); ns.innerHTML = '<option value="">None (set it yourself)</option>' + STYLES.niches.map(n => '<option value="' + n.key + '"' + (d.niche === n.key ? ' selected' : '') + '>' + esc(n.label) + ' \u00b7 ' + esc(n.blurb) + '</option>').join(''); ns.onchange = () => setLook({ niche: ns.value });
{ const nn = STYLES.niches.find(n => n.key === d.niche); const row = $('heroRow'); if (nn && nn.heroes && nn.heroes.length > 1 && row) { row.hidden = false; $('heroes').innerHTML = nn.heroes.map((u, i) => '<button type="button" data-h="' + i + '" class="' + ((Number(d.hero) || 0) === i ? 'on' : '') + '" title="Hero ' + (i + 1) + '"><img src="' + esc(u) + '" alt="" loading="lazy"></button>').join(''); $('heroes').querySelectorAll('button').forEach(b => b.addEventListener('click', () => setLook({ hero: Number(b.dataset.h) }))); } else if (row) row.hidden = true; }
$('designs').innerHTML = STYLES.designs.map(x => '<button type="button" data-d="' + x.key + '" class="' + (d.design === x.key ? 'on' : '') + '" title="' + esc(x.blurb) + '">' + esc(x.label) + '</button>').join('');
$('designs').querySelectorAll('button').forEach(b => b.addEventListener('click', () => setLook({ design: b.dataset.d })));
$('pal').innerHTML = STYLES.palettes.map(x => '<button type="button" data-p="' + x.key + '" class="' + (d.palette === x.key ? 'on' : '') + '" title="' + esc(x.label + ', ' + x.sub) + '">' + x.swatch.map(col => '<i style="background:' + col + '"></i>').join('') + '</button>').join('');