2024-04-14 11:16:34 +02:00
|
|
|
import ClientScreen from './ClientScreen';
|
|
|
|
import Controls from './Controls.tsx';
|
|
|
|
import JoinForm from './JoinForm.tsx';
|
|
|
|
import PlayerInfo from './PlayerInfo.tsx';
|
2024-04-28 12:53:18 +02:00
|
|
|
import Column from './components/Column.tsx';
|
|
|
|
import Row from './components/Row.tsx';
|
|
|
|
import Scoreboard from './Scoreboard.tsx';
|
|
|
|
import Button from './components/Button.tsx';
|
2024-04-29 12:24:52 +02:00
|
|
|
import MapChooser from './MapChooser.tsx';
|
2024-04-14 11:16:34 +02:00
|
|
|
import './App.css';
|
2024-04-28 21:28:07 +02:00
|
|
|
import {getRandomTheme, useStoredTheme} from "./theme.ts";
|
|
|
|
import { useState } from 'react';
|
2024-04-14 11:16:34 +02:00
|
|
|
|
|
|
|
export default function App() {
|
2024-04-14 14:55:01 +02:00
|
|
|
const [theme, setTheme] = useStoredTheme();
|
2024-04-28 12:53:18 +02:00
|
|
|
const [name, setName] = useState<string | null>(null);
|
2024-04-14 11:16:34 +02:00
|
|
|
|
2024-04-28 12:53:18 +02:00
|
|
|
return <Column className="flex-grow">
|
2024-04-21 21:37:38 +02:00
|
|
|
|
2024-04-28 12:53:18 +02:00
|
|
|
<ClientScreen theme={theme} player={name}/>
|
2024-04-21 21:37:38 +02:00
|
|
|
|
2024-04-14 11:16:34 +02:00
|
|
|
<Row>
|
2024-04-28 12:53:18 +02:00
|
|
|
<h1 className="flex-grow">CCCB-Tanks!</h1>
|
2024-04-29 12:24:52 +02:00
|
|
|
<MapChooser />
|
2024-04-28 12:53:18 +02:00
|
|
|
<Button text="change colors" onClick={() => setTheme(_ => getRandomTheme())}/>
|
2024-04-14 12:57:45 +02:00
|
|
|
<Button
|
|
|
|
onClick={() => window.open('https://github.com/kaesaecracker/cccb-tanks-cs', '_blank')?.focus()}
|
2024-04-28 12:53:18 +02:00
|
|
|
text="GitHub"/>
|
|
|
|
{name !== '' &&
|
|
|
|
<Button onClick={() => setName(_ => '')} text="logout"/>}
|
2024-04-14 11:16:34 +02:00
|
|
|
</Row>
|
2024-04-21 21:37:38 +02:00
|
|
|
|
2024-04-28 12:53:18 +02:00
|
|
|
{name || <JoinForm onDone={name => setName(_ => name)}/>}
|
2024-04-21 21:37:38 +02:00
|
|
|
|
2024-04-28 12:53:18 +02:00
|
|
|
<Row className="GadgetRows">
|
|
|
|
{name && <Controls player={name}/>}
|
|
|
|
{name && <PlayerInfo player={name}/>}
|
2024-04-14 11:16:34 +02:00
|
|
|
<Scoreboard/>
|
|
|
|
</Row>
|
2024-04-21 21:37:38 +02:00
|
|
|
|
2024-04-14 11:16:34 +02:00
|
|
|
</Column>;
|
|
|
|
}
|