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:
2026-08-14 10:59:20 +08:00
parent 30ef76632f
commit a3095ead38
3 changed files with 80 additions and 47 deletions
+21 -13
View File
@@ -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>