%
// 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 && permissions && permissions.canCreatePost && permissions.canCreatePost(user, site));
const _hasPrutter = !!(user && site && site.enable_prutter && (typeof tenancy !== 'undefined' && tenancy === 'hub'));
const _ownProfile = user ? ('/users/' + user.username) : null;
// 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;
if (_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';
%>