Skip to content

Commit 997d61e

Browse files
committed
Removed User Schema pre hook
2 parents 0a91d73 + 6b9a845 commit 997d61e

Some content is hidden

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

43 files changed

+526
-2989
lines changed

codecamp-front/package-lock.json

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
p{
2+
font-size: 15px !important;
3+
}
4+
5+
h1{
6+
color: red;
7+
text-shadow: 0.01em 0em 0 #0d24ec, 0em 0.01em 0 #091fe7, 0.02em 0.01em 0 #091fe7, 0.01em 0.02em 0 #091fe7, 0.03em 0.02em 0 #091fe7 ,
8+
0.02em 0.03em 0 #091fe7, 0.04em 0.03em 0 #091fe7, 0.03em 0.04em 0 #091fe7, 0.05em 0.04em 0 #091fe7, 0.04em 0.05em 0 #091fe7,
9+
0.06em 0.05em 0 #091fe7, 0.05em 0.06em 0 #091fe7, 0.07em 0.06em 0 #091fe7, 0.06em 0.07em 0 #091fe7, 0.08em 0.07em 0 #091fe7, 0.07em 0.08em 0 #091fe7
10+
}
Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
21
<div class="jumbotron">
3-
<h1 class="display-4">Code Camp</h1>
4-
<p class="lead">
5-
Eat, Code, Sleep and Repeat
6-
</p>
7-
<hr>
8-
<p>
9-
CodeCamp is an open-source educational initiative of the students of Techno India Salt Lake. It is a platform dedicated to cometitive coding made by students for students. It supports the 4 most used programming languages i.e, C, C++, JAVA and Python.It is a budding community of programmers. CodeCamp helps students improve their coding skills.Its objective is to provide a platform for practice, competition and improvement for students. Apart from this, it aims to reach out to high school students while they are young and inculcate a culture of programming in India.
10-
</p>
2+
<h1 class="display-4">CodeCamp</h1>
3+
<hr class="my-4">
4+
<p class="lead">CodeCamp is an open-source educational initiative of the students of Techno India Salt Lake.</p>
5+
6+
<p class="lead">It is a platform dedicated to cometitive coding made by students for students.</p>
7+
8+
<p class="lead">It supports the 4 most used programming languages i.e, C, C++, JAVA and Python.</p>
9+
10+
<p class="lead">It is a budding community of programmers.</p>
11+
12+
<p class="lead"> CodeCamp helps students improve their coding skills.Its objective is to provide a platform for practice, competition and improvement for students.</p>
13+
14+
<p class="lead"> Apart from this, it aims to reach out to high school students while they are young and inculcate a culture of programming in India.</p>
1115
</div>
Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,49 @@
1-
<div class="container">
2-
<div class="row">
3-
<div class="col-md-12">
4-
<h1 class="display-4">Online IDE</h1>
5-
<div class="row select">
6-
<h5>Select language</h5>
7-
<select (change)="selectLanguage($event)" class="options">
8-
<option value="c_cpp">C</option>
9-
<option value="c_cpp">C++</option>
10-
<option value="java">Java</option>
11-
<option value="python">Python</option>
12-
</select>
13-
</div>
14-
15-
<div ace-editor id="" cols="105" rows="28"
16-
[text]="content"
17-
class="aceEditorDirective"
18-
theme="sqlserver"
19-
mode="{{selectedLanguage}}"
20-
style="height:500px;"></div>
1+
<!-- div class="container">
2+
<h4>Submit a Solution: {{problem}}</h4>
3+
<hr>
4+
<div class="insingleblock">
5+
<div class="row select">
6+
<div>Select language</div>
7+
<select (change)="selectLanguage($event)" class="options">
8+
<option value="c_cpp">C/C++</option>
9+
<option value="java">Java</option>
10+
<option value="python">Python</option>
11+
</select>
12+
</div>
13+
<div ace-editor id="description" cols="105" rows="28"
14+
[text]="content"
15+
class="aceEditorDirective"
16+
theme="sqlserver"
17+
mode="{{selectedLanguage}}"
18+
style="height:500px;"
19+
>
20+
</div>
21+
</div>
22+
<br>
23+
<div><b>Choose the language</b>
24+
</div>
25+
<select id="select" class="form-control col-lg-4">
26+
<option value="C">C</option>
27+
<option value="C++">C++</option>
28+
<option value="Python">Python</option>
29+
<option value="Java">Java</option>
30+
</select>
2131
32+
<div class="row">
33+
<div class="col-md-12">
34+
<br>
35+
<p>OR Choose a File</p>
36+
</div>
37+
<div class="col-md-9">
2238
23-
<div class="row">
24-
<div class="col-md-8">
25-
<label class="file-upload">Upload File
26-
<input type="file" class="form-control-file">
27-
</label>
28-
</div>
29-
<div class="col-md-4">
30-
<div class="form-check mr-auto">
31-
<button class="btn btn-dark">Compile</button>
32-
</div>
33-
</div>
34-
</div>
35-
</div>
39+
<label class="file-upload">Upload File
40+
<input type="file" class="form-control-file" placeholder="Upload file" #userFile (change)="onFileChange($event)">
41+
</label>
3642
</div>
37-
</div>
43+
<div class="col-md-3">
44+
<button class="btn btn-success ml-auto"
45+
(click)="onRun()">Submit</button>
46+
47+
</div>
48+
</div>
49+
</div -->
Lines changed: 122 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,151 @@
11
import { Component, OnInit, ViewChild } from '@angular/core';
2+
import { EventEmitter } from '@angular/core';
3+
import { Router } from '@angular/router';
4+
import { AceEditorModule } from 'ng2-ace-editor';
5+
declare var jquery: any;
6+
declare var $: any;
27

38
@Component({
49
selector: 'app-ide',
510
templateUrl: './ide.component.html',
611
styleUrls: ['./ide.component.css']
712
})
813
export class IdeComponent implements OnInit {
14+
/*
15+
selectedLanguage = 'c_cpp';
16+
content: string;
17+
currentFileUpload;
18+
value;
19+
ace;
20+
constructor() {
21+
this.content =
22+
`#include<stdio.h>
923
24+
int main()
25+
{
1026
11-
selectedLanguage: String = 'c';
12-
content: string;
13-
selectLanguage(event: any) {
14-
this.selectedLanguage = event.target.value;
15-
if (this.selectedLanguage === 'c') {
16-
this.content =
17-
`#include<stdio.h>
27+
printf("Welcome To CodeCamp");
1828
19-
int main()
20-
{
29+
} `;
30+
}
31+
*/
32+
ngOnInit() {
2133

22-
printf("Welcome To CodeCamp");
34+
}
35+
/*
36+
selectLanguage(event) {
37+
this.selectedLanguage = event.target.value;
2338
24-
}`;
25-
} else if (this.selectedLanguage === 'java') {
26-
this.content = `import java.util.*;
39+
if (this.selectedLanguage === 'c_cpp') {
40+
this.content =
41+
`#include<stdio.h>
42+
//#include<bits/stdc++.h>
43+
//using namespace std;
44+
int main()
45+
{
2746
28-
public class CodeCamp {
47+
printf("Welcome To CodeCamp");
48+
return 0;
49+
}`;
50+
} else if (this.selectedLanguage === 'java') {
51+
this.content =
52+
`import java.util.*;
2953
30-
public static void main(String[] args) {
54+
public class Solution {
3155
32-
System.out.println("Welcome To Code Camp");
56+
public static void main(String[] args) {
3357
34-
}
58+
System.out.print("Welcome To CodeCamp");
59+
60+
}
3561
3662
}
37-
`
38-
} else {
63+
`;
64+
} else if (this.selectedLanguage === 'python') {
3965
this.content = `print("Welcome To CodeCamp")`;
4066
}
41-
4267
}
68+
onRun() {
69+
const lang = $('#select').val();
70+
const editor = this.ace.edit('description');
71+
this.content = editor.getValue('description');
72+
const p = this.content;
73+
this.currentFileUpload = btoa(p);
74+
}
75+
*/
76+
}
4377

44-
constructor() {
45-
this.content =
46-
`#include<stdio.h>
4778

48-
int main()
49-
{
5079

51-
printf("Welcome To CodeCamp");
5280

53-
}
54-
`
55-
}
5681

57-
ngOnInit() {
58-
}
82+
/*
83+
84+
import { Component, OnInit, ViewChild, Output} from '@angular/core';
85+
import { ActivatedRoute } from '@angular/router';
86+
import { AuthService } from '../../services/auth.service';
87+
import { ContestService } from '../../services/contest.service';
88+
import { EventEmitter } from '@angular/core';
89+
import { Router } from '@angular/router';
90+
import { AceEditorModule } from 'ng2-ace-editor';
91+
declare var jquery: any;
92+
declare var $: any;
5993
94+
@Component({
95+
selector: 'app-solultion-submit',
96+
templateUrl: './solultion-submit.component.html',
97+
styleUrls: ['./solultion-submit.component.css']
98+
})
99+
export class SolultionSubmitComponent implements OnInit {
100+
selectedLanguage = 'c_cpp';
101+
content;
102+
problem;
103+
contest;
104+
username;
105+
solution;
106+
language: string;
107+
currentFileUpload;
108+
value;
109+
@ViewChild('userFile') user_file;
110+
constructor(
111+
private contestService: ContestService,
112+
private route: ActivatedRoute,
113+
private authService: AuthService,
114+
115+
116+
117+
onFileChange(event){
118+
let reader = new FileReader();
119+
if (event.target.files && event.target.files.length > 0) {
120+
let file = event.target.files[0];
121+
reader.readAsDataURL(file);
122+
reader.onload = () => {
123+
this.value = reader.result.split(',')[1];
124+
};
125+
}
126+
}
127+
128+
onClickSubmit() {
129+
const lang = $('#select').val();
130+
const editor =ace.edit('description');
131+
this.content = editor.getValue('description');
132+
const p = this.content;
133+
if (this.value) {
134+
this.currentFileUpload = this.value;
135+
} else {
136+
this.currentFileUpload = btoa(p);
137+
}
138+
const solution = {
139+
problem : this.problem,
140+
contest: this.contest,
141+
username: this.username,
142+
language: lang,
143+
description: this.currentFileUpload
144+
};
145+
this.contestService.addSolution(solution).subscribe(data => {
146+
this.contestService.setSolution(data.msg);
147+
this.router.navigate(['/submit/complete']);
148+
});
149+
}
60150
}
151+
*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<a class="btn btn-light dropdown-toggle"
2222
role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true"
2323
aria-expanded="false">
24-
Welcome {{user?.username}}
24+
Welcome {{user}}
2525
</a>
2626

2727
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuLink">

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,22 @@ import { ContestService } from '../../services/contest.service';
2424
export class NavbarComponent implements OnInit{
2525

2626
user: any;
27+
users;
2728
toggle = true;
2829
constructor(
2930
public authService: AuthService,
3031
private router: Router,
3132
private contestService: ContestService
3233
) {
33-
this.authService.name.subscribe(value => {
34-
this.user = value;
35-
});
36-
}
34+
/*this.authService.name.subscribe(value => {
35+
this.user = value ;
36+
});*/
37+
this.users = authService.getProfile().subscribe(profile => {
38+
this.user = profile.msg.username;
39+
//console.log(this.user);
40+
});
41+
//console.log(this.user);
42+
}
3743

3844
ngOnInit() {
3945
this.contestService.toggle.subscribe(toggle => this.toggle = toggle);
@@ -43,7 +49,7 @@ export class NavbarComponent implements OnInit{
4349
this.authService.logout(); // Logout user
4450
this.router.navigate(['/']); // Navigate back to home page
4551
}
46-
onUndefined() {
52+
undefined() {
4753

4854
}
4955
onToggle(){

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ button{
2222
p{
2323
font-size: 15px;
2424
}
25+
.box{
26+
border: 1px solid #111;
27+
padding: 5%;
28+
background-color: rgb(201, 252, 235);
29+
}

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ <h6>Output</h6>
3131
</div>
3232
<div class="col-md-12">
3333
<h6>Constraints</h6>
34-
<p [innerText]="problem?.constraints"></p>
34+
<p>{{problem?.constraints}}</p>
3535
</div>
3636
<div class="col-md-12">
3737
<h6>Input Testcase</h6>
@@ -47,11 +47,21 @@ <h6>Explanations</h6>
4747
</div>
4848
</div>
4949
<img *ngIf="base64Image" [src]="base64Image" >
50+
5051
</div>
5152

5253
<div class="col-md-4">
5354
<app-submission></app-submission>
5455
</div>
56+
5557
</div>
58+
<hr>
59+
<div class="box">
5660

61+
<b>Time Limit: </b><span [innerText]="problem?.timelimit"></span><b> ms</b><br>
62+
<b>Source Limit: </b><span [innerText]="problem?.timelimit"></span><b> byte</b><br>
63+
<b>Author: </b><span [innerText]="problem?.author"></span><br>
64+
<b>Languages: </b><span> C, C++, Java, Python</span>
65+
66+
</div>
5767
</div>

0 commit comments

Comments
 (0)