Skip to content

Commit 204eada

Browse files
committed
WIP tournament admin page
1 parent 390350a commit 204eada

35 files changed

+843
-1376
lines changed

services/app/apps/codebattle/assets/js/widgets/App.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ const UserProfile = React.lazy(() => import('./pages/profile'));
7171
const Registration = React.lazy(() => import('./pages/registration'));
7272
const Tournament = React.lazy(() => import('./pages/tournament'));
7373
const TournamentAdmin = React.lazy(() => import('./pages/tournament/TournamentAdminWidget'));
74+
const TournamentStream = React.lazy(() => import('./pages/tournament/TournamentAdminWidget'));
7475
const EventWidget = React.lazy(() => import('./pages/event'));
7576
const TournamentPlayer = React.lazy(() => import('./pages/tournamentPlayer'));
7677

services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ export const setTournamentChannel = (newTournamentId = tournamentId) => {
1919
return channel;
2020
};
2121

22-
const initTournamentChannel = dispatch => {
22+
const initTournamentChannel = (dispatch, isAdminWidged = false) => {
2323
const onJoinFailure = err => {
2424
console.error(err);
2525
// window.location.reload();
2626
};
2727

2828
const onJoinSuccess = response => {
29-
// dispatch(
30-
// actions.setTournamentData({
31-
// ...response.tournament,
32-
// topPlayerIds: response.topPlayerIds || [],
33-
// matches: {},
34-
// ranking: response.ranking || { entries: [] },
35-
// clans: response.clans || {},
36-
// players: {},
37-
// showBots: response.tournament.type !== TournamentTypes.show,
38-
// playersPageSize: 20,
39-
// }),
40-
// );
29+
if (isAdminWidged) {
30+
dispatch(
31+
actions.setTournamentData({
32+
...response.tournament,
33+
topPlayerIds: response.topPlayerIds || [],
34+
matches: {},
35+
ranking: response.ranking || { entries: [] },
36+
players: {},
37+
playersPageSize: 20,
38+
}),
39+
);
40+
}
4141

4242
dispatch(actions.updateTournamentRanking((response.ranking)));
4343
dispatch(actions.updateTournamentPlayers(compact(response.players)));
@@ -55,9 +55,9 @@ const initTournamentChannel = dispatch => {
5555

5656
// export const soundNotification = notification();
5757

58-
export const connectToTournament = (_machine, newTournamentId) => dispatch => {
58+
export const connectToTournament = (_machine, newTournamentId, isAdminWidged = false) => dispatch => {
5959
setTournamentChannel(newTournamentId);
60-
initTournamentChannel(dispatch);
60+
initTournamentChannel(dispatch, isAdminWidged);
6161

6262
const handleUpdate = response => {
6363
dispatch(actions.updateTournamentData(response.tournament));
@@ -182,6 +182,15 @@ export const uploadPlayers = playerIds => (dispatch, getState) => {
182182
}
183183
};
184184

185+
export const requestMatchesForRound = () => dispatch => {
186+
channel
187+
.push('tournament:matches:request_for_round', {})
188+
.receive('ok', data => {
189+
dispatch(actions.updateTournamentMatches(data.matches));
190+
})
191+
.receive('error', error => console.error(error));
192+
};
193+
185194
export const requestMatchesByPlayerId = userId => dispatch => {
186195
channel
187196
.push('tournament:matches:request', { playerId: userId })

0 commit comments

Comments
 (0)