Skip to content

Commit bab8dd3

Browse files
committed
App Build
1 parent df8633b commit bab8dd3

29 files changed

Lines changed: 98 additions & 88 deletions

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: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ const appRoutes: Routes = [
3737
},
3838
{
3939
path: 'register',
40-
component: RegisterComponent
40+
component: RegisterComponent,
41+
canActivate: [NotAuthGuard]
4142
},
4243
{
4344
path: 'login',
44-
component: LoginComponent
45+
component: LoginComponent,
46+
canActivate: [NotAuthGuard]
4547
},
4648
{
4749
path: 'practice',
@@ -66,7 +68,8 @@ const appRoutes: Routes = [
6668
},
6769
{
6870
path: ':contest/submit/:code',
69-
component: SolultionSubmitComponent
71+
component: SolultionSubmitComponent,
72+
canActivate: [AuthGuard]
7073
},
7174
{
7275
path: 'submit/complete',
@@ -103,11 +106,12 @@ const appRoutes: Routes = [
103106
path: 'contest/edit/:edit-contest',
104107
component: EditContestComponent,
105108
canActivate: [AuthGuard]
106-
}
109+
},
110+
{ path: '**', component: HomeComponent }
107111
];
108112

109113
@NgModule({
110-
imports: [RouterModule.forRoot(appRoutes)],
114+
imports: [RouterModule.forRoot(appRoutes, {useHash: true})],
111115
exports: [RouterModule]
112116
})
113117
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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import { SidebarComponent } from './components/sidebar/sidebar.component';
3838
import { NgProgressModule, NgProgressBrowserXhr } from 'ngx-progressbar';
3939
import { BrowserXhr } from '@angular/http';
4040
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
41+
import { FlashMessagesModule } from 'angular2-flash-messages';
4142

4243
@NgModule({
4344
declarations: [
@@ -71,10 +72,11 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7172
AppRoutingModule,
7273
AceEditorModule,
7374
NgProgressModule,
74-
BrowserAnimationsModule
75+
BrowserAnimationsModule,
76+
FlashMessagesModule.forRoot()
7577
],
7678
providers: [ AuthService, AuthGuard, NotAuthGuard, ContestService,
77-
{provide: BrowserXhr, useClass: NgProgressBrowserXhr}],
79+
{provide: BrowserXhr, useClass: NgProgressBrowserXhr}, ],
7880
bootstrap: [AppComponent]
7981
})
8082
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: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@
8989
<div class="form-group">
9090
<label for="Constraint">Constraint</label>
9191
<textarea
92-
name="constraint"
93-
formControlName="constraint"
94-
class="form-control" placeholder="Enter Constraint" autocomplete="off" rows="10">
92+
name="constraints"
93+
formControlName="constraints"
94+
class="form-control" placeholder="Enter Constraints" autocomplete="off" rows="10">
9595
</textarea>
9696
</div>
9797
<div class="row">
@@ -147,11 +147,10 @@
147147
</textarea>
148148
</div>
149149
</div>
150-
</div>
151-
<div class="row">
150+
</div><div class="row">
152151
<div class="col-md-6">
153152
<div class="form-group">
154-
<label for="Input TestCase">Input File</label>
153+
<label for="Input File">Input File</label>
155154
<textarea
156155
name="Input"
157156
formControlName="Input"
@@ -164,9 +163,9 @@
164163
</div>
165164
<div class="col-md-6">
166165
<div class="form-group">
167-
<label for="output_example">Output File</label>
166+
<label for="output File">Output File</label>
168167
<textarea
169-
name="Output"
168+
name="Output"
170169
formControlName="Output"
171170
class="form-control"
172171
placeholder="Output Test case"
@@ -176,13 +175,12 @@
176175
</div>
177176
</div>
178177
</div>
179-
180178
<div class="form-group">
181179
<label for="Explanation Example">Explanation Example</label>
182180
<textarea
183181
name="explanation_example"
184182
formControlName="explanation_example"
185-
class="form-control" placeholder="Explanation Example" autocomplete="off" rows="10">
183+
class="form-control" placehzolder="Explanation Example" autocomplete="off" rows="10">
186184
</textarea>
187185
</div>
188186

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/login/login.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
22
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
33
import { AuthService } from '../../services/auth.service';
44
import { Router } from '@angular/router';
5+
import { FlashMessagesService } from 'angular2-flash-messages';
56

67
@Component({
78
selector: 'app-login',
@@ -16,7 +17,8 @@ export class LoginComponent implements OnInit {
1617
constructor(
1718
private authService: AuthService,
1819
private router: Router,
19-
private formBuilder: FormBuilder
20+
private formBuilder: FormBuilder,
21+
private _flashMessagesService: FlashMessagesService
2022
) {
2123
this.createForm();
2224
}
@@ -41,7 +43,7 @@ export class LoginComponent implements OnInit {
4143
};
4244
this.authService.loginUser(user).subscribe(data => {
4345
if(!data.success){
44-
this.message = data.msg;
46+
this._flashMessagesService.show(data.msg, { cssClass: 'alert-danger', timeout: 2000});
4547
}
4648
else{
4749
this.authService.storeUserData(data.token, data.user);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export class ProblemComponent implements OnInit {
2424
this.contest = this.route.snapshot.params['contest'];
2525
this.contestService.getProblem(this.code, this.contest).subscribe(data => {
2626
this.problem = data.problem;
27-
console.log(this.problem);
2827
});
2928
}
3029

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export class ProblemsComponent implements OnInit {
2525
this.contest = this.route.snapshot.params['contest'];
2626
this.contestService.getProblems(this.contest).subscribe(contest => {
2727
this.problems = contest.msg[0].questions;
28-
console.log(contest.msg);
2928
});
3029
this.contestService.currentContest.subscribe(contest => this.contestname=contest);
3130
}

0 commit comments

Comments
 (0)