Skip to content

Commit b2ca278

Browse files
Hail i don't know
1 parent 1fb8999 commit b2ca278

File tree

3 files changed

+110
-57
lines changed

3 files changed

+110
-57
lines changed

lib/view/index.js

Lines changed: 17 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: 1397,
22+
desc: "",
23+
id: "",
3424
finished: 0,
35-
changed: 1,
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: 1397,
34+
// finished: 0,
35+
// changed: 1,
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){
@@ -109,7 +109,6 @@ export default class Root extends React.PureComponent {
109109
fetchenvalue(event){
110110
if(event.target){
111111
this.setState({createnv: event.target.checked});
112-
console.log(this.state.createnv);
113112
}
114113
}
115114

@@ -147,8 +146,8 @@ export default class Root extends React.PureComponent {
147146
<div className="fillup">
148147
<span>ContestId</span>
149148
<input type="text" value={this.state.id} onChange={this.fetchinput.bind(this)}/>
150-
<br/><input type="checkbox" onChange={this.fetchenvalue.bind(this)}/>
151-
<span>Create environment</span>
149+
<br/><input type="checkbox" id="check" onChange={this.fetchenvalue.bind(this)}/>
150+
<span className="checkthis">Create environment</span>
152151
<br/><button onClick={()=> this.display()}>Submit</button>
153152
</div>
154153
) : null}

lib/view/problems.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,41 @@ export default class Problems extends React.PureComponent {
402402
}
403403
}
404404

405+
changeproblem(activepath){
406+
if(activepath==null) return
407+
408+
const path = require('path')
409+
410+
var wd = atom.config.get("codeblue.workingDirectory")
411+
var langcode = atom.config.get("codeblue.programmingLanguage")
412+
var ext = ""
413+
if(langcode==43) ext=".c"
414+
else if(langcode==54) ext=".cpp"
415+
else ext=".py"
416+
417+
var i=0
418+
activepath = path.resolve(activepath)
419+
420+
for (var prob of this.state.probs) {
421+
var towhere = path.join(wd,prob.index)
422+
var tofile = path.join(towhere,prob.index+ext)
423+
tofile = path.resolve(tofile)
424+
if(tofile==activepath){
425+
this.setState({curr: i})
426+
break
427+
}
428+
i++;
429+
}
430+
}
431+
432+
componentDidMount() {
433+
atom.workspace.observeActiveTextEditor(editor=>{
434+
if (editor){
435+
this.changeproblem(editor.getPath())
436+
}
437+
})
438+
}
439+
405440
hide(ele){
406441
if(ele==null) return
407442
var parent = ele.target.parentElement

styles/codeblue.less

Lines changed: 58 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
margin-right: 10px;
4242
}
4343

44-
input {
44+
input[type=text] {
4545
border: none;
4646
padding: 5px;
4747
background: @background-color-selected;
@@ -51,6 +51,15 @@
5151
text-align: center;
5252
}
5353

54+
input[type=checkbox] {
55+
display: inline-block;
56+
width: 16pt;
57+
padding: 2px 0 0 3px;
58+
margin: 20px 10px;
59+
vertical-align: middle;
60+
cursor: pointer;
61+
}
62+
5463
button {
5564
border: none;
5665
padding: 10px;
@@ -64,6 +73,15 @@
6473
color: white;
6574
}
6675
}
76+
// #check{
77+
// border: none;
78+
// background: #888;
79+
// border-radius: 10px;
80+
// }
81+
//
82+
// .checkthis{
83+
// font-size: 1.5em;
84+
// }
6785

6886
.timer {
6987
display: flex;
@@ -93,10 +111,11 @@
93111
}
94112

95113
.headinfo {
96-
i{
114+
i {
97115
color: #d1a915;
98116
cursor: pointer;
99117
}
118+
100119
span {
101120
position: absolute;
102121
padding: 5px 10px;
@@ -140,7 +159,7 @@
140159
}
141160

142161
.prob:nth-child(even) {
143-
background-color: @background-color-selected;//#373c44;
162+
background-color: @background-color-selected; //#373c44;
144163
}
145164

146165
.totsub {
@@ -185,7 +204,7 @@
185204
border-radius: 8px;
186205
}
187206

188-
.mle{
207+
.mle {
189208
font-size: 0.8em;
190209
height: 23px;
191210
width: 80px;
@@ -318,19 +337,19 @@
318337

319338
button {
320339
border: none;
321-
background: @background-color-selected;//#383f4b;
340+
background: @background-color-selected; //#383f4b;
322341
padding: 5px 10px;
323342
border-radius: 5px;
324343
font-weight: bold;
325344
}
326345
}
327346

328-
.realsubmit{
347+
.realsubmit {
329348
background: #188330 !important;
330349
color: #fff;
331350
}
332351

333-
.cancel{
352+
.cancel {
334353
background: #a11c18 !important;
335354
color: #fff;
336355
}
@@ -342,38 +361,39 @@
342361
transition: 1s;
343362
}
344363

345-
.verdict{
364+
.verdict {
346365
display: flex;
347366
flex-direction: column;
348367
}
349368

350-
.errordetails{
369+
.errordetails {
351370
display: block;
352-
pre{
371+
372+
pre {
353373
font-weight: bold;
354374
color: @text-color;
355375
}
356376
}
357377

358-
.comparision{
378+
.comparision {
359379
display: flex;
360380
flex-direction: row;
361381
margin-bottom: 5px;
362382
}
363383

364-
.outbox{
384+
.outbox {
365385
width: 50%;
366386
margin: 1px;
367387

368-
pre{
388+
pre {
369389
background: @background-color-highlight;
370390
height: 100%;
371391
color: #ff6262;
372392
}
373393
}
374394

375-
.outbox:first-child{
376-
pre{
395+
.outbox:first-child {
396+
pre {
377397
color: #00d708;
378398
}
379399
}
@@ -385,7 +405,7 @@
385405
justify-content: space-between;
386406
padding: 5px;
387407
margin: 1px 0;
388-
background: @background-color-selected;//#191c20;
408+
background: @background-color-selected; //#191c20;
389409
border-radius: 4px;
390410

391411
span {
@@ -406,27 +426,27 @@
406426
color: #d1b330;
407427
}
408428

409-
.icon-hourglass{
429+
.icon-hourglass {
410430
color: #0ab3d4;
411431
}
412432

413433
.icon-alert {
414434
color: #ee7411;
415435
}
416436

417-
.icon-stop{
437+
.icon-stop {
418438
color: #e93961;
419439
}
420440

421-
.icon-database{
441+
.icon-database {
422442
color: #b553e4;
423443
}
424444

425-
.icon-light-bulb{
445+
.icon-light-bulb {
426446
color: #d1a915;
427447
}
428448

429-
.icon-flame{
449+
.icon-flame {
430450
color: #ffef15;
431451
}
432452

@@ -437,7 +457,7 @@
437457
margin: 1px 0;
438458
background: @background-color-highlight;
439459

440-
i{
460+
i {
441461
width: 15%;
442462
font-style: normal;
443463
font-weight: bold;
@@ -469,18 +489,17 @@
469489
}
470490
}
471491

472-
.icon-chevron-down{
492+
.icon-chevron-down {
473493
cursor: pointer;
474494
}
475495

476-
.icon-chevron-right{
496+
.icon-chevron-right {
477497
cursor: pointer;
478498
}
479499

480-
.titlename{
500+
.titlename {
481501
color: #1abc9c;
482502
}
483-
484503
// Play section
485504

486505
body {
@@ -498,7 +517,7 @@ body {
498517
}
499518

500519
.puzzle {
501-
width: 280px;;
520+
width: 280px;
502521
height: 280px;
503522
display: flex;
504523
justify-content: space-between;
@@ -507,52 +526,52 @@ body {
507526
/* flex-wrap: wrap; */
508527
}
509528

510-
.piece{
529+
.piece {
511530
width: 33%;
512531
height: 33%;
513532
background: #f4f4f4;
514-
background: url(https://images.unsplash.com/photo-1559633657-c3008b46bac6?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1100&q=80);
533+
background: url("https://images.unsplash.com/photo-1559633657-c3008b46bac6?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1100&q=80");
515534
background-size: 280px;
516535
}
517536

518-
.finalimage img{
537+
.finalimage img {
519538
width: 280px;
520539
height: 280px;
521540
}
522541

523-
.p1{
542+
.p1 {
524543
background-position: 0 0;
525544
}
526545

527-
.p2{
546+
.p2 {
528547
background-position: 50% 0;
529548
}
530549

531-
.p3{
550+
.p3 {
532551
background-position: 100% 0;
533552
}
534553

535-
.p4{
554+
.p4 {
536555
background-position: 0 50%;
537556
}
538557

539-
.p5{
558+
.p5 {
540559
background-position: 50% 50%;
541560
}
542561

543-
.p6{
562+
.p6 {
544563
background-position: 100% 50%;
545564
}
546565

547-
.p7{
566+
.p7 {
548567
background-position: 0 100%;
549568
}
550569

551-
.p8{
570+
.p8 {
552571
background-position: 50% 100%;
553572
}
554573

555-
.p9{
574+
.p9 {
556575
background-position: 100% 100%;
557576
opacity: 0;
558577
}

0 commit comments

Comments
 (0)