Merge solo Inbox into Earn credits as a sub-tab; unread badge on Earn menu item
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+21
-5
@@ -213,9 +213,9 @@
|
||||
}
|
||||
|
||||
// ── back-office menu: hash-routed panes ───────────────
|
||||
const PANES = ['overview', 'line', 'buy', 'campaigns', 'inbox', 'earn', 'earnings', 'promo', 'wallet', 'profile'];
|
||||
const PANES = ['overview', 'line', 'buy', 'campaigns', 'earn', 'earnings', 'promo', 'wallet', 'profile'];
|
||||
const TITLES = { overview: 'Overview', line: 'My line', buy: 'Buy packages', campaigns: 'Campaigns',
|
||||
inbox: 'Inbox', earn: 'Earn credits', earnings: 'Earnings', promo: 'Promo tools',
|
||||
earn: 'Earn credits', earnings: 'Earnings', promo: 'Promo tools',
|
||||
wallet: 'Wallet & account', profile: 'Profile' };
|
||||
function setPane(name) {
|
||||
if (!PANES.includes(name)) name = 'overview';
|
||||
@@ -226,7 +226,7 @@
|
||||
document.querySelectorAll('.bo-menu [data-pane]').forEach(b =>
|
||||
b.classList.toggle('on', b.dataset.pane === name));
|
||||
if ($('boTitle')) $('boTitle').textContent = TITLES[name];
|
||||
if (name === 'inbox') loadInbox();
|
||||
if (name === 'earn') setEarnSub(earnSub); // refresh whichever sub-tab is active
|
||||
if (name === 'profile') loadLineBanner();
|
||||
document.getElementById('memberArea').classList.remove('side-open'); // close mobile drawer
|
||||
if (location.hash !== '#' + name) history.replaceState(null, '', '#' + name);
|
||||
@@ -434,9 +434,25 @@
|
||||
// ── solo-ads inbox: list, read view, dwell-gated read reward ──
|
||||
let ibTimer = null;
|
||||
function setInboxBadge(n) {
|
||||
const b = $('inboxBadge');
|
||||
if (b) { b.hidden = !n; b.textContent = n; }
|
||||
for (const id of ['inboxBadge', 'inboxBadge2']) {
|
||||
const b = $(id);
|
||||
if (b) { b.hidden = !n; b.textContent = n; }
|
||||
}
|
||||
}
|
||||
// Earn credits sub-tabs: Watch ads | Inbox
|
||||
let earnSub = 'watch';
|
||||
function setEarnSub(which) {
|
||||
earnSub = which === 'inbox' ? 'inbox' : 'watch';
|
||||
const w = $('earn-watch'), i = $('earn-inbox');
|
||||
if (w) w.hidden = earnSub !== 'watch';
|
||||
if (i) i.hidden = earnSub !== 'inbox';
|
||||
document.querySelectorAll('.subtabs [data-earn]').forEach(b =>
|
||||
b.classList.toggle('on', b.dataset.earn === earnSub));
|
||||
if (earnSub === 'inbox') loadInbox();
|
||||
else earnRefresh();
|
||||
}
|
||||
document.querySelectorAll('.subtabs [data-earn]').forEach(b =>
|
||||
b.addEventListener('click', () => setEarnSub(b.dataset.earn)));
|
||||
async function loadInbox() {
|
||||
try {
|
||||
const r = await (await fetch('/api/my/inbox')).json();
|
||||
|
||||
@@ -357,6 +357,14 @@ textarea.ed-body{width:100%;min-height:180px;resize:vertical}
|
||||
.ed-body a,.ib-rich a{color:var(--mint)}
|
||||
.ed-body h3,.ib-rich h3,.ed-body h4,.ib-rich h4{margin:.5em 0 .3em}
|
||||
.ed-media{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:10px 0 0}
|
||||
/* ── earn sub-tabs (Watch ads | Inbox) ── */
|
||||
.subtabs{display:flex;gap:6px;margin:0 0 16px;border-bottom:1px solid var(--line);padding-bottom:0}
|
||||
.subtab{background:none;border:0;border-bottom:2px solid transparent;color:var(--muted);
|
||||
font:inherit;font-weight:700;font-size:14px;padding:8px 14px;cursor:pointer;margin-bottom:-1px;
|
||||
display:inline-flex;align-items:center;gap:7px}
|
||||
.subtab:hover{color:var(--ink)}
|
||||
.subtab.on{color:var(--mint);border-bottom-color:var(--mint)}
|
||||
.subtab .pill{position:static}
|
||||
/* ── solo-ads inbox ── */
|
||||
.bo-menu .pill{margin-left:auto;background:var(--amber);color:#1a1206;font-size:11px;font-weight:800;
|
||||
border-radius:999px;padding:1px 8px;line-height:1.5}
|
||||
|
||||
Reference in New Issue
Block a user