From 31a6560e9ebddcd1b393c975a9302670649048c0 Mon Sep 17 00:00:00 2001 From: martbost Date: Mon, 7 Sep 2026 08:41:26 -0500 Subject: [PATCH] Training center: new members-area pane for videos + materials New "Training" nav pane lists curated lessons (inline video for mp4/webm, links for external videos and docs) from /api/training (admin-curated via data/training.json, with a sensible default). Co-Authored-By: Claude Opus 4.8 --- public/assets/my.js | 25 +++++++++++++++++++++++-- public/my.html | 12 +++++++++++- server.js | 11 +++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/public/assets/my.js b/public/assets/my.js index 7115c8c..29a911f 100644 --- a/public/assets/my.js +++ b/public/assets/my.js @@ -285,6 +285,26 @@ if (toast) { IAP.status(toast, kind); if (sound) playSound(sound); liveRefresh(); } } + // training center: videos + materials (admin-curated via data/training.json) + async function loadTraining() { + try { + const r = await (await fetch('/api/training')).json(); + const el = $('trainingList'); if (!el) return; + const items = r.items || []; + if (!items.length) { el.innerHTML = '

Training materials are being added. Check back soon.

'; return; } + el.innerHTML = items.map(it => { + const isVid = it.videoUrl && /\.(mp4|webm)(\?|$)/i.test(it.videoUrl); + const media = isVid ? '' : ''; + const links = []; + if (it.videoUrl && !isVid) links.push('Watch'); + if (it.docUrl) links.push('Open material'); + return '

' + esc(it.title || 'Lesson') + '

' + + (it.desc ? '

' + esc(it.desc) + '

' : '') + + (media ? '

' + media + '

' : '') + + (links.length ? '

' + links.join(' ') + '

' : '') + '
'; + }).join(''); + } catch (e) {} + } // visual line tree on the Overview: YOU + three levels, qualified directs in gold async function loadLineTree(buyerCount) { try { @@ -409,9 +429,9 @@ } // ── back-office menu: hash-routed panes ─────────────── - const PANES = ['overview', 'line', 'buy', 'campaigns', 'earn', 'earnings', 'promo', 'wallet', 'profile']; + const PANES = ['overview', 'line', 'buy', 'campaigns', 'earn', 'earnings', 'promo', 'training', 'wallet', 'profile']; const TITLES = { overview: 'Overview', line: 'My line', buy: 'Buy packages', campaigns: 'Campaigns', - earn: 'Earn credits', earnings: 'Earnings', promo: 'Promo tools', + earn: 'Earn credits', earnings: 'Earnings', promo: 'Promo tools', training: 'Training', wallet: 'Wallet & account', profile: 'Profile' }; function setPane(name) { if (!PANES.includes(name)) name = 'overview'; @@ -426,6 +446,7 @@ if (name === 'profile') loadLineBanner(); if (name === 'line') { loadLineage(); loadUplineMessages(); } if (name === 'campaigns') ['cTarget', 'cImage', 'cVideoUrl'].forEach(id => { if ($(id)) $(id).value = ''; }); // no residual URL between visits + if (name === 'training') loadTraining(); document.getElementById('memberArea').classList.remove('side-open'); // close mobile drawer if (location.hash !== '#' + name) history.replaceState(null, '', '#' + name); } diff --git a/public/my.html b/public/my.html index c6b9d3f..de25a84 100644 --- a/public/my.html +++ b/public/my.html @@ -126,6 +126,7 @@ + @@ -615,6 +616,15 @@ + +