diff --git a/public/assets/my.js b/public/assets/my.js index 58e887b..4947ca5 100644 --- a/public/assets/my.js +++ b/public/assets/my.js @@ -236,6 +236,36 @@ // opts per (default 25); tail: a selector for a drawer that follows its row and pages // with it; focus: a row predicate, opens on whichever page holds that row const PAGE_SIZE = 25; + // My line is the longest page on the dashboard: its lists page at 10 (Marty, 2026-09-26) + const LINE_PER = 10; + // Section pills at the top of My line: one per visible card marked data-jump, the one in view lit up. + // Cards that show or hide themselves (sponsor, upline messages) rebuild the row when they change. + let lineJumpObs = null; + function buildLineJump() { + const nav = document.getElementById('lineJump'); const pane = document.getElementById('pane-line'); if (!nav || !pane) return; + const cards = [...pane.querySelectorAll(':scope > .card[data-jump]')].filter(c => !c.hidden); + nav.innerHTML = cards.map(c => '').join(''); + nav.hidden = cards.length < 2; + const top = document.querySelector('.bo-top'); nav.style.setProperty('--jumpTop', (top ? top.offsetHeight : 0) + 'px'); pane.style.setProperty('--jumpTop', (top ? top.offsetHeight : 0) + 'px'); + nav.querySelectorAll('[data-jumpto]').forEach(b => b.addEventListener('click', () => { + const c = document.getElementById(b.dataset.jumpto); if (!c) return; + c.scrollIntoView({ behavior: 'smooth', block: 'start' }); + nav.querySelectorAll('.chip-t').forEach(x => x.classList.toggle('on', x === b)); + })); + if (lineJumpObs) lineJumpObs.disconnect(); + if ('IntersectionObserver' in window) { + const seen = new Map(); + lineJumpObs = new IntersectionObserver(ents => { + for (const e of ents) seen.set(e.target.id, e.isIntersecting ? e.boundingClientRect.top : null); + let best = null; for (const [id, t] of seen) if (t != null && (best == null || t < seen.get(best))) best = id; + if (best) { nav.querySelectorAll('.chip-t').forEach(x => x.classList.toggle('on', x.dataset.jumpto === best)); const on = nav.querySelector('.chip-t.on'); if (on && nav.scrollWidth > nav.clientWidth) nav.scrollLeft = on.offsetLeft - 16; } + }, { rootMargin: '-120px 0px -55% 0px' }); + cards.forEach(c => lineJumpObs.observe(c)); + } + } + { const pane = document.getElementById('pane-line'); + if (pane && 'MutationObserver' in window) new MutationObserver(() => buildLineJump()).observe(pane, { subtree: false, childList: false, attributes: true, attributeFilter: ['hidden'] }); + if (pane) pane.querySelectorAll(':scope > .card[data-jump]').forEach(c => { if ('MutationObserver' in window) new MutationObserver(() => buildLineJump()).observe(c, { attributes: true, attributeFilter: ['hidden'] }); }); } const PAGE_AT = {}; function pageList(key, host, rowSel, opts) { if (!host) return; opts = opts || {}; const per = opts.per || PAGE_SIZE; @@ -602,7 +632,7 @@ + '' + new Date(r.joined).toLocaleDateString() + '' + '' + r.status + '').join(''); wrap.appendChild(t); - pageList('roster', wrap, 'table.roster tr'); + pageList('roster', wrap, 'table.roster tr', { per: LINE_PER }); } // overview recent-activity widget: chain events + line joins, newest first try { @@ -697,7 +727,7 @@ if (name === 'earn') setEarnSub(earnSub); // refresh whichever sub-tab is active else if (vidState.token) stopVideo(); if (name === 'profile') loadLineBanner(); - if (name === 'line') { loadLineage(); loadUplineMessages(); loadCoach(); loadLinkStats(); loadProspects(); } + if (name === 'line') { buildLineJump(); loadLineage(); loadUplineMessages(); loadCoach(); loadLinkStats(); loadProspects(); } if (name === 'campaigns') ['cTarget', 'cImage', 'cVideoUrl'].forEach(id => { if ($(id)) $(id).value = ''; }); // no residual URL between visits if (name === 'training') loadTraining(); if (name === 'pipeline') loadPipeline(); @@ -1457,6 +1487,7 @@ + 'joined ' + ago(w.joined) + '' + 'last sign-in: ' + ago(w.lastSeen) + '' + (r.eligible ? '' : '') + '').join(''); + pageList('tank', el, ':scope > .lin-row', { per: LINE_PER }); el.querySelectorAll('[data-adopt]').forEach(b => b.addEventListener('click', async () => { const note = await IAP.ask({ title: 'Adopt ' + b.dataset.aname, text: 'Your first message to ' + b.dataset.aname + ' (sent as a chat and an email):', type: 'textarea', ok: 'Adopt and send', value: 'Hi, I picked you up from the InstantAdPay holding tank so you have a sponsor who will actually help. Reply here and I will walk you through the first three steps.' }); if (note === null) return; @@ -1548,6 +1579,7 @@ + (x.free && x.address ? ' ' : '') + (x.free && x.rescue ? ' ' : '') + (x.free ? ' ' : '') + '').join(''); + pageList('coach', el, ':scope > .lin-row', { per: LINE_PER }); el.querySelectorAll('[data-contacted]').forEach(b => b.addEventListener('click', async () => { try { await api('/api/my/tank/contacted', { email: b.dataset.contacted }); IAP.status('Marked: you have contacted ' + b.dataset.cname + '.', 'ok'); loadCoach(); } catch (e) { IAP.status(e.message, 'bad'); } @@ -1610,7 +1642,9 @@ st.innerHTML = src.length ? 'SourceViews (30d)Views (all)JoinedQualifying buyers' + src.map(x => '' + esc(x.source) + '' + x.views30 + '' + x.views + '' + x.joins + '' + x.buyers + '').join('') : 'Sources appear as visits arrive.'; + pageList('linksrc', st.parentElement, 'table tr:has(td)', { per: LINE_PER }); } + pageList('linkangles', t.parentElement, 'table tr:has(td)', { per: LINE_PER }); } catch (e) {} } // ── prospects: the member's own follow-up list ── @@ -1704,6 +1738,7 @@ + '' + ''; }).join(''); const save = async (id, patch) => { const p = list.find(x => x.id === Number(id)); if (!p) return; try { await api('/api/my/prospects', Object.assign({}, p, patch)); } catch (e) { IAP.status(e.message, 'bad'); } }; + pageList('prospects', el, ':scope > .lin-row', { per: LINE_PER }); el.querySelectorAll('[data-pstatus]').forEach(s => s.addEventListener('change', () => save(s.dataset.pstatus, { status: s.value }))); el.querySelectorAll('[data-pnext]').forEach(i => i.addEventListener('change', () => save(i.dataset.pnext, { next: i.value, nextTs: i.value ? Date.parse(i.value + 'T12:00:00') : null }))); el.querySelectorAll('[data-pdel]').forEach(b => b.addEventListener('click', async () => { try { await api('/api/my/prospects/remove', { id: b.dataset.pdel }); loadProspects(); } catch (e) { IAP.status(e.message, 'bad'); } })); @@ -1768,7 +1803,7 @@ b.addEventListener('click', () => openConvo(b.dataset.cemail, b.dataset.cname))); el.querySelectorAll('[data-act]').forEach(b => b.addEventListener('click', () => toggleLineActivity(b))); const focusRef = LINE_FOCUS_REF ? LINE_FOCUS_REF.replace(/"/g, '') : null; - el.querySelectorAll('.lin-lvl').forEach((lv, i) => pageList('line-' + i, lv, ':scope > .lin-row', { tail: '.lin-act', focus: focusRef ? row => !!row.querySelector('[data-act="' + focusRef + '"]') : null })); + el.querySelectorAll('.lin-lvl').forEach((lv, i) => pageList('line-' + i, lv, ':scope > .lin-row', { per: LINE_PER, tail: '.lin-act', focus: focusRef ? row => !!row.querySelector('[data-act="' + focusRef + '"]') : null })); if (LINE_FOCUS_REF) { const ref = LINE_FOCUS_REF; LINE_FOCUS_REF = null; const b = el.querySelector('[data-act="' + ref.replace(/"/g, '') + '"]'); @@ -1813,6 +1848,7 @@ + '
' + esc(i.subject) + '' + '' + esc(i.fromName) + ' · ' + new Date(i.sent).toLocaleDateString() + '
' + '
' + (i.body || '') + '
').join(''); + pageList('upmsg', list, ':scope > .promo-block', { per: 5 }); // opening the pane marks them read for (const i of r.items) if (!i.read) fetch('/api/my/messages/' + i.id + '/read', { method: 'POST' }).catch(() => {}); } catch (e) {} diff --git a/public/assets/site.css b/public/assets/site.css index 4369e20..2596b65 100644 --- a/public/assets/site.css +++ b/public/assets/site.css @@ -790,3 +790,11 @@ img{max-width:100%} /* Five Dollar Friday strip (landing) */ .fdf{margin:18px auto 0;max-width:760px;padding:12px 16px;border-radius:12px;background:rgba(67,232,195,.08);border:1px solid rgba(67,232,195,.35);color:var(--ink,#eafffa);font-size:14px;line-height:1.5;text-align:center} .fdf a{color:#43e8c3;font-weight:600} + +/* My line: section pills, sticky under the top bar (Marty, 2026-09-26) */ +.line-jump{position:sticky;top:var(--jumpTop,64px);z-index:4;margin:0 0 14px;padding:10px 0;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none; + background:rgba(6,10,8,.88);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);border-bottom:1px solid var(--line)} +.line-jump::-webkit-scrollbar{display:none} +.line-jump .chip-t{flex:none;white-space:nowrap} +#pane-line > .card[data-jump]{scroll-margin-top:calc(var(--jumpTop,64px) + 64px)} +.tablewrap > .pgr{margin-top:10px} diff --git a/public/my.html b/public/my.html index 3831fd3..2907be7 100644 --- a/public/my.html +++ b/public/my.html @@ -5,7 +5,7 @@ Member area | InstantAdPay - + @@ -289,13 +289,15 @@