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:
@@ -52,7 +52,8 @@ function designFrom(body, cur) {
|
||||
const palette = body.palette != null ? style.paletteKey(body.palette) : (body.niche != null && preset ? preset.palette : style.paletteKey(cur.palette));
|
||||
const design = body.design != null ? style.designKey(body.design) : (body.niche != null && preset ? preset.design : style.designKey(cur.design));
|
||||
const layout = body.layout != null ? style.layoutKey(body.layout) : style.layoutKey(cur.layout || (body.niche != null && preset ? 'split' : 'stack'));
|
||||
return { palette, design, layout, niche };
|
||||
const hero = body.niche != null && body.niche !== cur.niche ? 0 : style.heroIndex(niche, body.hero != null ? body.hero : cur.hero);
|
||||
return { palette, design, layout, niche, hero };
|
||||
}
|
||||
async function create(owner, body) {
|
||||
if (J.db.pages.filter(p => p.owner === norm(owner)).length >= 200) return { error: 'That is a lot of pages. Remove some first.' };
|
||||
@@ -68,7 +69,7 @@ async function update(owner, id, body) {
|
||||
if (body.remove) { J.db.pages = J.db.pages.filter(x => x !== p); J.save(); return { ok: true, removed: true }; }
|
||||
if (body.title != null) p.title = String(body.title).trim().slice(0, 100) || p.title;
|
||||
if (body.type != null && TYPES.includes(body.type)) p.type = body.type;
|
||||
if (body.palette != null || body.design != null || body.layout != null || body.niche != null) p.design = designFrom(body, p.design || {});
|
||||
if (body.palette != null || body.design != null || body.layout != null || body.niche != null || body.hero != null) p.design = designFrom(body, p.design || {});
|
||||
if (body.angle != null) p.angle = String(body.angle).slice(0, 160);
|
||||
if (body.content != null) { const c = sanitizeContent(Object.assign({}, p.content, body.content), p.type); if (p.type === 'squeeze' && c.formEmbed) { const why = formrestyle.problem(c.formEmbed); if (why) return { error: why }; } p.content = c; }
|
||||
if (body.status != null) { if (body.status === 'published') { if (!p.content.headline) return { error: 'Give the page a headline before publishing.' }; if (p.type !== 'squeeze' && !p.content.cta.url) return { error: 'Add the button link (where the page sends people) before publishing.' }; p.status = 'published'; } else p.status = 'draft'; }
|
||||
|
||||
Reference in New Issue
Block a user