6385e753d0
New kit shapes rendered from HTML in the site's own look by tools/art.mjs (a shape list now renders only those shapes and leaves the other art alone). Listed in promokit.js SHAPES, so /promote, /api/promo-kit and InstantAdPay's Network sites tab show them. Smoke test counts updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
98 lines
13 KiB
JavaScript
98 lines
13 KiB
JavaScript
// Renders the site art with Playwright (local only): the icon, the OG share image, the Telegram proof cards
|
|
// (public/art/proof/vab-proof-{royal,daylight,navy}.png) and the promo kit (public/art/kit/vab-<angle>-<shape>.png, 3 angles x 8
|
|
// shapes, ad-blocker-neutral names). Copy facts come from config.js (Boost price + views) and promokit.js (angles, shapes).
|
|
// The look is the site's "daylight cyberpunk" (approved 2026-11-14): royal blue panels, gold, red pill CTA, slanted condensed type.
|
|
// node tools/art.mjs (PLAYWRIGHT = path to the playwright package)
|
|
// node tools/art.mjs --only panel (only those kit shapes, comma list; the icon, OG and proof art are left alone)
|
|
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 C = require(path.join(APP, 'config.js')).get();
|
|
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 FONTS = '<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@1,700;1,800&family=Chakra+Petch:wght@600;700&family=Inter:wght@500;600;700&family=JetBrains+Mono:wght@700&display=swap">';
|
|
const BASE = `*{box-sizing:border-box;margin:0}html,body{width:100%;height:100%;overflow:hidden}
|
|
body{background:#0A2FA8;color:#fff;font-family:Inter,sans-serif;position:relative}
|
|
body>*{position:relative}body>.net{position:absolute;inset:0;width:100%;height:100%;opacity:.22}
|
|
.wm{font-family:'Chakra Petch',sans-serif;font-weight:700;letter-spacing:.02em;white-space:nowrap}.wm b{color:#E3141E}.wm.ondark b{color:#FFC21A}
|
|
.mono{font-family:'JetBrains Mono',monospace;font-weight:700}
|
|
.disp{font-family:'Barlow Condensed',sans-serif;font-weight:800;font-style:italic;text-transform:uppercase;line-height:.92}
|
|
.gold{color:#FFC21A}.sh{text-shadow:3px 3px 0 #061A66}.shg{text-shadow:2px 2px 0 #8A5A00,4px 4px 0 #061A66}
|
|
.tick{background:#0A1F6B;border-bottom:3px solid #3D8BFF;color:#E9FBFF;font-family:'JetBrains Mono',monospace;white-space:nowrap;overflow:hidden}
|
|
.tick b{color:#FFC21A}.tick i{font-style:normal;color:#7DB2FF}
|
|
.pill{display:inline-block;background:#E3141E;color:#fff;border:3px solid #fff;border-radius:999px;font-family:'Barlow Condensed',sans-serif;font-weight:800;font-style:italic;text-transform:uppercase;box-shadow:0 4px 0 #8E0C12;white-space:nowrap;line-height:1.05}
|
|
.rib{display:inline-block;background:#E3141E;color:#fff;font-family:'Barlow Condensed',sans-serif;font-weight:800;font-style:italic;text-transform:uppercase;transform:skewX(-12deg);box-shadow:3px 3px 0 #061A66;white-space:nowrap}
|
|
.cut{clip-path:polygon(0 0,calc(100% - 8px) 0,100% 8px,100% 100%,8px 100%,0 calc(100% - 8px))}
|
|
.scr{display:flex;flex-direction:column;align-items:center;justify-content:center;color:#fff}.scr span{white-space:nowrap}`;
|
|
const NET = '<svg class="net" viewBox="0 0 600 400" preserveAspectRatio="none"><g stroke="#9DBEFF" stroke-width="1.4" fill="none"><path d="M0 300 Q150 180 300 240 T600 120"/><path d="M0 220 Q200 90 360 160 T600 40"/><path d="M40 400 L220 120 L420 260 L600 60"/></g><g fill="#FFC21A"><circle cx="220" cy="120" r="5"/><circle cx="420" cy="260" r="5"/><circle cx="360" cy="160" r="4"/><circle cx="300" cy="240" r="4"/><circle cx="520" cy="90" r="5"/></g></svg>';
|
|
const WM = (px, dark) => `<span class="wm${dark ? ' ondark' : ''}" style="font-size:${px}px">VIRAL<b>AD</b>BLITZ</span>`;
|
|
const views = Number(C.boost.views).toLocaleString('en-US');
|
|
const ANG = {
|
|
free: { k: 'FREE FOR NETWORK MEMBERS', h1: 'Post your text ad', h2: 'free', s: 'It runs on your page and your team\'s pages.', cta: 'Post my free ad' },
|
|
spread: { k: 'FIVE LEVELS DEEP', h1: 'Spread your ad', h2: '5 levels deep', s: 'Everyone you bring in shows your ad, five levels down.', cta: 'Get my page' },
|
|
boost: { k: 'ONE-TIME BOOST', h1: '$' + C.boost.usd + ' Boost', h2: views + ' views', s: views + ' guaranteed network views. Starred on the live ticker. Never a subscription.', cta: 'Boost my ad' }
|
|
};
|
|
const TICK = '<b>★ BOOSTED</b> One link for every offer · <i>▲ LIVE</i> Free traffic tools for affiliates · <i>▲ LIVE</i> Build a list with one page · ';
|
|
const screens = f => `<div style="display:flex;align-items:flex-end;gap:${Math.round(6 * f)}px">
|
|
<div class="scr cut" style="flex:1;background:#1F66FF;border:${Math.max(2, Math.round(2 * f))}px solid #9DBEFF;padding:${Math.round(8 * f)}px 4px"><span class="disp" style="font-size:${Math.round(15 * f)}px">YOUR AD</span><span style="font-size:${Math.round(8 * f)}px;font-weight:700">level 1</span></div>
|
|
<div class="scr cut" style="flex:1.35;background:#FFC21A;color:#0A1F6B;border:${Math.max(2, Math.round(2 * f))}px solid #fff;padding:${Math.round(13 * f)}px 4px"><span class="disp" style="font-size:${Math.round(21 * f)}px;color:#0A1F6B">YOUR AD</span><span style="font-size:${Math.round(9 * f)}px;font-weight:700;color:#0A1F6B">your page</span></div>
|
|
<div class="scr cut" style="flex:1;background:#6B2BD9;border:${Math.max(2, Math.round(2 * f))}px solid #C7A8FF;padding:${Math.round(8 * f)}px 4px"><span class="disp" style="font-size:${Math.round(15 * f)}px">YOUR AD</span><span style="font-size:${Math.round(8 * f)}px;font-weight:700">level 5</span></div></div>`;
|
|
function kitHtml(angle, shape, w, h) {
|
|
const a = ANG[angle]; const m = Math.min(w, h);
|
|
if (shape === 'tile') return `<body style="display:flex;flex-direction:column;justify-content:space-between;padding:8px;border:3px solid #FFC21A">${NET}${WM(12, true)}<div class="disp" style="font-size:${angle === 'spread' ? 23 : 25}px"><span class="sh">${angle === 'boost' ? '$' + C.boost.usd + ' =' : angle === 'free' ? 'Free' : '5 levels'}</span><br><span class="gold shg">${angle === 'boost' ? views + ' views' : angle === 'free' ? 'text ad' : 'deep'}</span></div><div class="mono" style="font-size:9px;color:#fff">viraladblitz.com</div></body>`;
|
|
if (shape === 'strip' || shape === 'leader') {
|
|
const big = shape === 'leader';
|
|
return `<body style="display:flex;align-items:center;gap:${big ? 16 : 9}px;padding:0 ${big ? 16 : 9}px;border-bottom:3px solid #FFC21A">${NET}<div style="flex:0 0 auto">${WM(big ? 20 : 13, true)}</div><div style="flex:1;min-width:0"><div class="mono" style="font-size:${big ? 11 : 8}px;letter-spacing:1px;color:#7DB2FF">${a.k}</div><div class="disp" style="font-size:${big ? 36 : 22}px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis"><span class="sh">${a.h1}</span> <span class="gold shg">${a.h2}</span></div></div><span class="pill" style="font-size:${big ? 21 : 13}px;padding:${big ? '6px 16px' : '3px 9px'};flex:0 0 auto;border-width:${big ? 3 : 2}px">${a.cta} »</span></body>`;
|
|
}
|
|
if (shape === 'tower') return `<body style="display:flex;flex-direction:column">${NET}<div class="tick" style="font-size:10px;padding:6px 4px">${TICK}</div><div style="padding:14px 12px;display:flex;flex-direction:column;gap:14px;flex:1">${WM(17, true)}<div class="mono" style="font-size:10px;letter-spacing:1px;color:#7DB2FF">${a.k}</div><div class="disp" style="font-size:38px"><span class="sh">${a.h1}</span><br><span class="gold shg">${a.h2}</span></div><div style="font-size:13px;color:#E3EBFF;line-height:1.4">${a.s}</div>${screens(.62)}<div style="margin-top:auto;text-align:center"><span class="pill" style="font-size:19px;padding:6px 12px;display:block">${a.cta} »</span><div class="mono" style="font-size:10px;margin-top:10px">viraladblitz.com</div></div></div></body>`;
|
|
// box, panel (336x280, scaled from the box), social, square
|
|
const f = m / 250; const wide = shape === 'social';
|
|
return `<body style="display:flex;flex-direction:column">${NET}<div class="tick" style="font-size:${Math.round(10 * f)}px;padding:${Math.round(6 * f)}px ${Math.round(8 * f)}px">${TICK + TICK}</div>
|
|
<div style="flex:1;padding:${Math.round(14 * f)}px ${Math.round(16 * f)}px;display:flex;gap:${Math.round(16 * f)}px;align-items:center">
|
|
<div style="flex:1.3;min-width:0;display:flex;flex-direction:column;gap:${Math.round(8 * f)}px">
|
|
${WM(Math.round(15 * f), true)}
|
|
<div class="disp" style="font-size:${Math.round((wide ? 46 : 36) * f)}px"><span class="sh">${a.h1}</span><br><span class="gold shg">${a.h2}</span></div>
|
|
<div><span class="rib" style="font-size:${Math.round(12 * f)}px;padding:${Math.round(3 * f)}px ${Math.round(10 * f)}px">${a.k}</span></div>
|
|
<div style="font-size:${Math.round(11 * f)}px;color:#E3EBFF;line-height:1.35">${a.s}</div>
|
|
<div style="display:flex;align-items:center;gap:${Math.round(10 * f)}px;margin-top:${Math.round(4 * f)}px;flex-wrap:wrap"><span class="pill" style="font-size:${Math.round(16 * f)}px;padding:${Math.round(4 * f)}px ${Math.round(13 * f)}px;border-width:${Math.max(2, Math.round(2 * f))}px">${a.cta} »</span><span class="mono" style="font-size:${Math.round(9 * f)}px">viraladblitz.com</span></div></div>
|
|
${wide ? `<div style="flex:1;min-width:0">${screens(f * 1.05)}</div>` : ''}</div></body>`;
|
|
}
|
|
function proofHtml(variant) {
|
|
const V = { royal: { bg: '#0A2FA8', ink: '#fff', acc: '#FFC21A' }, daylight: { bg: '#EAF0FF', ink: '#0A1F6B', acc: '#C4111A' }, navy: { bg: '#0A1F6B', ink: '#fff', acc: '#FFC21A' } }[variant];
|
|
return `<body style="background:${V.bg};color:${V.ink};display:flex;flex-direction:column">${variant === 'daylight' ? '' : NET}<div class="tick" style="font-size:20px;padding:12px 16px">${TICK + TICK}</div>
|
|
<div style="flex:1;padding:44px 60px;display:flex;flex-direction:column;gap:20px;justify-content:center">
|
|
<div style="display:flex;align-items:center;gap:18px">${WM(48, variant !== 'daylight')}<span class="mono" style="font-size:18px;color:${variant === 'daylight' ? '#fff' : '#0A1F6B'};background:${variant === 'daylight' ? '#0A1F6B' : '#FFC21A'};padding:6px 12px">PAID ON-CHAIN</span></div>
|
|
<div class="disp" style="font-size:86px;${variant === 'daylight' ? 'color:#0A1F6B' : ''}"><span${variant === 'daylight' ? '' : ' class="sh"'}>A Boost was just</span><br><span style="color:${variant === 'navy' ? '#fff' : V.acc};${variant === 'daylight' ? '' : 'text-shadow:3px 3px 0 #061A66'}">paid out on-chain</span></div>
|
|
<div><span class="rib" style="font-size:30px;padding:6px 22px">Up to 5 sponsor levels x 10% · same transaction</span></div>
|
|
<div style="font-size:22px;font-weight:600;opacity:.9">Every Boost and every payout: viraladblitz.com/ledger</div></div></body>`;
|
|
}
|
|
const ogHtml = () => `<body style="display:flex;flex-direction:column">${NET}<div class="tick" style="font-size:20px;padding:12px 16px">${TICK + TICK}</div><div style="flex:1;padding:40px 60px;display:flex;gap:40px;align-items:center">
|
|
<div style="flex:1.25;display:flex;flex-direction:column;gap:20px">${WM(34, true)}<div class="disp" style="font-size:96px"><span class="sh">Spread your ad</span><br><span class="gold shg">5 levels deep</span></div>
|
|
<div><span class="rib" style="font-size:30px;padding:6px 22px">The network's text ad wire</span></div>
|
|
<div><span class="pill" style="font-size:34px;padding:8px 28px;border-width:4px">Post your free text ad »</span></div></div>
|
|
<div style="flex:1">${screens(2.1)}</div></div></body>`;
|
|
const iconHtml = () => `<body style="display:flex;align-items:center;justify-content:center;background:#EAF0FF"><img src="data:image/svg+xml;base64,${Buffer.from(fs.readFileSync(path.join(ART, 'mark.svg'))).toString('base64')}" style="width:192px;height:192px"></body>`;
|
|
|
|
const oi = process.argv.indexOf('--only'); const ONLY = oi > 0 ? process.argv[oi + 1].split(',') : null;
|
|
const browser = await chromium.launch(); let made = 0;
|
|
async function shot(html, w, h, out) {
|
|
const pg = await browser.newPage({ viewport: { width: w, height: h } });
|
|
await pg.setContent('<!doctype html><html><head><meta charset="utf-8">' + FONTS + '<style>' + BASE + '</style></head>' + html + '</html>', { waitUntil: 'networkidle' });
|
|
await pg.evaluate(() => document.fonts.ready); await pg.screenshot({ path: out, clip: { x: 0, y: 0, width: w, height: h } }); await pg.close(); made++;
|
|
}
|
|
if (!ONLY) {
|
|
await shot(iconHtml(), 192, 192, path.join(ART, 'icon-192.png'));
|
|
await shot(ogHtml(), 1200, 630, path.join(ART, 'og-share.png'));
|
|
for (const v of ['royal', 'daylight', 'navy']) await shot(proofHtml(v), 1200, 630, path.join(ART, 'proof', 'vab-proof-' + v + '.png'));
|
|
for (const old of ['amber', 'cream', 'green']) { try { fs.unlinkSync(path.join(ART, 'proof', 'vab-proof-' + old + '.png')); } catch (e) {} }
|
|
}
|
|
for (const angle of Object.keys(ANG)) for (const [shape, [w, h]] of Object.entries(SHAPES)) if (!ONLY || ONLY.includes(shape)) await shot(kitHtml(angle, shape, w, h), w, h, path.join(ART, 'kit', 'vab-' + angle + '-' + shape + '.png'));
|
|
await browser.close();
|
|
console.log(made + ' images rendered');
|