From c4b4272588a6ef08a6ce4d434368f8600bb80494 Mon Sep 17 00:00:00 2001 From: Ashwin Alaparthi Date: Mon, 16 Sep 2019 18:33:28 +0530 Subject: [PATCH 1/2] Added Teacher side front end for OJ --- .../Pages/OnlineJudge/AddQuestion.js | 102 ++++++++++++++++++ .../Pages/OnlineJudge/OnlineJudge.css | 0 .../Pages/OnlineJudge/OnlineJudge.js | 46 ++++++++ .../Pages/OnlineJudge/QuestionBlock.css | 0 .../Pages/OnlineJudge/QuestionBlock.js | 40 +++++++ client/app/index.js | 4 + 6 files changed, 192 insertions(+) create mode 100644 client/app/components/Pages/OnlineJudge/AddQuestion.js create mode 100644 client/app/components/Pages/OnlineJudge/OnlineJudge.css create mode 100644 client/app/components/Pages/OnlineJudge/OnlineJudge.js create mode 100644 client/app/components/Pages/OnlineJudge/QuestionBlock.css create mode 100644 client/app/components/Pages/OnlineJudge/QuestionBlock.js diff --git a/client/app/components/Pages/OnlineJudge/AddQuestion.js b/client/app/components/Pages/OnlineJudge/AddQuestion.js new file mode 100644 index 0000000..d46e97f --- /dev/null +++ b/client/app/components/Pages/OnlineJudge/AddQuestion.js @@ -0,0 +1,102 @@ +import React, { Component } from 'react'; +import axios from 'axios'; + +class AddQuestion extends React.Component { + constructor(props) { + super(props); + this.state = { + + }; + } + render() { + const styles = { + page: { + width: "90%", + background: "#E4ECF4", + marginLeft: "5%", + borderRadius: "10px", + marginTop:"20px", + marginBottom:"40px" + }, + form: { + padding: "30px", + }, + submitBtn:{ + width:"20%", + marginLeft:"40%" + } + } + + return ( +
+
+
+
+ Problem Title +
+ +
+
+
+
+ Problem Description +
+ +
+
+
+
+
+ Input Format +
+ +
+
+
+
+
+ Output Format +
+ +
+
+
+
+
+ Constraints +
+ +
+
+
+
+
+ Sample Input +
+ +
+
+
+
+
+ Sample Explaination +
+ +
+
+
+
+ + +
+
+ Upload +
+
+ +
+
+ ); + } +} +export default AddQuestion; diff --git a/client/app/components/Pages/OnlineJudge/OnlineJudge.css b/client/app/components/Pages/OnlineJudge/OnlineJudge.css new file mode 100644 index 0000000..e69de29 diff --git a/client/app/components/Pages/OnlineJudge/OnlineJudge.js b/client/app/components/Pages/OnlineJudge/OnlineJudge.js new file mode 100644 index 0000000..70170a5 --- /dev/null +++ b/client/app/components/Pages/OnlineJudge/OnlineJudge.js @@ -0,0 +1,46 @@ +import React, { Component } from 'react'; +import axios from 'axios'; +import ReactLoading from '../../common/Loading'; +import QuestionBlock from './QuestionBlock'; +import AddQuestion from './AddQuestion'; +import 'react-table/react-table.css'; +import './OnlineJudge.css'; + +class OnlineJudge extends React.Component { + constructor(props) { + super(props); + this.state = { + page: "AddQuestion", + questions:{} + }; + } + + render() { + const style = { + QuestionBlock: { + marginTop: "40px", + } + } + if (this.state.page === "AddQuestion") { + return ( +
+ + {/*
+ + + +
+
+ ); + } + else{ + return( +
+ +
+ ); + } + } +} +export default OnlineJudge; diff --git a/client/app/components/Pages/OnlineJudge/QuestionBlock.css b/client/app/components/Pages/OnlineJudge/QuestionBlock.css new file mode 100644 index 0000000..e69de29 diff --git a/client/app/components/Pages/OnlineJudge/QuestionBlock.js b/client/app/components/Pages/OnlineJudge/QuestionBlock.js new file mode 100644 index 0000000..93e4b10 --- /dev/null +++ b/client/app/components/Pages/OnlineJudge/QuestionBlock.js @@ -0,0 +1,40 @@ +import React, { Component } from 'react'; +import './QuestionBlock.css'; +import axios from 'axios'; + +class Contests extends React.Component { + constructor(props) { + super(props); + this.state = { + + }; + } + render() { + const styles = { + questionContainer : { + background: "#D4F4E4", + width: "40%", + scroll:"auto", + paddingTop: "20px", + paddingBottom: "20px", + paddingLeft:"10px", + margin: "10px", + borderRadius:"3px", + }, + question:{ + fontSize:"1.2rem", + }, + desc: { + fontSize: "0.7rem", + }, + } + + return ( +
+

{this.props.title}

+ {/*

{this.props.desc}

*/} +
+ ); + } +} +export default Contests; diff --git a/client/app/index.js b/client/app/index.js index e7e1fb5..7fc1d2b 100644 --- a/client/app/index.js +++ b/client/app/index.js @@ -19,6 +19,7 @@ import PublicProfile from '../app/components/Pages/Profile/PublicProfile'; import Assignments from '../app/components/Pages/Assignments'; import Contests from '../app/components/Pages/Contests'; import Courses from '../app/components/Pages/Courses'; +import OnlineJudge from '../app/components/Pages/OnlineJudge/OnlineJudge'; import NotFound from './components/App/NotFound'; import SignupForm from '../app/components/Admin/SignupForm'; import AssignmentAdd from '../app/components/Pages/Courses/AddAssignment' @@ -31,6 +32,7 @@ import zipFiles from './components/Pages/Assignments/zipFiles'; import updateHandle from './components/Pages/Profile/UpdateHandle'; import contribute from './components/Pages/Contribute'; import ReactLoading from './components/common/Loading' + // import 'bootstrap/dist/css/bootstrap.min.css'; @@ -73,6 +75,8 @@ render(( + + From 1257c86b095507227d8379c5e6c75f3f2e575aa7 Mon Sep 17 00:00:00 2001 From: Ashwin Alaparthi Date: Thu, 3 Oct 2019 12:24:10 +0530 Subject: [PATCH 2/2] Add OnlineOJ --- .../app/components/Pages/OnlineJudge/AddQuestion.js | 6 ++++++ .../app/components/Pages/OnlineJudge/OnlineJudge.css | 0 .../app/components/Pages/OnlineJudge/OnlineJudge.js | 11 ++++++++--- .../components/Pages/OnlineJudge/QuestionBlock.css | 0 .../app/components/Pages/OnlineJudge/QuestionBlock.js | 2 +- 5 files changed, 15 insertions(+), 4 deletions(-) delete mode 100644 client/app/components/Pages/OnlineJudge/OnlineJudge.css delete mode 100644 client/app/components/Pages/OnlineJudge/QuestionBlock.css diff --git a/client/app/components/Pages/OnlineJudge/AddQuestion.js b/client/app/components/Pages/OnlineJudge/AddQuestion.js index d46e97f..f7caa34 100644 --- a/client/app/components/Pages/OnlineJudge/AddQuestion.js +++ b/client/app/components/Pages/OnlineJudge/AddQuestion.js @@ -24,6 +24,11 @@ class AddQuestion extends React.Component { submitBtn:{ width:"20%", marginLeft:"40%" + }, + cancelBtn: { + width: "20%", + marginLeft: "40%", + marginTop:"20px" } } @@ -94,6 +99,7 @@ class AddQuestion extends React.Component { + ); diff --git a/client/app/components/Pages/OnlineJudge/OnlineJudge.css b/client/app/components/Pages/OnlineJudge/OnlineJudge.css deleted file mode 100644 index e69de29..0000000 diff --git a/client/app/components/Pages/OnlineJudge/OnlineJudge.js b/client/app/components/Pages/OnlineJudge/OnlineJudge.js index 70170a5..541c630 100644 --- a/client/app/components/Pages/OnlineJudge/OnlineJudge.js +++ b/client/app/components/Pages/OnlineJudge/OnlineJudge.js @@ -4,7 +4,7 @@ import ReactLoading from '../../common/Loading'; import QuestionBlock from './QuestionBlock'; import AddQuestion from './AddQuestion'; import 'react-table/react-table.css'; -import './OnlineJudge.css'; + class OnlineJudge extends React.Component { constructor(props) { @@ -14,8 +14,13 @@ class OnlineJudge extends React.Component { questions:{} }; } - + render() { + const changePage = (page) => { + if (page === "Home") { + this.setState({ page: "AddQuestion" }); + } + } const style = { QuestionBlock: { marginTop: "40px", @@ -37,7 +42,7 @@ class OnlineJudge extends React.Component { else{ return(
- +
); } diff --git a/client/app/components/Pages/OnlineJudge/QuestionBlock.css b/client/app/components/Pages/OnlineJudge/QuestionBlock.css deleted file mode 100644 index e69de29..0000000 diff --git a/client/app/components/Pages/OnlineJudge/QuestionBlock.js b/client/app/components/Pages/OnlineJudge/QuestionBlock.js index 93e4b10..d21f304 100644 --- a/client/app/components/Pages/OnlineJudge/QuestionBlock.js +++ b/client/app/components/Pages/OnlineJudge/QuestionBlock.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import './QuestionBlock.css'; + import axios from 'axios'; class Contests extends React.Component {