%
// Bottom-tab navigation — mobile-only (hidden ≥768px via CSS).
//
// Tabs:
// logged-out: Home · Zoek · Inloggen (3 tabs)
// logged-in: Home · Zoek · [Plus] · [Prutter] · Profiel
// The Plus tab is a FAB-style center action (accent bg, slightly raised).
// It only appears for users with create-post permission.
// Prutter only appears when the site has DMs enabled.
const _siteUrlBase = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
const _path = (typeof currentPath !== 'undefined' && currentPath) ? currentPath : '/';
const _canPost = !!(user && (typeof canMutate === 'undefined' || canMutate)
&& permissions && permissions.canCreatePost && permissions.canCreatePost(user, site));
const _hasPrutter = !!(user && site && site.enable_prutter && (typeof tenancy !== 'undefined' && tenancy === 'hub') && (typeof premiumUnlocked === 'undefined' || premiumUnlocked));
const _ownProfile = user ? ('/users/' + user.username) : null;
const _isHub = (typeof tenancy !== 'undefined' && tenancy === 'hub');
// Home gaat in hub-modus ALTIJD naar de hub-root (/), niet naar de sub-home van
// een artiest. In solo/circle is _siteUrlBase leeg, dus dat blijft '/'.
const _homeHref = (_isHub ? '' : _siteUrlBase) + '/';
// Strip site prefix for cleaner matching
function _normalize(p) {
if (_siteUrlBase && p.indexOf(_siteUrlBase) === 0) return p.slice(_siteUrlBase.length) || '/';
return p;
}
const _p = _normalize(_path);
let _active = null;
// In hub is Home alleen actief op de échte hub-root, niet op een artiest-sub-home.
if (_isHub ? (_path === '/') : (_p === '/' || _p === '')) _active = 'home';
else if (_p.indexOf('/search') === 0 || _p.indexOf('/tag/') === 0 || _p.indexOf('/type/') === 0) _active = 'search';
else if (_p === '/posts/new' || /^\/posts\/[^/]+\/edit$/.test(_p)) _active = 'create';
else if (_p.indexOf('/prutter') === 0) _active = 'prutter';
else if (_p.indexOf('/account') === 0 || (_ownProfile && _p.indexOf(_ownProfile) === 0)) _active = 'profile';
else if (_p.indexOf('/auth/login') === 0) _active = 'login';
%>