Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 1d5302f

Browse files
authored
UI fixes in button bar and 2020 → 2021 (#80)
* Remove AI Match option from button bar * Change 2020 to 2021 * Remove run button from button bar * Remove run button from react tour * Save code before committing and submitting * Add descriptive tooltip for submit * Update prize info
1 parent 0306d41 commit 1d5302f

File tree

11 files changed

+32
-75
lines changed

11 files changed

+32
-75
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# CodeCharacter Web
2-
Web App for the frontend of CodeCharacter 2020
2+
Web App for the frontend of CodeCharacter 2021
33

44
## Installation
55

__tests__/app/containers/__snapshots__/Editor.test.tsx.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ exports[`Editor Container Should render Editor 1`] = `
1010
1111
State PlayerCode::update(State state) {
1212
13-
// Hello and Welcome to Code Character 2020!!
13+
// Hello and Welcome to Code Character 2021!!
1414
1515
// Code Character is a strategy code writing competition, where you'll be
1616
// controlling some robots that will face off against each other

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "codecharacter-web-2020",
2+
"name": "codecharacter-web-2021",
33
"version": "1.0.0",
44
"private": true,
55
"description": "Web App for CodeCharacter",

src/app/components/PopUpMenu.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ export default class PopUpMenu extends React.Component<{}, ElementOwnProps> {
4545
Documentation
4646
</div>
4747
</a>
48-
<a href="https://www.pragyan.org/20/" target="_blank">
48+
<a href="https://www.pragyan.org/21/" target="_blank">
4949
<div className={classnames(styles['menu-item'], styles['menu-item-documentation'])}>
5050
<div>
5151
<img
52-
src="https://www.pragyan.org/20/cms/templates/common/site/images/favicon.ico"
52+
src="https://www.pragyan.org/21/cms/templates/common/site/images/favicon.ico"
5353
alt="pragyan"
5454
width="25px"
5555
height="22px"
@@ -60,7 +60,7 @@ export default class PopUpMenu extends React.Component<{}, ElementOwnProps> {
6060
</a>
6161

6262
<a
63-
href="https://forum.pragyan.org/t/code-character-frequently-asked-questions/20"
63+
href="https://forum.pragyan.org/t/code-character-frequently-asked-questions/21"
6464
target="_blank"
6565
>
6666
<div className={classnames(styles['menu-item'], styles['menu-item-discourse'])}>

src/app/components/ReactTour.tsx

-12
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,6 @@ const tourConfig: ReactourStep[] = [
119119
position: 'bottom',
120120
selector: '[id="clear_gamelog_button"]',
121121
},
122-
{
123-
content: () => (
124-
<div>
125-
<h6>Run Game</h6>
126-
<p className={classnames(styles['step-description'])}>
127-
Click to compile code and run the game simulation
128-
</p>
129-
</div>
130-
),
131-
position: 'bottom',
132-
selector: '[id="run_button"]',
133-
},
134122
{
135123
content: () => (
136124
<div>

src/app/components/SubmitBar/RunOptions.tsx

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { faBrain, faRobot } from '@fortawesome/free-solid-svg-icons';
1+
import { faBrain } from '@fortawesome/free-solid-svg-icons';
22
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
33
import { SubmissionActions } from 'app/actions';
44
import * as styles from 'app/styles/RunOptions.module.css';
@@ -62,17 +62,6 @@ export class RunOptions extends React.Component<
6262
},
6363
];
6464

65-
if (aiIds) {
66-
aiIds.map((aiId) => {
67-
matchOptions.push({
68-
aiId,
69-
icon: <FontAwesomeIcon icon={faRobot} />,
70-
name: `AI Match`,
71-
type: SubmissionActions.Type.AI_MATCH,
72-
});
73-
});
74-
}
75-
7665
const mapOptions = (
7766
<div className={classnames(styles['dropdown-submenu'])}>
7867
{maps.map((mapElement) => (

src/app/components/SubmitBar/index.tsx

+14-23
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
faCog,
66
faExclamationCircle,
77
faLock,
8-
faPlay,
98
faSave,
109
faTrash,
1110
} from '@fortawesome/free-solid-svg-icons';
@@ -143,23 +142,6 @@ export class SubmitBar extends React.Component<
143142
</span>
144143
</button>
145144
</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>
163145
{debugRunAvailable ? (
164146
<Tooltip title="Debug Code">
165147
<button
@@ -204,14 +186,16 @@ export class SubmitBar extends React.Component<
204186
<span>COMMIT</span>
205187
</button>
206188
</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+
>
208194
<button
209195
className={classnames(styles.customBtn)}
210196
title="Submit Code"
211197
id="submit_button"
212-
onClick={(e) => {
213-
this.props.lockCode();
214-
}}
198+
onClick={this.handleSubmit}
215199
>
216200
<span className={classnames(styles.icon)}>
217201
<FontAwesomeIcon icon={faLock} />
@@ -334,12 +318,19 @@ export class SubmitBar extends React.Component<
334318

335319
private handleCommit = async () => {
336320
const { commitMessage } = this.state;
337-
const { commit, getCommitLog } = this.props;
321+
const { commit, getCommitLog, saveCode } = this.props;
322+
await saveCode();
338323
await commit(commitMessage);
339324
await this.toggleCommitMessageBox(false);
340325
await getCommitLog();
341326
};
342327

328+
private handleSubmit = async () => {
329+
const { saveCode, lockCode } = this.props;
330+
await saveCode();
331+
await lockCode();
332+
};
333+
343334
private startStoryModeMatch = async (mapId: number, aiId: number) => {
344335
const {
345336
toggleStoryModeModal,

src/app/components/Welcome.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class Welcome extends React.Component<
1919
<Modal.Header>
2020
<Modal.Title>
2121
<div style={{ margin: 0 }}>
22-
<b>Welcome to Code Character 2020!</b>
22+
<b>Welcome to Code Character 2021!</b>
2323
</div>
2424
</Modal.Title>
2525
<button
@@ -48,7 +48,7 @@ export class Welcome extends React.Component<
4848
<b>
4949
Found a bug? Want a new feature? Post in the{' '}
5050
<a
51-
href="https://forum.pragyan.org/t/code-character-frequently-asked-questions/20"
51+
href="https://forum.pragyan.org/t/code-character-frequently-asked-questions/21"
5252
target="_blank"
5353
>
5454
Forum

src/app/components/home/Footer.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ export const Footer: React.FunctionComponent = () => {
4848
<a href="https://code.pragyan.org/docs">Documentation</a>
4949
</li>
5050
<li>
51-
<a href="https://www.pragyan.org/20/home/events/bytehoc/code_character/">
51+
<a href="https://www.pragyan.org/21/home/events/bytehoc/code_character/">
5252
Pragyan - CodeCharacter
5353
</a>
5454
</li>
5555
<li>
56-
<a href="https://forum.pragyan.org/t/code-character-frequently-asked-questions/20">
56+
<a href="https://forum.pragyan.org/t/code-character-frequently-asked-questions/21">
5757
Forum
5858
</a>
5959
</li>
@@ -72,7 +72,7 @@ export const Footer: React.FunctionComponent = () => {
7272
)}
7373
>
7474
<div className="col text-center">
75-
&copy; 2020 Made with <span style={{ color: 'red' }}></span> by{' '}
75+
&copy; 2021 Made with <span style={{ color: 'red' }}></span> by{' '}
7676
<a href="https://delta.nitt.edu"> Delta Force</a>
7777
</div>
7878
</div>

src/app/components/home/LandingPage.tsx

+5-16
Original file line numberDiff line numberDiff line change
@@ -82,31 +82,20 @@ export class LandingPage extends React.Component<LandingPageInterfaces.Props, {}
8282
<p>
8383
In case of any queries, discuss at the{' '}
8484
<a
85-
href="https://forum.pragyan.org/t/code-character-frequently-asked-questions/20"
85+
href="https://forum.pragyan.org/t/code-character-frequently-asked-questions/21"
8686
target="_blank"
8787
>
8888
CodeCharacter Forum
8989
</a>{' '}
9090
.
9191
</p>
9292
<h1>Prizes</h1>
93-
<p>A total of 50K INR up for grabs for acing the leaderboard.</p>
94-
<h6>College Students</h6>
93+
<p>A total of 15K INR up for grabs for acing the leaderboard.</p>
9594
<ul>
96-
<li>First Place - 10K INR</li>
97-
<li>Second Place - 6K INR</li>
98-
<li>Third Place - 4K INR</li>
95+
<li>First Place - 7.5K INR</li>
96+
<li>Second Place - 4.5K INR</li>
97+
<li>Third Place - 3K INR</li>
9998
</ul>
100-
<h6>Professionals</h6>
101-
<ul>
102-
<li>First Place - 15K INR</li>
103-
<li>Second Place - 10K INR</li>
104-
<li>Third Place - 5K INR</li>
105-
</ul>
106-
<p>
107-
Note: College Student Winners will be requested to provide valid college proof to
108-
collect prizes.
109-
</p>
11099
</div>
111100
<div className={classnames(styles['codechar-video'], 'col-lg-5')}>
112101
<img width="auto" height="auto" src="./assets/img/bot_hi.png" />

src/app/reducers/code/Code.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const codeStoreInitialState: CodeInterfaces.CodeStoreState = {
1010
1111
State PlayerCode::update(State state) {
1212
13-
// Hello and Welcome to Code Character 2020!!
13+
// Hello and Welcome to Code Character 2021!!
1414
1515
// Code Character is a strategy code writing competition, where you'll be
1616
// controlling some robots that will face off against each other

0 commit comments

Comments
 (0)