// Renders the site art with Playwright (local only) in the seed-catalog look: the mark (svg + 192 png), the OG share image, the // Telegram proof cards (public/art/proof/ypb-proof-{plate,bed}.png) and the promo kit (public/art/kit/ypb--.png, // 3 angles x 8 shapes, ad-blocker-neutral names). The hero (licensed kie art) and paper grain (licensed Envato) are embedded. // node tools/art.mjs (PLAYWRIGHT = path to the playwright package) import fs from 'node:fs'; import path from 'node:path'; import { createRequire } from 'node:module'; import { fileURLToPath } from 'node:url'; const require = createRequire(import.meta.url); const APP = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); const PW = process.env.PLAYWRIGHT || 'D:/Projects/MarketingAgent/qa-tester/node_modules/playwright'; const { chromium } = require(PW); const { SHAPES } = require(path.join(APP, 'promokit.js')); const ART = path.join(APP, 'public', 'art'); fs.mkdirSync(path.join(ART, 'kit'), { recursive: true }); fs.mkdirSync(path.join(ART, 'proof'), { recursive: true }); const b64 = f => fs.readFileSync(path.join(ART, f)).toString('base64'); const HERO = 'data:image/webp;base64,' + b64('hero-botanical-illustration.webp'), GRAIN = 'data:image/jpeg;base64,' + b64('paper-grain.jpg'); const ICONS = JSON.parse(fs.readFileSync(path.join(APP, 'public', 'assets', 'icons.js'), 'utf8').replace(/^[\s\S]*?window\.YPBI = /, '').replace(/;\s*$/, '')); const MARK = s => ``; fs.writeFileSync(path.join(ART, 'mark.svg'), MARK(34)); const FONTS = ''; const CSS = `*{box-sizing:border-box;margin:0}html,body{width:100%;height:100%;overflow:hidden} body{font-family:'Atkinson Hyperlegible',sans-serif;color:#12291F;background:#F6FAF1 url(${GRAIN});background-size:620px} .h{font-family:'Young Serif',serif;line-height:1.04}.h em{font-style:normal;color:#C24A08} .m{font-family:'Martian Mono',monospace;font-weight:600;letter-spacing:.1em;text-transform:uppercase} .plate{background:linear-gradient(90deg,rgba(246,250,241,.96) 0%,rgba(246,250,241,.9) 38%,rgba(246,250,241,0) 66%),url(${HERO}) right center/cover no-repeat} .ink{background:#12291F;color:#F6FAF1}.ink .h em{color:#FFB27A} .butter{background:#FFE6A0} .btn{display:inline-block;background:#F2620F;color:#fff;border-radius:999px;font-weight:700;white-space:nowrap} .ic svg{width:100%;height:100%;display:block}.ic{color:#22844A} .wm{font-family:'Young Serif',serif;white-space:nowrap;display:flex;align-items:center;gap:.35em}`; const page = (w, h, body, cls) => `${FONTS}${body}`; const ic = (k, s) => `${ICONS[k]}`; const ANG = { plant: { kick: 'Open to every program', h: 'Bring your program. The network grows it.', s: 'Plant it free in the Seed Bed', cta: 'Plant it free', icon: 'iconGardening', cls: 'plate' }, grow: { kick: 'The Seed Bed', h: 'Save your ID. Your link first.', s: 'Everyone you bring sees your referral link first', cta: 'Save my IDs', icon: 'iconSprout', cls: 'ink' }, spot: { kick: 'One-time, paid in POL', h: 'Spotlight a packet.', s: '1,000 guaranteed views at the top of the Seed Bed', cta: 'Spotlight it', icon: 'iconEvolution', cls: 'butter' } }; function creative(a, shape) { const [w, h] = SHAPES[shape]; const A = ANG[a]; const k = Math.min(w, h); const wm = sz => `
${MARK(Math.round(sz * 1.3))}YourProgramBuilder
`; if (shape === 'tile') return page(w, h, `
${MARK(30)}
${A.h.replace(/.*<\/em>/, '')}
${A.cta}
`, A.cls === 'plate' ? '' : A.cls); if (h <= 90) return page(w, h, `
${MARK(h - 26)}
${A.h}
${h >= 90 ? `
${A.s}
` : ''}
${A.cta}
`, A.cls === 'plate' ? '' : A.cls); if (shape === 'tower') return page(w, h, `
${MARK(44)}
${A.kick}
${A.h}
${ic(A.icon, 90)}
${A.s}
${A.cta}
`, A.cls === 'plate' ? '' : A.cls); const big = w >= 1000; const fs1 = big ? (shape === 'square' ? 88 : 66) : Math.round(k / 8.5); return page(w, h, `
${wm(Math.round(k / (big ? 22 : 15)))}
${A.kick}
${A.h}
${A.s}
${A.cta}
`, A.cls); } const b = await chromium.launch(); const ctx = await b.newContext({ deviceScaleFactor: 1 }); const pg = await ctx.newPage(); async function shot(html, w, h, out) { await pg.setViewportSize({ width: w, height: h }); await pg.setContent(html, { waitUntil: 'networkidle' }); await pg.evaluate(() => document.fonts.ready); await pg.screenshot({ path: out, type: 'png' }); } await shot(page(192, 192, `
${MARK(160)}
`), 192, 192, path.join(ART, 'icon-192.png')); await shot(page(1200, 630, `
${MARK(52)}YourProgramBuilder
Bring your program. The network grows it.
Plant it free in the Seed Bed. Members save their IDs. The ones that grow move into the builder.
`, 'plate'), 1200, 630, path.join(ART, 'og-share.png')); for (const [n, cls] of [['plate', 'plate'], ['bed', 'ink']]) await shot(page(1200, 630, `
${MARK(52)}YourProgramBuilder
A Spotlight was just bought
Split on chain, in the same transaction.
20% sponsor, 5% each levels 2 to 5. Verify it on Polygonscan.
`, cls), 1200, 630, path.join(ART, 'proof', 'ypb-proof-' + n + '.png')); let n = 0; for (const a of Object.keys(ANG)) for (const s of Object.keys(SHAPES)) { const [w, h] = SHAPES[s]; await shot(creative(a, s), w, h, path.join(ART, 'kit', 'ypb-' + a + '-' + s + '.png')); n++; } await b.close(); console.log('art written:', n, 'kit creatives + icon, og, 2 proof cards');