Files
viraladblitz/public/assets/front.js
T
martbost d611c4b251 Restyle ViralAdBlitz to the approved "daylight cyberpunk" look (Marty 2026-11-14)
Replaces the dark ink-green/amber newsroom look Marty rejected as too dark.
Look only: routes, ids, copy facts and the trust pack are unchanged.

- vab.css rewritten around CSS variables: #EAF0FF ground, white clipped
  cards, royal #0A1F6B bands/ticker, #0A2FA8 hero panels with network
  lines, red pill CTA, gold Boost/boosted, Barlow Condensed / Chakra Petch /
  Inter / JetBrains Mono. [hidden] now always wins over display rules.
- Front page: slanted hero, ribbon, green-check list, rising bars, three
  YOUR AD screens, gold chips; board tabs (verified clicks / on the wire /
  boosted, from data the page already has); Boost band; ledger chips.
- Member page: own ad as a hero panel, level rows with LEVEL chips, royal
  join bar. Rows are now labelled LEVEL 1 to LEVEL 5 in display order
  (Marty's decision); the real place is kept in the API as depth.
- My page becomes the dashboard: side menu, stat cards, my-ad card with
  LIVE/BOOSTED badges and a folded editor, line bars, Boost ring, recent
  activity, payouts. All figures from /api/my, nothing estimated.
- Boost, ledger, contract, promote, legal and admin pages restyled; 404 too.
- Default JOIN_URL is now https://instantadpay.com/join/{ref} (no ref
  falls back to the InstantAdPay home page).
- New mark, icon, OG image, 21 kit creatives and 3 proof cards
  (royal/daylight/navy) rendered by tools/art.mjs; asset tags bumped to v=4.
- smoke.mjs: new headline, level/depth and join URL checks, UI_FONTS=1.

Tests: qa/smoke.mjs 162/162, qa/chain.mjs 20/20 (local anvil).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 15:17:30 -06:00

37 lines
3.1 KiB
JavaScript

// Front page: the ticker, today's numbers, "Top ads this week" by verified clicks (with "On the wire" and "Boosted" views of the
// ads the ticker already shows), the live ledger and the contract box.
(async function () {
VAB.renderNav('/'); VAB.renderFooter();
const $ = VAB.$, esc = VAB.esc;
const d = await VAB.wire('front').catch(() => ({}));
const t = d.today || {};
$('stViews').textContent = VAB.n(t.views); $('stClicks').textContent = VAB.n(t.vclicks); $('stBoosts').textContent = VAB.n(t.boosts); $('stAds').textContent = VAB.n(t.ads);
const items = (d.board && d.board.items) || [];
const wireAds = d.ticker || [];
const views = {
clicks: () => items.length ? items.map(x => VAB.paper(x, '#' + x.rank, 'board', VAB.n(x.clicks) + ' verified click' + (x.clicks === 1 ? '' : 's'))).join('')
: '<p class="muted">No verified clicks yet this week. The first ad clicked by a verified visitor takes #1.</p>',
wire: () => wireAds.length ? wireAds.map(x => VAB.paper(x, x.boosted ? '' : 'LIVE', 'wire')).join('') : '<p class="muted">The wire is quiet. Post the first text ad.</p>',
boosted: () => { const b = wireAds.filter(x => x.boosted); return b.length ? b.map(x => VAB.paper(x, '', 'wire')).join('') : '<p class="muted">No Boosted ads on the wire right now. A Boost stars your ad here and on the ticker.</p>'; }
};
const show = k => {
$('boardCards').innerHTML = views[k]();
document.querySelectorAll('#board [data-sort]').forEach(b => { const on = b.dataset.sort === k; b.classList.toggle('on', on); b.setAttribute('aria-pressed', on ? 'true' : 'false'); });
VAB.decorate();
};
document.querySelectorAll('#board [data-sort]').forEach(b => { b.onclick = () => show(b.dataset.sort); });
show('clicks');
// the ledger: the newest Boost rows and their payouts
const L = await VAB.getJSON('/api/ledger?n=6').catch(() => ({}));
const ex = L.explorer || 'https://polygonscan.com';
const who = (a, nm) => nm ? '@' + esc(nm) : esc(VAB.short(a || ''));
const rows = [];
for (const r of (L.items || [])) {
const link = '<a href="' + esc(ex) + '/tx/' + esc(r.tx) + '" target="_blank" rel="noopener">verify</a>';
rows.push('<tr><td>' + VAB.when(r.at) + '</td><td><span class="chip red">Boost bought</span></td><td>' + who(r.buyer, r.buyerName) + '</td><td class="pol">' + VAB.polOf(r.weiPaid) + '</td><td>' + link + '</td></tr>');
for (const p of r.pays || []) if (p.level > 0) rows.push('<tr><td></td><td><span class="chip blue">Paid level ' + p.level + '</span>' + (p.failed ? ' <span class="small muted">(waiting to be claimed)</span>' : '') + '</td><td>' + (p.to ? who(p.to, p.name) : 'sponsor') + '</td><td class="pol">' + VAB.polOf(p.wei) + '</td><td>' + link + '</td></tr>');
}
$('ledgerMini').querySelector('tbody').innerHTML = rows.length ? rows.slice(0, 12).join('') : '<tr><td colspan="5" class="muted">No Boosts yet. The first one shows here within a minute of its transaction.</td></tr>';
if (L.contract) { $('cAddr').textContent = 'Polygon · ' + L.contract + ' · read it live'; $('cLink').textContent = 'View the contract proof'; }
})();