1
0
Fork 0
This repository has been archived on 2023-12-03. You can view files and clone it, but cannot push or open issues or pull requests.
chellaris-galaxy-political-.../components/gui/client/game-view.tsx

26 lines
1,018 B
TypeScript
Raw Normal View History

'use client';
import { Game } from "@/types/stellaris";
2023-06-11 12:24:11 +00:00
import { GameSelect } from "../server/game-select";
import { useState } from 'react';
2023-06-11 12:24:11 +00:00
import { GameGroupSelect } from "../server/game-group-select";
import { SSRProvider } from "react-bootstrap";
import { GameInfoTabs } from "./game-info-tabs";
export const GameView = (props: { games: Game[] }) => {
const [currentGame, setCurrentGame] = useState(props.games[0]);
const [gameGroups, setGameGroups] = useState([{ id: 0, name: "", game_id: 0 }]);
const [currentGameGroups, setCurrentGameGroups] = useState(gameGroups);
return (
<>
<SSRProvider>
<div className="row">
<GameSelect games={props.games} currentGame={currentGame} setCurrentGame={setCurrentGame} />
<GameGroupSelect game={currentGame} groups={[gameGroups, setGameGroups]} currentGroups={[currentGameGroups, setCurrentGameGroups]} />
</div>
<GameInfoTabs game={currentGame} groups={currentGameGroups} />
</SSRProvider>
</>
)
}