openvibers/openvibe.live Commits

Live's account menu: one section of Live's own rows (Dashboard, Streamer setup, Cosmetics, Screenshot this page, Help & docs, Browse as guest); the balances, Support Us, My Account, My Channel, History, Admin and Switch account are the bar's or the network's rows already (#417)

OP OpenVibers committed 17 days ago · 68d7ee53f9 · 2 files, +40 −21

Changes

ddiff --git a/public/js/ov-navbar-live.js b/public/js/ov-navbar-live.js
iindex 28f04998..0f35d95d 100644
---- a/public/js/ov-navbar-live.js
++++ b/public/js/ov-navbar-live.js
@@@ -33,35 +33,24 @@
];
}
++ // The account menu (the owner, 2026-10-28: "duplicated things … could just be organized better"): Live's own rows in
++ // one section, then the network's (You: account, notifications, channel, history, Vibe, admin; Display), as on every
++ // OpenVibe site. Nothing here repeats the bar: the balances are its chips (whose clicks open the inventory and the
++ // Vibes shop), Dashboard is also under Go Live, and other accounts and "Add another account" sit at the menu's top.
function menu(user) {
-- const isAdmin = !!(user && (user.role === 'admin' || (user.capabilities && user.capabilities.is_owner)));
const act = (fn, ...a) => (e) => { if (e && e.preventDefault) e.preventDefault(); call(fn, ...a); return false; };
return {
-- label: 'Live', defaults: false,
-- headerChips: [
-- { id: 'coins', icon: 'fa-coins', tone: 'gold', value: '0', title: 'OpenCoins', onClick: () => call('openCosmeticsModal') },
-- { id: 'vibes', icon: 'fa-wallet', tone: 'green', value: '0', title: 'Vibes balance', onClick: () => call('showModal', 'buy-funds') },
-- ],
++ label: 'Live',
sections: [
-- { id: 'you', label: 'You', items: [
-- { id: 'dash', label: 'My Dashboard', icon: 'fa-gauge-high', href: '/dashboard' },
-- { id: 'channel', label: 'My Channel', icon: 'fa-user', href: user ? (typeof channelPath === 'function' ? channelPath(user.username) : '/@' + user.username) : '#' },
++ { id: 'live', label: 'Live', items: [
++ { id: 'dash', label: 'Dashboard', icon: 'fa-gauge-high', href: '/dashboard' },
{ id: 'setup', label: 'Streamer setup', icon: 'fa-list-check', onClick: act('openSetupHub') },
-- { id: 'account', label: 'My Account', icon: 'fa-id-card', href: 'https://openvibe.network/my' },
-- { id: 'adminpanel', label: 'Admin Panel', icon: 'fa-shield-halved', href: 'https://openvibe.network/admin', hidden: !isAdmin },
-- ] },
-- { id: 'live', label: 'On Live', items: [
-- { id: 'support', label: 'Support Us', icon: 'fa-coins', onClick: act('showModal', 'buy-funds') },
{ id: 'cosmetics', label: 'Cosmetics', icon: 'fa-shirt', onClick: act('openCosmeticsModal') },
-- { id: 'shot', label: 'Screenshot', icon: 'fa-camera', onClick: act('captureScreenshot') },
-- { id: 'docs', label: 'Documentation', icon: 'fa-book', href: '/documentation' },
++ { id: 'shot', label: 'Screenshot this page', icon: 'fa-camera', onClick: act('captureScreenshot') },
++ { id: 'docs', label: 'Help & docs', icon: 'fa-book', href: '/documentation' },
++ { id: 'guest', label: 'Browse as guest', icon: 'fa-user-secret', onClick: act('browseAsGuest'), hidden: !user },
] },
],
-- after: [
-- { id: 'history', label: 'History', icon: 'fa-clock-rotate-left', href: 'https://openvibe.network/my#history' },
-- { id: 'switch', label: 'Switch account', icon: 'fa-people-arrows', onClick: act('switchAccount') },
-- { id: 'guest', label: 'Browse as guest', icon: 'fa-user-secret', onClick: act('browseAsGuest') },
-- ],
};
}
ddiff --git a/test/navbar-menu-live.test.js b/test/navbar-menu-live.test.js
nnew file mode 100644
iindex 00000000..1174cbbf
---- /dev/null
++++ b/test/navbar-menu-live.test.js
@@@ -0,0 +1,30 @@
++'use strict';
++/**
++ * Live's account menu (public/js/ov-navbar-live.js on openvibe-shared's navbar; the owner, 2026-10-28: "duplicated things …
++ * could just be organized better … needs a full review"): Live's own rows in one section, and nothing the bar or the
++ * network's rows already have. The balances are the bar's chips, Support Us was the Vibes chip's click, My Account,
++ * My Channel, History and Admin are the network's "You" rows, and Switch account was the menu's own accounts list.
++ *
++ * node test/navbar-menu-live.test.js
++ */
++const assert = require('assert');
++const fs = require('fs');
++const path = require('path');
++
++const src = fs.readFileSync(path.join(__dirname, '..', 'public', 'js', 'ov-navbar-live.js'), 'utf8');
++const menu = src.slice(src.indexOf('function menu(user)'), src.indexOf('function config(user)'));
++
++assert.ok(menu.length > 100, 'the menu is defined');
++assert.ok(!/headerChips/.test(menu), 'the balances are the bar\'s chips, not repeated in the menu');
++assert.ok(!/defaults:\s*false/.test(menu), 'the network\'s own rows (You, Display) are kept, as on every OpenVibe site');
++['Support Us', 'Switch account', 'My Account', 'My Channel', 'History', 'Admin Panel', "id: 'you'"].forEach((gone) => {
++ assert.ok(!menu.includes(gone), `no "${gone}" here: the network's rows or the bar have it`);
++});
++const sections = menu.match(/\{ id: '[a-z]+', label: '[^']+', items: \[/g) || [];
++assert.deepStrictEqual(sections, ["{ id: 'live', label: 'Live', items: ["], 'one section, Live\'s own');
++['Dashboard', 'Streamer setup', 'Cosmetics', 'Screenshot this page', 'Help & docs', 'Browse as guest'].forEach((row) => {
++ assert.ok(menu.includes(`label: '${row}'`), `Live's "${row}" row`);
++});
++assert.ok(!/\bafter:/.test(menu), 'no rows after the network\'s');
++
++console.log('navbar menu live: all checks passed');