diff --git a/client/src/App.jsx b/client/src/App.jsx index 69386a0..c37bb73 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -40,6 +40,7 @@ import ActivityAdmin from './routes/admin/views/ActivityAdmin.jsx' import BotActivityAdmin from './routes/admin/views/BotActivityAdmin.jsx' import DiscordBotAdmin from './routes/admin/views/DiscordBotAdmin.jsx' import ShardAdmin from './routes/admin/views/ShardAdmin.jsx' +import ShardVisibility from './routes/admin/views/ShardVisibility.jsx' import ShardOps from './routes/admin/views/ShardOps.jsx' import AdminCharacters from './routes/admin/views/AdminCharacters.jsx' import AdminCharacter from './routes/admin/views/AdminCharacter.jsx' @@ -142,6 +143,7 @@ export default function App() { } /> } /> } /> + } /> req('/public/shard/presence'), houses: () => req('/public/shard/houses'), + // Which shard surfaces this caller may reach, plus the audience rung they + // resolved to. Drives nav so we never render a link that would 403. + features: () => req('/public/shard/features'), }, // Full paths (incl. /api/v1) for the browser EventSource — the req() wrapper is // fetch-only, so SSE subscribers build the URL from here. The admin stream @@ -346,6 +349,13 @@ export const api = { saveUoLinkConfig: (data) => req('/admin/uo-link/config', { method: 'PUT', body: data }), postTownCrier: (data) => req('/admin/uo-link/towncrier', { method: 'POST', body: data }), deleteTownCrier: (id) => req(`/admin/uo-link/towncrier/${encodeURIComponent(id)}`, { method: 'DELETE' }), + // Per-feature shard visibility: who may see which shard surface, and which + // sensitive fields within it. Admin only — it decides what ANONYMOUS + // visitors get. acct/webId are admin-only always and the API rejects any + // attempt to configure them. + getShardVisibility: () => req('/admin/shard/visibility'), + saveShardVisibility: (features) => + req('/admin/shard/visibility', { method: 'PUT', body: { features } }), // ----- in-game staff operations: write plane + support queue (admin/moderator) ----- // `actor` is stamped server-side from the session — never sent from here. diff --git a/client/src/components/SiteHeader.jsx b/client/src/components/SiteHeader.jsx index 4394419..58a1dc6 100644 --- a/client/src/components/SiteHeader.jsx +++ b/client/src/components/SiteHeader.jsx @@ -2,9 +2,15 @@ import { Link, NavLink } from 'react-router-dom' import MoonDot from './MoonDot.jsx' import { useAuth } from '../contexts/AuthContext.jsx' import { useSite } from '../contexts/SiteContext.jsx' +import { useShardFeatures, canSee } from '../lib/useShardFeatures.js' // 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). +// +// Entries carrying a `feature` are shard surfaces an admin can disable or gate +// to a higher audience (Admin -> Shard Visibility). They are hidden when this +// viewer can't reach them, so we never render a link that would 403. The gate +// itself is server-side; this is only about not advertising a dead end. const NAV = [ { label: 'Home', to: '/', end: true }, { label: 'News', to: '/site/news' }, @@ -12,11 +18,11 @@ const NAV = [ { label: 'Five on Friday', to: '/site/five-on-friday' }, { label: 'Newsletter', to: '/site/newsletter' }, { label: 'Wiki', to: '/wiki' }, - { label: 'Shard', to: '/site/shard' }, - { label: 'Champions', to: '/site/champs' }, - { label: 'Guilds', to: '/site/guilds' }, - { label: 'Governors', to: '/site/governors' }, - { label: 'Houses', to: '/site/houses' }, + { label: 'Shard', to: '/site/shard', feature: 'status' }, + { label: 'Champions', to: '/site/champs', feature: 'champs' }, + { label: 'Guilds', to: '/site/guilds', feature: 'guilds' }, + { label: 'Governors', to: '/site/governors', feature: 'governors' }, + { label: 'Houses', to: '/site/houses', feature: 'houses' }, { label: 'About', to: '/site/about' }, ] @@ -29,6 +35,8 @@ const linkStyle = ({ isActive }) => ({ export default function SiteHeader() { const { user, loading } = useAuth() const { siteTitle } = useSite() + const shardFeatures = useShardFeatures() + const nav = NAV.filter((item) => !item.feature || canSee(shardFeatures, item.feature)) // Where the auth entry points: staff → admin, player → portal, else sign in. let account @@ -60,7 +68,7 @@ export default function SiteHeader() { {siteTitle}