-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3d9556
commit 5197bbf
Showing
3 changed files
with
86 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
frontend/src/components/molecules/TournamentResults/TournamentsResults.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import {Alert, AlertTitle} from "@material-ui/lab"; | ||
import {Centered} from "../../atoms/Shared/Centered"; | ||
import EmojiEventsIcon from "@material-ui/icons/EmojiEvents"; | ||
import {Box, Tabs, Typography} from "@material-ui/core"; | ||
import Tab from "@material-ui/core/Tab"; | ||
import React, {useState} from "react"; | ||
|
||
function TournamentsResults() { | ||
const [tournamentStatus, setTournamentStatus] = useState(undefined); | ||
|
||
useEffect(() => { | ||
return () => { | ||
effect | ||
}; | ||
}, [input]); | ||
|
||
|
||
return ( | ||
<> | ||
<Alert severity="info"> | ||
<AlertTitle><strong>Turniej w trakcie</strong></AlertTitle> | ||
Wyniki będą dostępne po zakończeniu wszystkich meczy | ||
</Alert> | ||
|
||
<div style={{display: "flex", justifyContent: "center"}}> | ||
<Centered> | ||
<EmojiEventsIcon color={"primary"} style={{fontSize: '3rem'}}/> | ||
<Typography variant={"h5"} component={"h5"}>Zwycięzca</Typography> | ||
<Box> | ||
<Tabs | ||
value={0} | ||
orientation="vertical" | ||
variant="scrollable" | ||
aria-label="Vertical tabs example" | ||
> | ||
<Tab label="Gracz1"/> | ||
<Tab label="Gracz2"/> | ||
</Tabs> | ||
</Box> | ||
</Centered> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export default TournamentsResults; |
40 changes: 40 additions & 0 deletions
40
frontend/src/restapi/doubles-tournament/DoublesTournamentRestApi.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import axios from "axios"; | ||
import { PATH_BASE_URL } from "../../components/atoms/constants/apiPaths"; | ||
import { MatchDetailsDto } from "./MatchDetailsDto"; | ||
|
||
export type DoublesTournamentRestApiConfig = { | ||
readonly baseUrl: string; | ||
}; | ||
|
||
const defaultConfig: DoublesTournamentRestApiConfig = { | ||
baseUrl: PATH_BASE_URL, | ||
}; | ||
|
||
export const MatchDetailsRestAPI = ( | ||
config?: Partial<DoublesTournamentRestApiConfig> | ||
) => { | ||
const currentConfig = { | ||
...defaultConfig, | ||
config, | ||
baseUrl: | ||
process.env.REACT_APP_REST_API_BASE_URL ?? | ||
config?.baseUrl ?? | ||
defaultConfig.baseUrl, | ||
}; | ||
return { | ||
getTournamentMatch(matchId: string): Promise<MatchDetailsDto> { | ||
return axios | ||
.get<MatchDetailsDto>(`${currentConfig.baseUrl}/matches/${matchId}`) | ||
.then((res) => res.data) | ||
}, | ||
|
||
async postMatchWinner( | ||
matchId: string, | ||
winnerPlayerId: string | ||
): Promise<void> { | ||
await axios.post(`${currentConfig.baseUrl}/matches/${matchId}/result`, { | ||
winnerId: winnerPlayerId, | ||
}); | ||
}, | ||
}; | ||
}; |