From 1df2506b8c8045b1b13288309411f5845126f6fb Mon Sep 17 00:00:00 2001 From: glax Date: Tue, 27 May 2025 02:22:53 +0200 Subject: [PATCH] Add Player button --- src/App.tsx | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 3dc3645..9b18edb 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,7 +8,7 @@ import {ApiUriContext, getData} from "./api/fetchApi.tsx"; import {GetGames, GetPlayers} from "./api/endpoints/Data.tsx"; import { AccordionGroup, - Box, CircularProgress, + Box, Button, CircularProgress, Divider, Input, Stack, @@ -19,6 +19,7 @@ import PlayerAccordionItem from "./components/PlayerAccordionItem.tsx"; import PlayerGameStatsDrawer from "./components/PlayerGameStatsDrawer.tsx"; import {Cancel, CheckCircleOutline} from '@mui/icons-material'; import {PlayerStatsDrawer} from "./components/PlayerStatsDrawer.tsx"; +import {AddPlayer} from "./api/endpoints/Actions.tsx"; export default function App() { const [apiUri, setApiUri] = useState("http://127.0.0.1:5239"); @@ -71,7 +72,6 @@ export default function App() { }); } - const [connectionTimer, setConnectionTimer] = useState(null); useEffect(() => { @@ -81,21 +81,33 @@ export default function App() { .then(() => setConnectionTimer(setInterval(checkConnection, 5000))); }, [apiUri]); + const [addPlayerStr, setAddPlayerStr] = useState(""); + const addPlayer = () => { + const steamId = BigInt(addPlayerStr); + AddPlayer(apiUri, steamId); + } return ( - setApiUri(e.target.value)} - endDecorator={checkingConnection - ? - : connected - ? - : } - /> - + + setApiUri(e.target.value)} + endDecorator={checkingConnection + ? + : connected + ? + : } + /> + setAddPlayerStr(e.target.value)} + endDecorator={} + /> + + Players