feat(web): move mod header into site header
Replace the global TTS Workshop header on mod routes with a ModHeader showing the thumbnail, game name, and download/setup links styled like the Search/BGM nav.
This commit is contained in:
+21
-13
@@ -1,7 +1,8 @@
|
||||
import { lazy, Suspense } from 'react';
|
||||
import { Link, Route, Routes } from 'react-router-dom';
|
||||
import { Link, Route, Routes, useLocation } from 'react-router-dom';
|
||||
import SearchPage from './pages/SearchPage';
|
||||
import ModPage from './pages/ModPage';
|
||||
import ModHeader from './components/ModHeader';
|
||||
|
||||
// The full-setup view and the bgm/tabletop pages pull in the whole three.js
|
||||
// stack (Scene + all mesh viewers + @tts/tabletop). Lazy-load them so that
|
||||
@@ -18,22 +19,29 @@ const SetupsPage = lazy(() => import('./pages/SetupsPage'));
|
||||
const SetupPage = lazy(() => import('./pages/SetupPage'));
|
||||
|
||||
export default function App() {
|
||||
const { pathname } = useLocation();
|
||||
const isModRoute = pathname.startsWith('/mod/');
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-zinc-950 text-zinc-100">
|
||||
<header className="border-b border-zinc-800">
|
||||
<div className="mx-auto flex max-w-5xl items-center justify-between px-4 py-4">
|
||||
<Link to="/" className="text-lg font-semibold tracking-tight">
|
||||
TTS Workshop
|
||||
</Link>
|
||||
<nav className="flex gap-4 text-sm text-zinc-400">
|
||||
<Link to="/" className="hover:text-zinc-100">
|
||||
Search
|
||||
{isModRoute ? (
|
||||
<ModHeader />
|
||||
) : (
|
||||
<div className="mx-auto flex max-w-5xl items-center justify-between px-4 py-4">
|
||||
<Link to="/" className="text-lg font-semibold tracking-tight">
|
||||
TTS Workshop
|
||||
</Link>
|
||||
<Link to="/bgm" className="hover:text-zinc-100">
|
||||
BGM
|
||||
</Link>
|
||||
</nav>
|
||||
</div>
|
||||
<nav className="flex gap-4 text-sm text-zinc-400">
|
||||
<Link to="/" className="hover:text-zinc-100">
|
||||
Search
|
||||
</Link>
|
||||
<Link to="/bgm" className="hover:text-zinc-100">
|
||||
BGM
|
||||
</Link>
|
||||
</nav>
|
||||
</div>
|
||||
)}
|
||||
</header>
|
||||
<main className="mx-auto max-w-5xl px-4 py-8">
|
||||
<Routes>
|
||||
|
||||
Reference in New Issue
Block a user