Skip to content

Commit df81920

Browse files
committed
submission ui modified
2 parents c2bb526 + 2cc7041 commit df81920

55 files changed

Lines changed: 343 additions & 205 deletions

Some content is hidden

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

codecamp-front/.angular-cli.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030
"../node_modules/ace-builds/src-min/ace.js",
3131
"../node_modules/ace-builds/src-min/theme-sqlserver.js",
3232
"../node_modules/ace-builds/src-min/mode-python.js",
33-
"../node_modules/ace-builds/src-min/mode-java.js"
33+
"../node_modules/ace-builds/src-min/mode-java.js",
34+
"../node_modules/ace-builds/src-min/mode-c_cpp.js"
3435
],
36+
3537
"environmentSource": "environments/environment.ts",
3638
"environments": {
3739
"dev": "environments/environment.ts",

codecamp-front/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"@angular/platform-server": "5.2.7",
2424
"@angular/router": "5.2.7",
2525
"@types/jquery": "3.3.0",
26-
"angular2-flash-messages": "2.0.5",
26+
"angular2-flash-messages": "^2.0.5",
2727
"angular2-jwt": "0.2.3",
2828
"bootstrap": "4.0.0-beta.2",
2929
"core-js": "2.4.1",

codecamp-front/src/app/app-routing.module.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@ const appRoutes: Routes = [
3838
},
3939
{
4040
path: 'register',
41-
component: RegisterComponent
41+
component: RegisterComponent,
42+
canActivate: [NotAuthGuard]
4243
},
4344
{
4445
path: 'login',
45-
component: LoginComponent
46+
component: LoginComponent,
47+
canActivate: [NotAuthGuard]
4648
},
4749
{
4850
path: 'practice',
@@ -71,7 +73,8 @@ const appRoutes: Routes = [
7173
},
7274
{
7375
path: ':contest/submit/:code',
74-
component: SolultionSubmitComponent
76+
component: SolultionSubmitComponent,
77+
canActivate: [AuthGuard]
7578
},
7679
{
7780
path: 'submit/complete',
@@ -92,6 +95,10 @@ const appRoutes: Routes = [
9295
component: AddProblemComponent,
9396
canActivate: [AuthGuard]
9497
},
98+
{
99+
path: 'contest/:contest/ranking',
100+
component: RanklistComponent
101+
},
95102
{
96103
path: 'contest/:contest/:problem',
97104
component: ProblemComponent
@@ -104,11 +111,12 @@ const appRoutes: Routes = [
104111
path: 'contest/edit/:edit-contest',
105112
component: EditContestComponent,
106113
canActivate: [AuthGuard]
107-
}
114+
},
115+
{ path: '**', component: HomeComponent }
108116
];
109117

110118
@NgModule({
111-
imports: [RouterModule.forRoot(appRoutes)],
119+
imports: [RouterModule.forRoot(appRoutes, {useHash: true})],
112120
exports: [RouterModule]
113121
})
114122
export class AppRoutingModule {

codecamp-front/src/app/app.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<div class="container-fluid">
1212
<app-sidebar></app-sidebar>
1313
<div class="wrapper" [@panelInOut]="panelVisible">
14+
<flash-messages></flash-messages>
1415
<router-outlet></router-outlet>
1516
</div>
1617
</div>

codecamp-front/src/app/app.module.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import { RanklistComponent } from './components/ranklist/ranklist.component';
3030
import { SolutionComponent } from './components/solultion-submit/solution/solution.component';
3131
import { ProblemComponent } from './components/problem/problem.component';
3232
import { AddProblemComponent } from './components/add-problem/add-problem.component';
33-
import { TimerComponent } from './components/timer/timer.component'
3433

3534

3635
import { AuthGuard } from './guards/auth.guard';
@@ -41,6 +40,7 @@ import { SidebarComponent } from './components/sidebar/sidebar.component';
4140
import { NgProgressModule, NgProgressBrowserXhr } from 'ngx-progressbar';
4241
import { BrowserXhr } from '@angular/http';
4342
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
43+
import { FlashMessagesModule } from 'angular2-flash-messages';
4444

4545
@NgModule({
4646
declarations: [
@@ -66,8 +66,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
6666
SolultionSubmitComponent,
6767
PreloaderComponent,
6868
SidebarComponent,
69-
EditProfileComponent,
70-
TimerComponent
69+
EditProfileComponent
7170
],
7271
imports: [
7372
BrowserModule,
@@ -76,10 +75,11 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7675
AppRoutingModule,
7776
AceEditorModule,
7877
NgProgressModule,
79-
BrowserAnimationsModule
78+
BrowserAnimationsModule,
79+
FlashMessagesModule.forRoot()
8080
],
8181
providers: [ AuthService, AuthGuard, NotAuthGuard, ContestService,
82-
{provide: BrowserXhr, useClass: NgProgressBrowserXhr}],
82+
{provide: BrowserXhr, useClass: NgProgressBrowserXhr}, ],
8383
bootstrap: [AppComponent]
8484
})
8585
export class AppModule { }
Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +0,0 @@
1-
.file-input, .file-output{
2-
padding: 10px;
3-
background: red;
4-
display: table;
5-
color: #fff;
6-
}
7-
8-
.file-output{
9-
background: green;
10-
}
11-
12-
input[type="file"] {
13-
display: none;
14-
}

codecamp-front/src/app/components/add-problem/add-problem.component.html

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@
8686
class="form-control" placeholder="Enter Description" autocomplete="off" rows="10">
8787
</textarea>
8888
</div>
89+
<div class="form-group">
90+
<label for="Constraint">Constraint</label>
91+
<textarea
92+
name="constraints"
93+
formControlName="constraints"
94+
class="form-control" placeholder="Enter Constraints" autocomplete="off" rows="10">
95+
</textarea>
96+
</div>
8997
<div class="row">
9098
<div class="col-md-6">
9199
<div class="form-group">
@@ -139,11 +147,10 @@
139147
</textarea>
140148
</div>
141149
</div>
142-
</div>
143-
<div class="row">
150+
</div><div class="row">
144151
<div class="col-md-6">
145152
<div class="form-group">
146-
<label for="Input TestCase">Input File</label>
153+
<label for="Input File">Input File</label>
147154
<textarea
148155
name="Input"
149156
formControlName="Input"
@@ -156,9 +163,9 @@
156163
</div>
157164
<div class="col-md-6">
158165
<div class="form-group">
159-
<label for="output_example">Output File</label>
166+
<label for="output File">Output File</label>
160167
<textarea
161-
name="Output"
168+
name="Output"
162169
formControlName="Output"
163170
class="form-control"
164171
placeholder="Output Test case"
@@ -168,13 +175,12 @@
168175
</div>
169176
</div>
170177
</div>
171-
172178
<div class="form-group">
173179
<label for="Explanation Example">Explanation Example</label>
174180
<textarea
175181
name="explanation_example"
176182
formControlName="explanation_example"
177-
class="form-control" placeholder="Explanation Example" autocomplete="off" rows="10">
183+
class="form-control" placehzolder="Explanation Example" autocomplete="off" rows="10">
178184
</textarea>
179185
</div>
180186

codecamp-front/src/app/components/add-problem/add-problem.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
22
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
33
import { ContestService } from '../../services/contest.service';
44
import { Router, ActivatedRoute } from '@angular/router';
5+
import { FlashMessagesService } from 'angular2-flash-messages';
56
@Component({
67
selector: 'app-add-problem',
78
templateUrl: './add-problem.component.html',
@@ -14,7 +15,8 @@ export class AddProblemComponent implements OnInit {
1415
private contestService: ContestService,
1516
private router: Router,
1617
private formBuilder: FormBuilder,
17-
private route: ActivatedRoute
18+
private route: ActivatedRoute,
19+
private _flashMessagesService: FlashMessagesService
1820
) { }
1921

2022
ngOnInit() {
@@ -63,8 +65,9 @@ export class AddProblemComponent implements OnInit {
6365

6466
this.contestService.addProblem(problem, this.contest).subscribe(data => {
6567
if (!data.success) {
66-
console.log(data.msg);
68+
this._flashMessagesService.show(data.msg, { cssClass: 'alert-danger' } );
6769
} else {
70+
this._flashMessagesService.show(data.msg, { cssClass: 'alert-success' } );
6871
this.router.navigate(['/contest', this.contest]);
6972
}
7073
});

codecamp-front/src/app/components/contest/contest.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class ContestComponent implements OnInit {
2929
}
3030

3131
replaceTZ(time) {
32-
return time && time.replace(/[TZ]|.000/g,'<br>');
32+
return time && time.replace(/[TZ]|.000/g, '<br>');
3333
}
3434
onSelectContest(i) {
3535
this.contestname = i.name;

codecamp-front/src/app/components/home/home.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<h1>CodeCamp
99
</h1>
1010

11-
<h3 class="title"> Eat, Sleep and Code. </h3>
11+
<h3 class="title"> Eat, Code, Sleep and Repeat </h3>
1212
</div>
1313
</div>
1414
</div>

0 commit comments

Comments
 (0)