|
5 | 5 | faCog,
|
6 | 6 | faExclamationCircle,
|
7 | 7 | faLock,
|
8 |
| - faPlay, |
9 | 8 | faSave,
|
10 | 9 | faTrash,
|
11 | 10 | } from '@fortawesome/free-solid-svg-icons';
|
@@ -143,23 +142,6 @@ export class SubmitBar extends React.Component<
|
143 | 142 | </span>
|
144 | 143 | </button>
|
145 | 144 | </Tooltip>
|
146 |
| - <Tooltip title="Run Code"> |
147 |
| - <button |
148 |
| - className={classnames(styles.customBtn)} |
149 |
| - id="run_button" |
150 |
| - onClick={(event: React.MouseEvent<HTMLButtonElement>) => { |
151 |
| - this.setState({ |
152 |
| - isRunOptionsOpen: !isRunOptionsOpen, |
153 |
| - }); |
154 |
| - event.stopPropagation(); |
155 |
| - }} |
156 |
| - > |
157 |
| - <span className={classnames(styles.icon)}> |
158 |
| - <FontAwesomeIcon icon={faPlay} /> |
159 |
| - </span> |
160 |
| - <span>RUN</span> |
161 |
| - </button> |
162 |
| - </Tooltip> |
163 | 145 | {debugRunAvailable ? (
|
164 | 146 | <Tooltip title="Debug Code">
|
165 | 147 | <button
|
@@ -204,14 +186,16 @@ export class SubmitBar extends React.Component<
|
204 | 186 | <span>COMMIT</span>
|
205 | 187 | </button>
|
206 | 188 | </Tooltip>
|
207 |
| - <Tooltip title="Submit Code"> |
| 189 | + <Tooltip |
| 190 | + title="Submit Code: This will submit your code as your current competitive AI. All your challenges with other |
| 191 | + players in the leaderboard will be played using this code. |
| 192 | + You have to submit your code before challenging an opponent." |
| 193 | + > |
208 | 194 | <button
|
209 | 195 | className={classnames(styles.customBtn)}
|
210 | 196 | title="Submit Code"
|
211 | 197 | id="submit_button"
|
212 |
| - onClick={(e) => { |
213 |
| - this.props.lockCode(); |
214 |
| - }} |
| 198 | + onClick={this.handleSubmit} |
215 | 199 | >
|
216 | 200 | <span className={classnames(styles.icon)}>
|
217 | 201 | <FontAwesomeIcon icon={faLock} />
|
@@ -334,12 +318,19 @@ export class SubmitBar extends React.Component<
|
334 | 318 |
|
335 | 319 | private handleCommit = async () => {
|
336 | 320 | const { commitMessage } = this.state;
|
337 |
| - const { commit, getCommitLog } = this.props; |
| 321 | + const { commit, getCommitLog, saveCode } = this.props; |
| 322 | + await saveCode(); |
338 | 323 | await commit(commitMessage);
|
339 | 324 | await this.toggleCommitMessageBox(false);
|
340 | 325 | await getCommitLog();
|
341 | 326 | };
|
342 | 327 |
|
| 328 | + private handleSubmit = async () => { |
| 329 | + const { saveCode, lockCode } = this.props; |
| 330 | + await saveCode(); |
| 331 | + await lockCode(); |
| 332 | + }; |
| 333 | + |
343 | 334 | private startStoryModeMatch = async (mapId: number, aiId: number) => {
|
344 | 335 | const {
|
345 | 336 | toggleStoryModeModal,
|
|
0 commit comments