mirror of
https://github.com/LHY0125/Gobang-Game.git
synced 2026-06-29 00:45:55 +08:00
feat(frontend): App 路由集成 + 木纹风格 CSS
App.tsx 添加 menu/game/replay 三页面路由切换,MainMenu 新增 onReplayStart 属性区分对局与回放入口。App.css 实现经典木纹 视觉风格(深棕底色、米黄文字、皮革纹理按钮),index.css 基础 重置。修复 tsconfig 中 erasableSyntaxOnly 无效选项并安装 @types/node。
This commit is contained in:
@@ -9,16 +9,17 @@ type View = 'main' | 'local' | 'ai' | 'online' | 'replay';
|
||||
|
||||
interface Props {
|
||||
onGameStart: () => void;
|
||||
onReplayStart: () => void;
|
||||
}
|
||||
|
||||
export default function MainMenu({ onGameStart }: Props) {
|
||||
export default function MainMenu({ onGameStart, onReplayStart }: Props) {
|
||||
const { t } = useTranslation();
|
||||
const [view, setView] = useState<View>('main');
|
||||
|
||||
if (view === 'local') return <LocalGameSetup onBack={() => setView('main')} onStart={onGameStart} />;
|
||||
if (view === 'ai') return <AiGameSetup onBack={() => setView('main')} onStart={onGameStart} />;
|
||||
if (view === 'online') return <OnlineSetup onBack={() => setView('main')} onStart={onGameStart} />;
|
||||
if (view === 'replay') return <LoadReplay onBack={() => setView('main')} onStart={onGameStart} />;
|
||||
if (view === 'replay') return <LoadReplay onBack={() => setView('main')} onStart={onReplayStart} />;
|
||||
|
||||
return (
|
||||
<div className="main-menu">
|
||||
|
||||
Reference in New Issue
Block a user