Ads screen layout by real width + Qualified Start positions on Credits (wallet switch fix)
Ads: the campaign table squeezed its empty-state note (and the first column) to a word or a letter per line beside the side cards. Container queries now stack the side cards under the table and turn rows into cards when the table cannot hold seven columns, whatever the rail state. cr.css: an empty-state row (one muted note) spans every column on every Control Room table. Wallet: Disconnect really lets go (keeps wagmi's disconnected marker, revokes the injected permission, next connect opens the account picker), so MetaMask no longer snaps back to the first account. Credits gains Switch account, Disconnect, Add a position wallet and a Buy from picker (ported from the classic Buy pane), so a member can add wallets #2..#5 and buy from each while staying signed in as themselves. Classic dashboard and Wallet screen copy point to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@
|
||||
<title>Admin | LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261011b">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261018a">
|
||||
<style>@import url("/assets/site.css?v=ls20260916a") layer(legacy);</style>
|
||||
<link rel="stylesheet" href="/assets/tools.css?v=20261008a">
|
||||
<link rel="stylesheet" href="/assets/admin.css?v=20261012a">
|
||||
|
||||
+14
-6
@@ -6,18 +6,26 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Ads · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261017p">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261018a">
|
||||
<style>
|
||||
.body{padding:16px 24px;display:grid;gap:16px}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:16px}
|
||||
.cl .hd,.cl .rw{grid-template-columns:minmax(0,1.4fr) minmax(0,1.4fr) 110px 80px 60px 110px 130px}
|
||||
/* layout by the space the screen really has (rail expanded or collapsed), not the viewport: the campaign table squeezed
|
||||
its first column to a word, then a letter, per line once the rail and the side cards took the width (tester, 2026-10-18) */
|
||||
.body{padding:16px 24px;display:grid;gap:16px;container:adsbody/inline-size}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:16px;align-items:start}
|
||||
.side{display:grid;gap:16px;align-content:start}
|
||||
.cl{container:camptbl/inline-size}
|
||||
.cl .hd,.cl .rw{grid-template-columns:minmax(150px,1.4fr) minmax(110px,1fr) 104px 64px 56px 96px 128px}
|
||||
/* side cards drop under the table once beside it the table would fall under its seven-column width */
|
||||
@container adsbody (max-width:1180px){.two{grid-template-columns:minmax(0,1fr)}.side{grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr))}}
|
||||
/* narrower than seven columns fit: each campaign becomes a two-column card */
|
||||
@container camptbl (max-width:820px){.cl .hd{display:none}.cl .rw{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.cl .rw > :first-child{grid-column:1/-1}.cl .rw > .r{text-align:left}.cl .rw > :nth-child(4)::before{content:"views "}.cl .rw > :nth-child(5)::before{content:"clicks "}.cl .rw > .r::before{color:var(--muted);font:700 10.5px var(--mono);letter-spacing:.08em;text-transform:uppercase}}
|
||||
.cl .rw > *{min-width:0;overflow-wrap:anywhere}
|
||||
.thumb{width:72px;height:36px;object-fit:contain;background:var(--inset);border:1px solid var(--chrome-line);border-radius:4px;display:block}
|
||||
.bar{margin-top:6px}
|
||||
.field{width:100%;box-sizing:border-box}
|
||||
#composer[hidden]{display:none}
|
||||
.where{display:grid;gap:9px}.where div{display:flex;gap:10px;align-items:flex-start}.where b{min-width:60px;color:var(--accent-hi);font:700 11px var(--mono);letter-spacing:.06em;text-transform:uppercase;padding-top:2px}
|
||||
@media (max-width:900px){.two{grid-template-columns:1fr}.cl .hd{display:none}.cl .rw{grid-template-columns:1fr 1fr}.body{padding:12px 16px}}
|
||||
@media (max-width:900px){.body{padding:12px 16px}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -54,7 +62,7 @@
|
||||
</div>
|
||||
<div class="two">
|
||||
<div class="tbl cl"><div class="hd"><span>Campaign</span><span>Creative</span><span>Budget</span><span class="r">Views</span><span class="r">Clicks</span><span>Status</span><span></span></div><div id="rows"></div><div class="ft" id="foot"></div></div>
|
||||
<div style="display:grid;gap:16px;align-content:start">
|
||||
<div class="side">
|
||||
<div class="panel"><h2>Earn credits</h2><div class="gauge" id="earnGauge"><i></i><i></i><i></i><i></i><i></i></div><div class="muted" id="earnLine" style="margin-top:8px">loading</div><div style="display:flex;gap:8px;flex-wrap:wrap;margin-top:12px"><button class="btn blue" type="button" id="earnNext">View an ad</button><button class="btn" type="button" id="earnClaim" hidden>Claim</button></div><div class="muted" id="earnNote" style="margin-top:8px"></div></div>
|
||||
<div class="panel"><h2>Where your ads run</h2><div class="where ink2"><div><b>Banner</b><span>the ad viewer here, every member zone on outside sites, and the partner network</span></div><div><b>Text</b><span>the ad viewer and the partner network</span></div><div><b>Login</b><span>full screen to every member right after they sign in, one sponsor a day</span></div></div><div class="muted" id="rateLine" style="margin-top:10px"></div></div>
|
||||
</div>
|
||||
|
||||
@@ -130,6 +130,8 @@ label.lbl{display:grid;gap:5px;font-size:10.5px;font-weight:700;letter-spacing:.
|
||||
.tbl .rw{position:relative;border-bottom:1px solid var(--line)} .tbl .rw:last-child{border-bottom:0}
|
||||
.tbl .rw:hover{background:rgba(31,111,235,.04)}
|
||||
.tbl .rw.on,.tbl .rw.hi-row{background:var(--hi-row)} .tbl .rw.on::before,.tbl .rw.hi-row::before{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--sig)}
|
||||
/* an empty-state row (one muted note) spans every column instead of wrapping inside the first */
|
||||
.tbl .rw > .muted:only-child{grid-column:1/-1}
|
||||
.tbl .ft{padding:9px 16px;border-top:1px solid var(--line);font-family:var(--mono);font-size:10.5px;color:var(--muted);background:var(--panel-2);letter-spacing:.02em}
|
||||
.r{text-align:right}
|
||||
.ph{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 14px;border-bottom:1px solid var(--line);background:repeating-linear-gradient(135deg,#EEF2F9 0 6px,#F5F7FC 6px 12px)}
|
||||
|
||||
@@ -9,7 +9,13 @@
|
||||
const pol = wei => { try { return (Number(BigInt(String(wei || '0')) / 10000000000000000n) / 100).toFixed(2); } catch (e) { return '0.00'; } };
|
||||
const usd = c => '$' + (Number(c || 0) / 100).toLocaleString(undefined, { maximumFractionDigits: 2 });
|
||||
const NAMES = { 1000: 'Door', 2500: 'Most chosen', 5000: 'Builder', 10000: 'Growth', 25000: 'Leader', 50000: 'Network' };
|
||||
let CFG = null, ME = null, CAT = [], SEL = null, CAMP = null, DASH = null;
|
||||
let CFG = null, ME = null, CAT = [], SEL = null, CAMP = null, DASH = null, POS = null, FROM = 'main';
|
||||
const short = a => String(a || '').slice(0, 6) + '…' + String(a || '').slice(-4);
|
||||
// Qualified Start (2026-10-18, ported from the classic Buy pane): extra wallets on this account, each its own position
|
||||
// under the main member. Testers could not buy from a second wallet here: the only control was a disconnect that
|
||||
// snapped back to the main wallet, and the buy insisted on the main wallet.
|
||||
const posList = () => (POS && Array.isArray(POS.positions)) ? POS.positions : [];
|
||||
const fromPos = () => FROM !== 'main' && posList().some(x => String(x.address).toLowerCase() === FROM) ? FROM : null;
|
||||
|
||||
function paintTiles() {
|
||||
const avail = CAMP ? CAMP.availableCredits : 0, inLive = CAMP ? CAMP.inCampaigns : 0;
|
||||
@@ -39,7 +45,19 @@
|
||||
$('rateLine').textContent = rate ? 'rate ' + rate.toFixed(4) + ' USD/POL · live from the oracle' : '';
|
||||
const addr = ME && ME.address;
|
||||
$('buyBtn').disabled = !p.costWei;
|
||||
$('buyBtn').textContent = addr ? 'Buy ' + usd(p.priceCents) + ' package' : 'Connect a wallet to buy';
|
||||
const fp = fromPos(), n = fp ? posList().findIndex(x => String(x.address).toLowerCase() === fp) + 2 : 0;
|
||||
$('buyBtn').textContent = addr ? 'Buy ' + usd(p.priceCents) + ' package' + (fp ? ' from position ' + n : '') : 'Connect a wallet to buy';
|
||||
}
|
||||
// "Buy from": the main wallet or one of the positions (shown once a position exists)
|
||||
function paintFrom() {
|
||||
const list = posList(), main = POS && POS.main;
|
||||
if (!fromPos()) FROM = 'main';
|
||||
$('fromWrap').hidden = !list.length;
|
||||
if (!list.length) return;
|
||||
$('buyFrom').innerHTML = '<option value="main">Main wallet ' + (ME && ME.address ? short(ME.address) : '') + (ME && ME.memberId ? ' · #' + ME.memberId : '') + (main && main.noPayout ? ' · linkage only' : '') + '</option>'
|
||||
+ list.map((x, i) => '<option value="' + esc(String(x.address).toLowerCase()) + '"' + (x.noPayout ? ' disabled' : '') + '>Position ' + (i + 2) + ' ' + short(x.address) + (x.memberId ? ' · #' + x.memberId : ' · not registered yet') + (x.noPayout ? ' · linkage only' : x.counted ? ' · counted' : '') + '</option>').join('');
|
||||
$('buyFrom').value = FROM;
|
||||
$('fromHint').textContent = fromPos() ? 'Your wallet app must be on this position\'s account when you confirm. Its first package registers it under you.' : 'Your wallet app must be on this account when you confirm.';
|
||||
}
|
||||
function paintGoes() {
|
||||
const p = sel(); if (!p) return;
|
||||
@@ -60,11 +78,43 @@
|
||||
? '<div class="code" style="display:block">' + esc(addr) + '</div>'
|
||||
+ (on ? '<div class="ok"><span class="dot"></span>Payouts on. Every package your people buy pays this wallet in the same transaction.</div>'
|
||||
: '<div class="ink2" style="font-size:13px">Linked, but payouts are off until this wallet is on the contract. Buying a package does that. So does the free activation below (gas only).</div><div class="acts"><button class="btn blue" type="button" id="activateBtn">Switch on payouts (free)</button></div>')
|
||||
+ '<div class="acts"><a class="btn sm" href="' + esc((CFG && CFG.explorer) || 'https://polygonscan.com') + '/address/' + esc(addr) + '" target="_blank" rel="noopener">Open on the explorer</a><button class="btn sm" type="button" id="relinkBtn">Use a different wallet</button></div>'
|
||||
+ '<div class="acts"><a class="btn sm" href="' + esc((CFG && CFG.explorer) || 'https://polygonscan.com') + '/address/' + esc(addr) + '" target="_blank" rel="noopener">Open on the explorer</a><button class="btn sm" type="button" id="switchBtn">Switch account</button><button class="btn sm" type="button" id="dropBtn">Disconnect</button></div>'
|
||||
+ posBlock()
|
||||
: '<div class="ink2" style="font-size:13px">Link the wallet that should receive your payouts. One free signature, no transaction. SafePal is the recommended wallet; MetaMask, Phantom and any WalletConnect wallet work too.</div><div class="acts"><button class="btn blue" type="button" id="linkBtn">Link a wallet</button><a class="btn sm" href="/wallets" target="_blank" rel="noopener">Wallet guide</a></div>';
|
||||
const lb = $('linkBtn'); if (lb) lb.addEventListener('click', () => guard(lb, linkWallet));
|
||||
const ab = $('activateBtn'); if (ab) ab.addEventListener('click', () => guard(ab, activate));
|
||||
const rb = $('relinkBtn'); if (rb) rb.addEventListener('click', () => guard(rb, async () => { await IAPWallet.disconnect(); CR.toast('Disconnected. Reloading so you can pick another wallet.'); setTimeout(() => location.reload(), 800); }));
|
||||
const sb = $('switchBtn'); if (sb) sb.addEventListener('click', () => guard(sb, switchAccount));
|
||||
const db = $('dropBtn'); if (db) db.addEventListener('click', () => guard(db, async () => { await IAPWallet.disconnect(); CR.toast('Disconnected. Your linked wallet stays on your account. The next purchase or Add a position wallet opens the account picker.'); }));
|
||||
const pb = $('addPosBtn'); if (pb) pb.addEventListener('click', () => guard(pb, addPosition));
|
||||
}
|
||||
function posBlock() {
|
||||
const list = posList(); const max = 5;
|
||||
return '<div style="border-top:1px solid var(--line);padding-top:10px;display:grid;gap:8px"><div style="font:700 10.5px var(--mono);letter-spacing:.1em;text-transform:uppercase;color:var(--muted)">Extra positions · Qualified Start</div>'
|
||||
+ list.map((x, i) => '<div class="row" style="padding:4px 0"><span>Position ' + (i + 2) + ' <span class="mono">' + esc(short(x.address)) + '</span></span><span class="mono muted" style="font-size:11.5px">' + (x.memberId ? '#' + x.memberId + (x.noPayout ? ' · linkage only' : x.counted ? ' · counted' : '') : 'buy to register') + '</span></div>').join('')
|
||||
+ '<div class="ink2" style="font-size:12.5px">Own another wallet? Add it as a position, then pick it under <b>Buy from</b> and buy a package marked qualifies. Each position that buys counts as a qualifying buyer for you, its credits pool with yours, and you stay signed in as you.</div>'
|
||||
+ (list.length < max ? '<div class="acts"><button class="btn blue sm" type="button" id="addPosBtn">Add a position wallet</button><span class="muted" style="font-size:11.5px">' + list.length + ' of ' + max + ' used</span></div>' : '<div class="muted" style="font-size:11.5px">All ' + max + ' positions are linked.</div>')
|
||||
+ '</div>';
|
||||
}
|
||||
// pick a different account in the wallet (MetaMask's account picker; a fresh session for WalletConnect) and say what it is
|
||||
async function switchAccount() {
|
||||
const a = String(await IAPWallet.pickAccount() || '').toLowerCase(); if (!a) return;
|
||||
const i = posList().findIndex(x => String(x.address).toLowerCase() === a);
|
||||
if (ME && a === String(ME.address || '').toLowerCase()) { FROM = 'main'; CR.toast('Connected as ' + short(a) + ', your main wallet.'); }
|
||||
else if (i >= 0) { FROM = a; CR.toast('Connected as ' + short(a) + ', position ' + (i + 2) + '. It is selected under Buy from.'); }
|
||||
else CR.toast('Connected as ' + short(a) + '. That account is not on LinkSpin yet. To buy from it, use Add a position wallet.');
|
||||
paintFrom(); paintQuote();
|
||||
}
|
||||
async function addPosition() {
|
||||
const me = await CR.me(true);
|
||||
if (!me.address) throw new Error('Link your main wallet first, then add positions under it.');
|
||||
if (!me.memberId) throw new Error('Switch on payouts for your main wallet first. Positions register under your member number.');
|
||||
const ok = await CR.dialog({ title: 'Add a position wallet', html: '<div class="ink2" style="display:grid;gap:8px"><div>Your wallet asks which account to connect. Choose <b>only the new account</b> (not ' + esc(short(me.address)) + '), then sign once. No transaction, no cost.</div><div>No second account yet? MetaMask: account menu, Add account. SafePal or Trust: create or switch wallet. Phone with WalletConnect: pick the other wallet app in the list.</div></div>', ok: 'Ready', no: 'Cancel' });
|
||||
if (!ok) return;
|
||||
CR.toast('Pick the new account in your wallet, then sign once…');
|
||||
const r = await IAPWallet.signIn({ asPosition: true, pick: true });
|
||||
FROM = String(r.address || '').toLowerCase();
|
||||
CR.toast('Position added: ' + short(r.address) + '. It is selected under Buy from. Pick a qualifying package and buy.');
|
||||
await load();
|
||||
}
|
||||
function paintBuys(E) {
|
||||
const buys = E && Array.isArray(E.purchases) ? E.purchases : [];
|
||||
@@ -99,14 +149,21 @@
|
||||
const p = sel(); if (!p || !p.costWei) return;
|
||||
$('holdBox').hidden = true;
|
||||
let me = await CR.me(true);
|
||||
if (!me.address) { CR.toast('Link your wallet first: one quick signature…'); await IAPWallet.signIn(); me = await CR.me(true); }
|
||||
const want = String(me.address || '').toLowerCase(); if (!want) throw new Error('No wallet linked.');
|
||||
// which wallet buys: the main one, or a position picked under "Buy from" (it registers under the main member id
|
||||
// on its first buy, so its sponsor is always this member)
|
||||
const fp = fromPos(), row = fp ? posList().find(x => String(x.address).toLowerCase() === fp) : (POS && POS.main);
|
||||
if (fp && !me.memberId) throw new Error('Switch on payouts for your main wallet first, so this position can register under you.');
|
||||
if (fp && p.priceCents < 2000 && !(await CR.dialog({ title: 'This package does not qualify', text: 'A ' + usd(p.priceCents) + ' package from a position adds credits but does not count toward your qualification. Pick a package marked qualifies to count this position.', ok: 'Buy anyway', no: 'Pick another' }))) return;
|
||||
if (row && row.noPayout) throw new Error('This ' + (fp ? 'position' : 'wallet') + ' is kept for linkage only. A purchase from it would pay a retired wallet. Buy from another one.');
|
||||
if (!fp && !me.address) { CR.toast('Link your wallet first: one quick signature…'); await IAPWallet.signIn(); me = await CR.me(true); }
|
||||
const want = fp || String(me.address || '').toLowerCase(); if (!want) throw new Error('No wallet linked.');
|
||||
// never buy from a wallet other than the one chosen: a stray wallet would register a brand-new member
|
||||
await IAPWallet.connect();
|
||||
let cur = String(await IAPWallet.activeAddress() || '').toLowerCase();
|
||||
if (cur !== want) { CR.toast('Pick ' + want.slice(0, 6) + '…' + want.slice(-4) + ' in your wallet\'s account picker…'); cur = String(await IAPWallet.pickAccount() || '').toLowerCase(); }
|
||||
if (cur !== want) throw new Error('Your wallet connected as ' + cur.slice(0, 6) + '…' + cur.slice(-4) + ' but your linked wallet is ' + want.slice(0, 6) + '…' + want.slice(-4) + '. Switch accounts in the wallet app and try again.');
|
||||
const sp = await CR.get('/api/sponsor?intent=buy');
|
||||
if (!me.memberId && sp.sponsorBlocked) { $('holdBox').textContent = holdText(sp); $('holdBox').hidden = false; return; }
|
||||
if (cur !== want) { CR.toast('Pick ' + short(want) + ' in your wallet\'s account picker…'); cur = String(await IAPWallet.pickAccount() || '').toLowerCase(); }
|
||||
if (cur !== want) throw new Error('Your wallet connected as ' + short(cur) + ' but you are buying from ' + short(want) + '. Switch accounts in the wallet app (or change Buy from) and try again.');
|
||||
const sp = fp ? { sponsorId: me.memberId } : await CR.get('/api/sponsor?intent=buy');
|
||||
if (!fp && !me.memberId && sp.sponsorBlocked) { $('holdBox').textContent = holdText(sp); $('holdBox').hidden = false; return; }
|
||||
try { // pre-flight: the POL has to be there; Trust Wallet refuses transactions that spend most of a balance
|
||||
const need = BigInt(p.costWei) + BigInt(p.costWei) / 50n;
|
||||
const bal = await IAPWallet.balance(want);
|
||||
@@ -120,10 +177,11 @@
|
||||
CR.toast('Confirm the purchase in your wallet…');
|
||||
const r = await IAPWallet.buy(Number(p.id), sp.sponsorId || 0, p.costWei);
|
||||
if (!r.receipt || r.receipt.status !== '0x1') throw new Error('Transaction reverted. Nothing was charged beyond gas.');
|
||||
CR.toast('Settled on-chain. Your credits are in Ads now.');
|
||||
CR.toast(fp ? 'Settled on-chain. That position now counts toward your qualification, and its credits pool with yours.' : 'Settled on-chain. Your credits are in Ads now.');
|
||||
await load();
|
||||
}
|
||||
$('buyBtn').addEventListener('click', () => guard($('buyBtn'), buy));
|
||||
$('buyFrom').addEventListener('change', () => { FROM = $('buyFrom').value || 'main'; paintFrom(); paintQuote(); });
|
||||
$('cardBtn').addEventListener('click', () => guard($('cardBtn'), async () => {
|
||||
const p = sel(); const need = p && p.costWei ? Math.max(10, Math.ceil(Number(BigInt(p.costWei) / 1000000000000000000n)) + 3) : 30;
|
||||
const q = '/api/moonpay-url?pol=' + need + (ME && ME.address ? '&address=' + encodeURIComponent(ME.address) : '');
|
||||
@@ -135,9 +193,10 @@
|
||||
try { [CFG, ME] = await Promise.all([CR.get('/api/config'), CR.me(true)]); } catch (e) { CR.sub('could not load'); return; }
|
||||
let cat = null, E = null;
|
||||
try { [cat, CAMP, DASH, E] = await Promise.all([CR.get('/api/catalog'), CR.get('/api/my/campaigns'), CR.get('/api/my/dashboard'), CR.get('/api/my/activity')]); } catch (e) {}
|
||||
try { POS = ME.address ? await CR.get('/api/my/positions') : null; } catch (e) { POS = null; }
|
||||
CAT = (cat && cat.products) || [];
|
||||
CR.sub((CAMP ? fmt(CAMP.availableCredits) + ' free to spend · ' + fmt(CAMP.inCampaigns) + ' in live ads' : '') + (CAT[0] && CAT[0].costWei ? '' : ' · price feed catching up'));
|
||||
paintTiles(); paintPkgs(); paintQuote(); paintGoes(); paintWallet(); paintBuys(E);
|
||||
paintTiles(); paintPkgs(); paintFrom(); paintQuote(); paintGoes(); paintWallet(); paintBuys(E);
|
||||
const spName = ME.sponsorName ? ('@' + String(ME.sponsorName).replace(/^@/, '')) : null;
|
||||
$('sponsorLine').innerHTML = spName
|
||||
? 'Your sponsor <b>' + esc(spName) + '</b> is placed on the contract. The moment you confirm, half of the package lands in their wallet and the rest splits as shown. Credits appear in Ads right away.'
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
$('payFoot').textContent = 'every line is a Polygon transaction · nothing is held by the site';
|
||||
const rows = Array.isArray(POS) ? POS : (POS && (POS.positions || POS.list)) || [];
|
||||
$('posRows').innerHTML = rows.length ? rows.map(p => '<div class="rw"><span><b>' + (p.main ? 'Main position' : 'Position') + '</b> <span class="mono muted">' + (p.memberId ? '#' + p.memberId : 'not on chain yet') + '</span><br><span class="mono muted" style="font-size:11px">' + esc(String(p.address || '').slice(0, 10)) + '…</span></span><span class="num">' + fmt(p.avail || 0) + '</span><span>' + (p.memberId ? '<span class="tag ok">ACTIVE</span>' : '<span class="tag dim">PENDING</span>') + '</span></div>').join('')
|
||||
: '<div class="rw"><span class="muted">' + (addr ? 'Main wallet only.' : 'No positions yet.') + '</span></div>';
|
||||
: '<div class="rw" style="grid-template-columns:1fr"><span class="muted">' + (addr ? 'Main wallet only. Own another wallet? <a href="/credits">Add it as a position on Credits</a> and buy from it to self-qualify.' : 'No positions yet.') + '</span></div>';
|
||||
}
|
||||
CR.requireSession(load);
|
||||
})();
|
||||
|
||||
+29
-8
@@ -113,13 +113,19 @@ window.IAPWallet = (function () {
|
||||
try {
|
||||
await inj.request({ method: 'wallet_requestPermissions', params: [{ eth_accounts: {} }] });
|
||||
const accs = await inj.request({ method: 'eth_accounts' });
|
||||
if (accs && accs[0]) { provider = inj; await ensureChain(c).catch(() => {}); return accs[0]; }
|
||||
if (accs && accs[0]) { provider = inj; clearPick(); await ensureChain(c).catch(() => {}); return accs[0]; }
|
||||
} catch (e) {
|
||||
if (e && (e.code === 4001 || /reject|denied/i.test(String(e.message || '')))) throw new Error('You closed the account picker. Pick the account you want and try again.');
|
||||
// closed the picker right after a Disconnect: they may want a different wallet app, so offer the full wallet list
|
||||
if (e && (e.code === 4001 || /reject|denied/i.test(String(e.message || ''))) && !pickPending()) throw new Error('You closed the account picker. Pick the account you want and try again.');
|
||||
}
|
||||
}
|
||||
return freshConnect(c);
|
||||
const a = await freshConnect(c, 'Pick the wallet to connect…'); clearPick(); return a;
|
||||
}
|
||||
// After Disconnect the next connect is a fresh choice (testers 2026-10-18: Disconnect, then the site snapped straight
|
||||
// back to the first MetaMask account, so a second wallet could never buy). The flag survives the reload some screens do.
|
||||
const PICK_KEY = 'ls.wallet.pick';
|
||||
const pickPending = () => { try { return localStorage.getItem(PICK_KEY) === '1'; } catch (e) { return false; } };
|
||||
function clearPick() { try { localStorage.removeItem(PICK_KEY); } catch (e) {} }
|
||||
|
||||
// A WalletConnect session can die underneath AppKit's cached "connected"
|
||||
// state: the wallet app rejects or kills it (Trust does this after its own
|
||||
@@ -128,9 +134,9 @@ window.IAPWallet = (function () {
|
||||
// Detect that, wipe the stale session, and re-open the picker for a fresh one.
|
||||
const DEAD_RE = /disconnect|not connected|no matching key|session (topic|expired|deleted|not found)|call connect|please call connect|missing or invalid|relay/i;
|
||||
const isDead = e => DEAD_RE.test(String((e && e.message) || e || ''));
|
||||
async function freshConnect(c) {
|
||||
try { IAP.status('Your wallet session dropped. Reconnect in the picker…'); } catch (e) {}
|
||||
await disconnect();
|
||||
async function freshConnect(c, msg) {
|
||||
try { IAP.status(msg || 'Your wallet session dropped. Reconnect in the picker…'); } catch (e) {}
|
||||
await dropSession();
|
||||
try { await modal.open(); } catch (e) {}
|
||||
const addr = await waitForConnection(180000);
|
||||
try { if (modal && modal.close) await modal.close(); } catch (e) {}
|
||||
@@ -142,6 +148,9 @@ window.IAPWallet = (function () {
|
||||
async function connect() {
|
||||
const c = await IAP.getConfig();
|
||||
await initAppKit(c);
|
||||
if (pickPending()) return pickAccount(); // the member pressed Disconnect: open the account picker, never the old session
|
||||
// an injected account chosen through pickAccount() is driven directly; AppKit may still hold (or lack) another one
|
||||
if (provider && provider === window.ethereum) { try { const a = await provider.request({ method: 'eth_accounts' }); if (a && a[0]) return a[0]; } catch (e) {} }
|
||||
let addr = currentAddress();
|
||||
if (!addr) {
|
||||
// give AppKit a moment to rehydrate an existing session before popping the
|
||||
@@ -269,12 +278,24 @@ window.IAPWallet = (function () {
|
||||
return { hash, receipt: await waitTx(hash) };
|
||||
}
|
||||
|
||||
async function disconnect() {
|
||||
// end the wallet session (a dead WalletConnect session, or the first half of a user Disconnect)
|
||||
async function dropSession() {
|
||||
// AppKit's disconnect can hang on the WalletConnect relay (esp. mobile) —
|
||||
// never block on it, so the UI can't get stuck "disconnecting".
|
||||
try { if (modal && modal.disconnect) await Promise.race([modal.disconnect(), new Promise(r => setTimeout(r, 1200))]); } catch (e) {}
|
||||
provider = null;
|
||||
try { Object.keys(localStorage).forEach(k => { if (/wc@2|walletconnect|w3m|wcm|reown|wagmi|appkit/i.test(k)) localStorage.removeItem(k); }); } catch (e) {}
|
||||
// keep wagmi/AppKit's own "user disconnected" markers: wiping them made the next page load auto-reconnect the
|
||||
// injected wallet (MetaMask still trusts the site), the snap-back testers hit on 2026-10-18
|
||||
try { Object.keys(localStorage).forEach(k => { if (/wc@2|walletconnect|w3m|wcm|reown|wagmi|appkit/i.test(k) && !/disconnected|connection_status/i.test(k)) localStorage.removeItem(k); }); } catch (e) {}
|
||||
}
|
||||
// the member's Disconnect: let go for real, so the next connect can be a different account or wallet.
|
||||
// MetaMask keeps the site's permission across a plain disconnect; wallet_revokePermissions drops it
|
||||
// (wallets without it just ignore the call), and the pick flag makes the next connect open the picker.
|
||||
async function disconnect() {
|
||||
try { localStorage.setItem(PICK_KEY, '1'); } catch (e) {}
|
||||
const inj = window.ethereum;
|
||||
if (inj && inj.request) { try { await Promise.race([inj.request({ method: 'wallet_revokePermissions', params: [{ eth_accounts: {} }] }), new Promise(r => setTimeout(r, 1000))]); } catch (e) {} }
|
||||
await dropSession();
|
||||
}
|
||||
|
||||
// native balance of the connected wallet (pre-flight check before a buy)
|
||||
|
||||
+5
-3
@@ -6,7 +6,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Credits · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261017p">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261018a">
|
||||
<style>
|
||||
.body{padding:16px 24px;display:grid;gap:16px}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:16px;align-items:start}
|
||||
@@ -24,6 +24,7 @@
|
||||
.row:last-child{border-bottom:0}
|
||||
.buys .hd,.buys .rw{grid-template-columns:150px 110px 130px minmax(0,1fr)}
|
||||
.acts{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
|
||||
.acts[hidden]{display:none}
|
||||
@media (max-width:900px){.two{grid-template-columns:1fr}.pkgs{grid-template-columns:repeat(2,minmax(0,1fr))}.buys .hd{display:none}.buys .rw{grid-template-columns:1fr 1fr}.body{padding:12px 16px}}
|
||||
</style>
|
||||
</head>
|
||||
@@ -41,6 +42,7 @@
|
||||
<span class="led"><span style="font-size:10px;letter-spacing:.1em;text-transform:uppercase">you pay</span><b id="payPol">·</b><span id="payUsd"></span></span>
|
||||
<span class="mono muted" style="font-size:11px" id="rateLine"></span>
|
||||
</div>
|
||||
<div class="acts" id="fromWrap" hidden><label class="lbl" style="min-width:min(100%,320px)">Buy from<select class="field" id="buyFrom"></select></label><span class="muted" style="font-size:12px" id="fromHint"></span></div>
|
||||
<div class="acts" id="buyActs">
|
||||
<button class="btn pri" type="button" id="buyBtn" disabled>Connect a wallet to buy</button>
|
||||
<button class="btn" type="button" id="cardBtn">Buy POL with a card</button>
|
||||
@@ -79,8 +81,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/common.js?v=20261016a"></script>
|
||||
<script src="/assets/wallet.js?v=20261008a"></script>
|
||||
<script src="/assets/wallet.js?v=20261018a"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261017p"></script>
|
||||
<script src="/assets/credits-screen.js?v=20261016a"></script>
|
||||
<script src="/assets/credits-screen.js?v=20261018a"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Help · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261017p">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261018a">
|
||||
<style>
|
||||
.body{padding:16px 24px;display:grid;gap:16px;max-width:980px}
|
||||
.hl .hd,.hl .rw{grid-template-columns:minmax(0,1fr) 150px 130px}.hl .rw{cursor:pointer}
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Links · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261017p">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261018a">
|
||||
<style>
|
||||
.ws{display:grid;grid-template-columns:320px minmax(0,1fr);min-height:calc(100vh - 94px)}
|
||||
.dbody .tiles{grid-template-columns:repeat(auto-fit,minmax(128px,1fr))}
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@
|
||||
<title>More · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261017p">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261018a">
|
||||
<style>@import url("/assets/site.css?v=ls20260916a") layer(legacy);</style>
|
||||
<link rel="stylesheet" href="/assets/tools.css?v=20261008a">
|
||||
</head>
|
||||
@@ -948,7 +948,7 @@
|
||||
<div class="card">
|
||||
<h3>Wallet connection</h3>
|
||||
<p class="small" style="border:1px solid var(--line-strong);border-radius:10px;padding:8px 12px;margin:0 0 10px"><b>Everything here is POL on the Polygon network.</b> Packages are paid in POL and every payout lands as POL in this wallet. No other coin or chain is used, so keep the wallet on Polygon and keep a little POL for gas.</p>
|
||||
<p class="muted small">Connected the wrong wallet, or stuck on a transaction prompt? Disconnect to clear the session, then reconnect or pick a different wallet.</p>
|
||||
<p class="muted small">Connected the wrong wallet, or stuck on a transaction prompt? Disconnect to clear the session, then reconnect or pick a different wallet. Your linked wallet stays on your account. To buy from a second wallet of your own, add it as a position on <a href="/credits">Credits</a>.</p>
|
||||
<p><button class="btn sec small" id="wcDisconnect" type="button">Disconnect wallet</button>
|
||||
<span class="small muted" id="wcDisconnectInfo"></span></p>
|
||||
</div>
|
||||
@@ -1010,7 +1010,7 @@
|
||||
<script src="/assets/common.js?v=20261016a"></script>
|
||||
<script src="/assets/cr-shell.js?v=20261017p"></script>
|
||||
<script src="/assets/tools.js?v=20261011a"></script>
|
||||
<script src="/assets/wallet.js?v=20261008a"></script>
|
||||
<script src="/assets/wallet.js?v=20261018a"></script>
|
||||
<script src="/assets/promo.js?v=20261009b"></script>
|
||||
<script src="/assets/my.js?v=20261016a"></script>
|
||||
<script src="/assets/chat.js?v=20261016a"></script>
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Pages · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261017p">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261018a">
|
||||
<style>
|
||||
.look{display:grid;gap:10px;margin:6px 0 10px}.lk-row{display:flex;gap:10px;align-items:flex-start}.lk-k{flex:none;width:64px;font:700 11px var(--mono);letter-spacing:.1em;text-transform:uppercase;color:var(--muted);padding-top:9px}
|
||||
.lk-opts{display:flex;gap:6px;flex-wrap:wrap}.lk-opts button{font:600 12px var(--body);padding:7px 10px;border-radius:7px;border:1px solid var(--line);background:transparent;color:var(--fg);cursor:pointer}.lk-opts button.on{border-color:var(--accent);background:rgba(59,157,255,.12)}
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Reports · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261017p">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261018a">
|
||||
<style>
|
||||
.body{padding:16px 24px;display:grid;gap:16px}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:16px}
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Traffic sources · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261017p">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261018a">
|
||||
<style>
|
||||
.ws{display:grid;grid-template-columns:320px minmax(0,1fr);min-height:calc(100vh - 94px)}
|
||||
.list{border-right:1px solid var(--line);display:flex;flex-direction:column;min-height:0;background:rgba(255,255,255,.55)}
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Team · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261017p">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261018a">
|
||||
<style>
|
||||
.body{padding:16px 24px;display:grid;gap:16px}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:16px}
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Wallet · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261017p">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261018a">
|
||||
<style>
|
||||
.body{padding:16px 24px;display:grid;gap:16px}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:16px}
|
||||
@@ -32,6 +32,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/cr-shell.js?v=20261017p"></script>
|
||||
<script src="/assets/wallet-screen.js?v=20261009a"></script>
|
||||
<script src="/assets/wallet-screen.js?v=20261018a"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Zones · LinkSpin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261017p">
|
||||
<link rel="stylesheet" href="/assets/cr.css?v=20261018a">
|
||||
<style>
|
||||
.body{padding:16px 24px;display:grid;gap:16px}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:16px}
|
||||
|
||||
Reference in New Issue
Block a user