Skip to content

Commit 8a585e2

Browse files
authored
Merge branch 'master' into add_event_modal
2 parents 7b16f9b + 15e820c commit 8a585e2

File tree

64 files changed

+2420
-1689
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2420
-1689
lines changed

docs/004-seasons-and-points.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ For each finished tournament (grade ≠ open), we award Season Points by final p
6767

6868
rookie: [8, 4, 2] (top‑3)
6969

70-
challenger: [64, 32, 16, 8, 4, 2] (top‑6)
70+
challenger: [16, 8, 4, 2] (top‑6)
7171

7272
pro: [128, 64, 32, 16, 8, 4, 2] (top‑7)
7373

services/app/apps/codebattle/assets/css/custom.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
border-radius: 0.50rem;
99
}
1010

11-
1211
.cb-custom-event-table .cb-custom-event-td:first-child {
1312
border-top-left-radius: 0.6rem;
1413
border-bottom-left-radius: 0.6rem;
@@ -131,7 +130,7 @@
131130
display: block;
132131
margin-left: -1px;
133132
line-height: 1.25;
134-
color: black;
133+
color: white;
135134
}
136135

137136
.cb-custom-event-pagination-page-item:first-child .cb-custom-event-pagination-page-link,

services/app/apps/codebattle/assets/css/style.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ $cb-bg-highlight-panel: #1c1c24;
4343
// $cb-bg-highlight-panel: #13181f;
4444

4545
$secondary: #477591;
46-
$link-color: black;
46+
$link-color: white;
4747
$error: #dc3545;
4848
$bg-orange: rgba(238, 55, 55);
4949
$orange: rgba(238, 55, 55, 0.76);
@@ -411,7 +411,7 @@ a {
411411
}
412412

413413
.cb-game-score-draw {
414-
color: var(--black) !important;
414+
color: var(--gray) !important;
415415
}
416416

417417
.cb-user-online {

services/app/apps/codebattle/assets/js/socket.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export const channelTopics = {
5555
tournamentPlayerFinishedRoundTopic: 'tournament:player:finished_round',
5656
tournamentPlayerFinishedTopic: 'tournament:player:finished',
5757
tournamentActivated: 'tournament:activated',
58+
tournamentCanceled: 'tournament:canceled',
5859

5960
roundCreatedTopic: 'round:created',
6061

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

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import React, { Suspense } from 'react';
22

33
import NiceModal from '@ebay/nice-modal-react';
4-
import {
5-
configureStore,
6-
combineReducers,
7-
} from '@reduxjs/toolkit';
4+
import { configureStore, combineReducers } from '@reduxjs/toolkit';
85
import { Provider } from 'react-redux';
96
import { persistStore, persistReducer, PERSIST } from 'redux-persist';
107
import { PersistGate } from 'redux-persist/integration/react';
@@ -29,7 +26,6 @@ const { gameUI: gameUIReducer, ...otherReducers } = reducers;
2926
const gameUIPersistWhitelist = [
3027
'audioMuted',
3128
'videoMuted',
32-
'showVideoConferencePanel',
3329
'editorMode',
3430
'editorTheme',
3531
'streamMode',
@@ -55,14 +51,18 @@ const rollbarRedux = rollbarMiddleware(rollbar);
5551
const store = configureStore({
5652
reducer: rootReducer,
5753
middleware: getDefaultMiddleware => getDefaultMiddleware({
58-
serializableCheck: { ignoredActions: ['ERROR', PERSIST] },
59-
}).concat(rollbarRedux),
54+
serializableCheck: { ignoredActions: ['ERROR', PERSIST] },
55+
}).concat(rollbarRedux),
6056
});
6157

6258
const persistor = persistStore(store);
6359

64-
const OnlineContainer = React.lazy(() => import('./components/OnlineContainer'));
65-
const InvitesContainer = React.lazy(() => import('./components/InvitesContainer'));
60+
const OnlineContainer = React.lazy(
61+
() => import('./components/OnlineContainer'),
62+
);
63+
const InvitesContainer = React.lazy(
64+
() => import('./components/InvitesContainer'),
65+
);
6666
const RoomWidget = React.lazy(() => import('./pages/RoomWidget'));
6767
const LobbyWidget = React.lazy(() => import('./pages/lobby'));
6868
const RatingList = React.lazy(() => import('./pages/rating'));
@@ -71,7 +71,9 @@ const UserSettings = React.lazy(() => import('./pages/settings'));
7171
const UserProfile = React.lazy(() => import('./pages/profile'));
7272
const Registration = React.lazy(() => import('./pages/registration'));
7373
const Tournament = React.lazy(() => import('./pages/tournament'));
74-
const TournamentAdmin = React.lazy(() => import('./pages/tournament/TournamentAdminWidget'));
74+
const TournamentAdmin = React.lazy(
75+
() => import('./pages/tournament/TournamentAdminWidget'),
76+
);
7577
const Stream = React.lazy(() => import('./pages/stream/StreamWidget'));
7678
const EventWidget = React.lazy(() => import('./pages/event'));
7779
const TournamentPlayer = React.lazy(() => import('./pages/tournamentPlayer'));
@@ -189,9 +191,7 @@ export const RegistrationPage = () => (
189191
export const StairwayGamePage = () => (
190192
<Provider store={store}>
191193
<PersistGate loading={null} persistor={persistor}>
192-
<Suspense>
193-
{/* <Stairway /> */}
194-
</Suspense>
194+
<Suspense>{/* <Stairway /> */}</Suspense>
195195
</PersistGate>
196196
</Provider>
197197
);
@@ -200,9 +200,7 @@ export const TournamentPage = () => (
200200
<Provider store={store}>
201201
<PersistGate loading={null} persistor={persistor}>
202202
<Suspense>
203-
<Tournament
204-
waitingRoomMachine={waitingRoomMachine}
205-
/>
203+
<Tournament waitingRoomMachine={waitingRoomMachine} />
206204
</Suspense>
207205
</PersistGate>
208206
</Provider>
@@ -211,9 +209,7 @@ export const TournamentAdminPage = () => (
211209
<Provider store={store}>
212210
<PersistGate loading={null} persistor={persistor}>
213211
<Suspense>
214-
<TournamentAdmin
215-
waitingRoomMachine={waitingRoomMachine}
216-
/>
212+
<TournamentAdmin waitingRoomMachine={waitingRoomMachine} />
217213
</Suspense>
218214
</PersistGate>
219215
</Provider>

services/app/apps/codebattle/assets/js/widgets/config/jitsiStatuses.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ const initPresence = followId => dispatch => {
104104
data => {
105105
camelizeKeysAndDispatch(dispatch, actions.changeTournamentState)(data);
106106
},
107+
).addListener(
108+
channelTopics.tournamentCanceled,
109+
data => {
110+
camelizeKeysAndDispatch(dispatch, actions.changeTournamentState)(data);
111+
},
107112
);
108113
};
109114

services/app/apps/codebattle/assets/js/widgets/pages/game/ChatWidget.jsx

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import useChatRooms from '../../utils/useChatRooms';
2828
import useMachineStateSelector from '../../utils/useMachineStateSelector';
2929

3030
import Notifications from './Notifications';
31-
import VideoConference from './VideoConference';
3231

3332
function ChatWidget() {
3433
const { mainService } = useContext(RoomContext);
@@ -39,14 +38,22 @@ function ChatWidget() {
3938
const historyMessages = useSelector(selectors.chatHistoryMessagesSelector);
4039
const gameMode = useSelector(selectors.gameModeSelector);
4140
const useChat = useSelector(selectors.gameUseChatSelector);
42-
const showVideoConferencePanel = useSelector(selectors.showVideoConferencePanelSelector);
4341

44-
const openedReplayer = useMachineStateSelector(mainService, openedReplayerSelector);
45-
const isTestingRoom = useMachineStateSelector(mainService, inTestingRoomSelector);
46-
const isRestricted = useMachineStateSelector(mainService, isRestrictedContentSelector);
42+
const openedReplayer = useMachineStateSelector(
43+
mainService,
44+
openedReplayerSelector,
45+
);
46+
const isTestingRoom = useMachineStateSelector(
47+
mainService,
48+
inTestingRoomSelector,
49+
);
50+
const isRestricted = useMachineStateSelector(
51+
mainService,
52+
isRestrictedContentSelector,
53+
);
4754

4855
// const isTournamentGame = (gameMode === GameRoomModes.tournament);
49-
const isStandardGame = (gameMode === GameRoomModes.standard);
56+
const isStandardGame = gameMode === GameRoomModes.standard;
5057
const showChatInput = !openedReplayer && !isTestingRoom && !isRestricted && useChat;
5158
// const showChatParticipants = !isTestingRoom && useChat && !isRestricted;
5259

@@ -73,39 +80,35 @@ function ChatWidget() {
7380
const filteredMessages = messages.filter(message => shouldShowMessage(message, activeRoom));
7481

7582
return (
76-
<ChatContextMenu
77-
menuId={menuId}
78-
inputRef={inputRef}
79-
request={menuRequest}
80-
>
83+
<ChatContextMenu menuId={menuId} inputRef={inputRef} request={menuRequest}>
8184
<div className="d-flex flex-wrap flex-sm-nowrap cb-bg-panel shadow-sm h-100 cb-rounded">
8285
<div
8386
className={cn(
8487
'd-none d-lg-flex d-md-flex d-sm-flex flex-column flex-grow-1 position-relative p-0 h-100 mh-100 rounded-left',
8588
'cb-game-chat-container cb-messages-container cb-text',
8689
)}
8790
>
88-
{showVideoConferencePanel ? (
89-
<VideoConference />
90-
) : (
91-
<>
92-
<ChatHeader showRooms={isStandardGame} disabled={disabledChatHeader} />
93-
{openedReplayer
94-
? (
95-
<Messages
96-
messages={historyMessages}
97-
disabled={disabledChatMessages}
98-
/>
99-
) : (
100-
<Messages
101-
displayMenu={displayMenu}
102-
messages={filteredMessages}
103-
disabled={disabledChatMessages}
104-
/>
105-
)}
106-
{showChatInput && <ChatInput inputRef={inputRef} disabled={disabledChatInput} />}
107-
</>
108-
)}
91+
<>
92+
<ChatHeader
93+
showRooms={isStandardGame}
94+
disabled={disabledChatHeader}
95+
/>
96+
{openedReplayer ? (
97+
<Messages
98+
messages={historyMessages}
99+
disabled={disabledChatMessages}
100+
/>
101+
) : (
102+
<Messages
103+
displayMenu={displayMenu}
104+
messages={filteredMessages}
105+
disabled={disabledChatMessages}
106+
/>
107+
)}
108+
{showChatInput && (
109+
<ChatInput inputRef={inputRef} disabled={disabledChatInput} />
110+
)}
111+
</>
109112
</div>
110113
<div className="flex-shrink-1 p-0 border-left cb-border-color rounded-right cb-game-control-container">
111114
<div className="d-flex flex-column justify-content-start overflow-auto h-100">

services/app/apps/codebattle/assets/js/widgets/pages/game/EditorToolbar.jsx

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,14 @@ const EditorToolbar = ({
4242
actionBtnsProps,
4343
showControlBtns,
4444
isAdmin = false,
45-
isPremium = false,
4645
isHistory = false,
4746
}) => (
4847
<>
49-
<div ref={toolbarRef} className="cb-bg-panel cb-border-color rounded-top" data-player-type={type}>
48+
<div
49+
ref={toolbarRef}
50+
className="cb-bg-panel cb-border-color rounded-top"
51+
data-player-type={type}
52+
>
5053
<div className={toolbarClassNames} role="toolbar">
5154
<div className="d-flex justify-content-between">
5255
<div
@@ -68,15 +71,27 @@ const EditorToolbar = ({
6871
role="group"
6972
aria-label="Report actions"
7073
>
71-
{(isAdmin || isPremium) && !showControlBtns && <GameReportButton userId={player.id} gameId={gameId} />}
72-
{isAdmin && !showControlBtns && <GameBanPlayerButton userId={player.id} status={status} tournamentId={tournamentId} />}
74+
{!showControlBtns && (
75+
<GameReportButton userId={player.id} gameId={gameId} />
76+
)}
77+
{isAdmin && !showControlBtns && (
78+
<GameBanPlayerButton
79+
userId={player.id}
80+
status={status}
81+
tournamentId={tournamentId}
82+
/>
83+
)}
7384
</div>
7485
<div
7586
className={userInfoClassNames}
7687
role="group"
7788
aria-label="User info"
7889
>
79-
<UserInfo mode="dark" user={player} placement={Placements.bottomEnd} />
90+
<UserInfo
91+
mode="dark"
92+
user={player}
93+
placement={Placements.bottomEnd}
94+
/>
8095
{mode === GameRoomModes.standard && (
8196
<UserGameScore userId={player.id} />
8297
)}

services/app/apps/codebattle/assets/js/widgets/pages/game/GameReportButton.jsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import cn from 'classnames';
44
import { useDispatch, useSelector } from 'react-redux';
55

66
import { reportOnPlayer } from '@/middlewares/Main';
7-
import { userIsAdminSelector, userIsGamePlayerSelector } from '@/selectors';
7+
import {
8+
currentUserIsAdminSelector,
9+
userIsGamePlayerSelector,
10+
} from '@/selectors';
811

912
import i18n from '../../../i18n';
1013

@@ -18,18 +21,22 @@ const states = {
1821
const getText = state => {
1922
switch (state) {
2023
case states.loading:
21-
case states.idle: return i18n.t('Report');
22-
case states.success: return i18n.t('Sended');
23-
case states.error: return i18n.t('Error');
24-
default: return i18n.t('Report');
24+
case states.idle:
25+
return i18n.t('Report');
26+
case states.success:
27+
return i18n.t('Sended');
28+
case states.error:
29+
return i18n.t('Error');
30+
default:
31+
return i18n.t('Report');
2532
}
2633
};
2734

2835
const GameReportButton = ({ userId, gameId }) => {
2936
const dispatch = useDispatch();
3037
const [state, setState] = useState(states.idle);
3138

32-
const isAdmin = useSelector(userIsAdminSelector);
39+
const isAdmin = useSelector(currentUserIsAdminSelector);
3340
const isPlayer = useSelector(userIsGamePlayerSelector);
3441

3542
const onSuccess = () => setState(states.success);

0 commit comments

Comments
 (0)