From 49ce230c3a7b3f1ab7b2c8f3278fe5c60ab0bc66 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 11 Jul 2026 02:59:19 -0500 Subject: [PATCH] Full-site nav: one auth-aware nav bar on every page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SiteHeader: a single consistent main nav (Home, News, Screenshots, Five on Friday, Newsletter, Wiki, Shard, About) with active-state highlighting, plus an auth-aware entry on the right — Sign in when logged out, My Account (player) or Admin (staff) when logged in. - Portal (landing) now renders the site header too, so the nav is present across the entire site, not just interior pages. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_011qPmpmVH1xGCiZoz9m9vW3 --- client/src/components/SiteHeader.jsx | 87 ++++++++++++++-------------- client/src/routes/public/Portal.jsx | 2 +- 2 files changed, 46 insertions(+), 43 deletions(-) diff --git a/client/src/components/SiteHeader.jsx b/client/src/components/SiteHeader.jsx index 16fea82..e8df12f 100644 --- a/client/src/components/SiteHeader.jsx +++ b/client/src/components/SiteHeader.jsx @@ -1,27 +1,37 @@ -import { Link } from 'react-router-dom' +import { Link, NavLink } from 'react-router-dom' import MoonDot from './MoonDot.jsx' +import { useAuth } from '../contexts/AuthContext.jsx' -const NAV = { - website: [ - { label: 'Shard', to: '/site/shard' }, - { label: 'News', to: '/site/news' }, - { label: 'Screenshots', to: '/site/screenshots' }, - { label: 'Five on Friday', to: '/site/five-on-friday' }, - { label: 'Newsletter', to: '/site/newsletter' }, - { label: 'About', to: '/site/about' }, - { label: 'Wiki', to: '/wiki' }, - ], - wiki: [ - { label: 'Website', to: '/site' }, - { label: 'New Player Guide', to: '/wiki/new-player-guide' }, - { label: 'Maps & Atlas', to: '/wiki/maps-atlas' }, - { label: 'Systems', to: '/wiki/systems' }, - { label: 'Rules', to: '/wiki/rules' }, - ], -} +// One consistent top nav for the whole public site. Every page gets the same +// main links plus an auth-aware entry on the right (Sign in / My Account / Admin). +const NAV = [ + { label: 'Home', to: '/', end: true }, + { label: 'News', to: '/site/news' }, + { label: 'Screenshots', to: '/site/screenshots' }, + { label: 'Five on Friday', to: '/site/five-on-friday' }, + { label: 'Newsletter', to: '/site/newsletter' }, + { label: 'Wiki', to: '/wiki' }, + { label: 'Shard', to: '/site/shard' }, + { label: 'About', to: '/site/about' }, +] + +const linkStyle = ({ isActive }) => ({ + background: isActive ? 'var(--accent)' : undefined, + color: isActive ? 'var(--bg-deep)' : undefined, + borderColor: isActive ? 'var(--accent)' : undefined, +}) + +export default function SiteHeader() { + const { user, loading } = useAuth() + + // Where the auth entry points: staff → admin, player → portal, else sign in. + const account = + user && user.role && user.role !== 'player' + ? { label: 'Admin', to: '/admin' } + : user + ? { label: 'My Account', to: '/player' } + : { label: 'Sign in', to: '/account/login' } -export default function SiteHeader({ section = 'website' }) { - const links = NAV[section] || NAV.website return (
UOMysticmoon
diff --git a/client/src/routes/public/Portal.jsx b/client/src/routes/public/Portal.jsx index 9cf1fd6..1851b35 100644 --- a/client/src/routes/public/Portal.jsx +++ b/client/src/routes/public/Portal.jsx @@ -40,7 +40,7 @@ export default function Portal() { const elements = [...layout.elements].sort((a, b) => (a.z || 0) - (b.z || 0)) return ( - +
{PREVIEW && draft && (