Skip to content

Commit 35ad228

Browse files
Get ready
1 parent 986eaf5 commit 35ad228

File tree

12 files changed

+106
-47
lines changed

12 files changed

+106
-47
lines changed

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1-
# codeblue package
1+
# codeblue package for Atom text editor
22

3-
This is a wild game
3+
[![APM version](https://img.shields.io/apm/v/codeblue?style=flat-square)](https://atom.io/packages/codeblue)
4+
[![APM downloads](https://img.shields.io/apm/dm/codeblue?style=flat-square)](https://atom.io/packages/codeblue)
5+
[![APM Licence](https://img.shields.io/badge/licence-MIT-orange?style=flat-square)](https://opensource.org/licences/MIT)
6+
[![Follow me](https://img.shields.io/github/followers/blueedgetechno?label=follow%20me&style=social)](https://github.com/blueedgetechno)
47

5-
![A screenshot of your package](https://f.cloud.github.com/assets/69169/2290250/c35d867a-a017-11e3-86be-cd7c5bf3ff9b.gif)
8+
[![forthebadge made-by-hipster](https://forthebadge.com/images/badges/built-by-hipsters.svg)](https://www.javascript.com/)
9+
[![ForTheBadge built-with-love](http://ForTheBadge.com/images/badges/built-with-love.svg)](https://github.com/blueedgetechno)
10+
11+
## "An Atom package for all your competitive coding needs"
12+
<br>
13+
```apm install codeblue ```
14+
15+
![A screenshot of your package](https://raw.githubusercontent.com/blueedgetechno/codeblue/master/img/face.png)

img/error.png

76.1 KB
Loading

img/face.png

120 KB
Loading

img/game.png

203 KB
Loading

img/mle.png

5.11 KB
Loading

img/run.png

47.3 KB
Loading

img/tle.png

71.9 KB
Loading

img/work.png

189 KB
Loading

lib/view/index.js

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@ function couple(x) {
1818
export default class Root extends React.PureComponent {
1919
constructor(props){
2020
super(props);
21-
// this.state = {
22-
// desc: "",
23-
// id: "",
24-
// finished: 0,
25-
// changed: 0,
26-
// createnv: false,
27-
// timeremaining: 0,
28-
// profimg: "//imgbin.com/png/LGzVdNb1/computer-icons-avatar-user-login-png"
29-
// };
30-
3121
this.state = {
32-
desc: "codeforces div 2",
33-
id: 1388,
22+
desc: "",
23+
id: "",
3424
finished: 0,
35-
changed: 2,
25+
changed: 0,
3626
createnv: false,
37-
timeremaining: 84600,
38-
profimg: "//templates.joomla-monster.com/joomla30/jm-news-portal/components/com_djclassifieds/assets/images/default_profile.png"
27+
timeremaining: 0,
28+
profimg: "//imgbin.com/png/LGzVdNb1/computer-icons-avatar-user-login-png"
3929
};
30+
31+
// this.state = {
32+
// desc: "codeforces div 2",
33+
// id: 1388,
34+
// finished: 0,
35+
// changed: 2,
36+
// createnv: false,
37+
// timeremaining: 84600,
38+
// profimg: "//templates.joomla-monster.com/joomla30/jm-news-portal/components/com_djclassifieds/assets/images/default_profile.png"
39+
// };
4040
}
4141

4242
timesolver(s){
@@ -106,6 +106,13 @@ export default class Root extends React.PureComponent {
106106
}
107107
}
108108

109+
backspace(){
110+
var s = this.state.id
111+
if(s.length){
112+
this.setState({id: s.slice(0,-1)})
113+
}
114+
}
115+
109116
fetchenvalue(event){
110117
if(event.target){
111118
this.setState({createnv: event.target.checked});
@@ -144,11 +151,14 @@ export default class Root extends React.PureComponent {
144151

145152
{this.state.changed==0 ? (
146153
<div className="fillup">
147-
<span>ContestId</span>
148-
<input type="text" value={this.state.id} onChange={this.fetchinput.bind(this)}/>
154+
<div className="firstrow">
155+
<span>ContestId</span>
156+
<input type="text" value={this.state.id} onChange={this.fetchinput.bind(this)}/>
157+
<button className="back" onClick={this.backspace.bind(this)}> <i className="icon-chevron-left"></i> </button>
158+
</div>
149159
<br/><input type="checkbox" id="check" onChange={this.fetchenvalue.bind(this)}/>
150160
<span className="checkthis">Create environment</span>
151-
<br/><button onClick={()=> this.display()}>Submit</button>
161+
<br/><button id="submit" onClick={()=> this.display()}>Submit</button>
152162
</div>
153163
) : null}
154164

lib/view/problems.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default class Problems extends React.PureComponent {
1414
this.state = {
1515
temp: 0,
1616
curr: 0,
17+
createnv: props.contest.createnv,
1718
mystanding: -1,
1819
probs: [],
1920
noftests: [],
@@ -152,6 +153,9 @@ export default class Problems extends React.PureComponent {
152153
return
153154
}
154155
}
156+
157+
this.setState({createnv: 0})
158+
155159
const setup = require('./setup');
156160
var wd = atom.config.get("codeblue.workingDirectory")
157161

@@ -172,7 +176,6 @@ export default class Problems extends React.PureComponent {
172176
this.state.alloutputs[prob.index])
173177
i++
174178
}
175-
176179
}
177180

178181
scrapetests(html, index){
@@ -210,7 +213,7 @@ export default class Problems extends React.PureComponent {
210213
this.setState({alloutputs: alloutputs})
211214
this.setState({allverdicts: allverdicts})
212215
// console.log(this.state.allverdicts);
213-
if(this.props.contest.createnv){
216+
if(this.state.createnv){
214217
this.createnv()
215218
}
216219
}
@@ -366,6 +369,19 @@ export default class Problems extends React.PureComponent {
366369
.catch(err => console.log(err))
367370
}
368371

372+
restart(){
373+
// console.log("Hurray");
374+
// return
375+
var url = "https://codeforces.com/api/contest.standings?contestId="+this.props.contest.id+"&from=1&count=1"
376+
fetch(url)
377+
.then(res=>res.json())
378+
.then(res=> this.fetchproblems(res.result.problems))
379+
.catch(err=>{
380+
console.log(err)
381+
atom.notifications.addWarning("Error while fetching problems")
382+
})
383+
}
384+
369385
componentWillMount(){
370386
var url = "https://codeforces.com/api/contest.standings?contestId="+this.props.contest.id+"&from=1&count=1"
371387
fetch(url)
@@ -441,6 +457,7 @@ export default class Problems extends React.PureComponent {
441457
<div className="headinfo">
442458
<span onClick={this.hide}><i className="icon-person"></i> {this.state.mystanding} </span>
443459
<button className="refreshsubmissions" onClick={this.loadsubmissions.bind(this)}>Refresh</button>
460+
<button className="refreshproblems" onClick={this.restart.bind(this)}>Restart</button>
444461
</div>
445462
: null }
446463
<div className="problems" style={{display: "flex"}}>

0 commit comments

Comments
 (0)