import React, { useMemo } from 'react';
import { Tabs } from 'antd';
import { useLocation } from 'react-router-dom';
import MinesweeperGame from './MinesweeperGame';
import MinesweeperLeaderboard from './MinesweeperLeaderboard';
import SpectatorMinesweeper from './SpectatorMinesweeper';
const MinesweeperTabs: React.FC = () => {
const location = useLocation();
// 检查是否在旁观模式
const isSpectatorMode = location.pathname.startsWith('/spectate/');
const roomId = isSpectatorMode ? location.pathname.split('/')[2] : null;
// 选项卡内容
const items = useMemo(() => {
if (isSpectatorMode && roomId) {
// 旁观模式:只显示旁观组件
return [
{
key: 'spectator',
label: '旁观模式',
children: