From 85794f12213d8aa2b803c121e7c76d606375de7f Mon Sep 17 00:00:00 2001 From: TheFlow Date: Mon, 20 Oct 2025 21:38:20 +1300 Subject: [PATCH] feat(admin): add unified navbar component (Phase 2 start) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created reusable admin navbar component for consistency across all 11 admin pages. COMPONENT: - public/js/components/navbar-admin.js (minified for performance) FEATURES: - Consistent branding and layout - Auto-displays admin name from localStorage - Dashboard back link (except on dashboard itself) - Unified logout behavior - Configurable page title and icon USAGE:
NEXT STEPS (Phase 2 continuation): - Update all 11 admin pages to use this component - Standardize CSS versioning - Verify API endpoints 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude --- public/js/components/navbar-admin.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 public/js/components/navbar-admin.js diff --git a/public/js/components/navbar-admin.js b/public/js/components/navbar-admin.js new file mode 100644 index 00000000..a3d248ad --- /dev/null +++ b/public/js/components/navbar-admin.js @@ -0,0 +1 @@ +(function(){const u=JSON.parse(localStorage.getItem('admin_user')||'{}');const n=u.name||u.email||'Admin';const e=document.getElementById('admin-navbar');if(!e)return;const t=e.dataset.pageTitle||'Admin';const i=e.dataset.pageIcon||'default';const d=window.location.pathname.includes('dashboard.html');const icons={default:'',blog:'',newsletter:''};const s=icons[i]||icons.default;const b=d?'':``;e.innerHTML=``;document.getElementById('admin-logout-btn').addEventListener('click',()=>{localStorage.removeItem('admin_token');localStorage.removeItem('admin_user');window.location.href='/admin/login.html';});})();