Skip to content

Commit

Permalink
Updated Compiler.js
Browse files Browse the repository at this point in the history
  • Loading branch information
akashgp09 committed Oct 12, 2020
1 parent e6d93a0 commit f25816e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 30 deletions.
32 changes: 6 additions & 26 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,8 @@
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk"
crossorigin="anonymous"
/>

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand All @@ -47,24 +42,9 @@
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script
src="https://kit.fontawesome.com/1552b7834c.js"
crossorigin="anonymous"
></script>
<script
src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"
></script>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"
></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"
integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI"
crossorigin="anonymous"
></script>

<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
</body>
</html>
Empty file removed server/server.js
Empty file.
18 changes: 14 additions & 4 deletions src/Components/Compiler/Compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,31 @@ export default class Compiler extends Component {
constructor(props) {
super(props);
this.state = {
input: ``,
input: localStorage.getItem('input')||``,
output: ``,
language_id: 2,
language_id:localStorage.getItem('language_Id')|| 2,
user_input: ``,
};
}
input = (event) => {

event.preventDefault();

this.setState({ input: event.target.value });
localStorage.setItem('input', event.target.value)

};
userInput = (event) => {
event.preventDefault();
this.setState({ user_input: event.target.value });
};
language = (event) => {

event.preventDefault();

this.setState({ language_id: event.target.value });
localStorage.setItem('language_Id',event.target.value)

};

submit = async (e) => {
Expand Down Expand Up @@ -82,7 +90,7 @@ export default class Compiler extends Component {

outputText.innerHTML = "";

outputText.innerHTML += `Results : ${output}\nExecution Time : ${jsonGetSolution.time} Secs\nMemory used : ${jsonGetSolution.memory} bytes`;
outputText.innerHTML += `Results :\n${output}\nExecution Time : ${jsonGetSolution.time} Secs\nMemory used : ${jsonGetSolution.memory} bytes`;
} else if (jsonGetSolution.stderr) {
const error = atob(jsonGetSolution.stderr);

Expand All @@ -98,6 +106,7 @@ export default class Compiler extends Component {
}
};
render() {

return (
<>
<div className="row container-fluid">
Expand All @@ -113,6 +122,7 @@ export default class Compiler extends Component {
id="source"
onChange={this.input}
className=" source"
value={this.state.input}
></textarea>

<button
Expand All @@ -127,7 +137,7 @@ export default class Compiler extends Component {
<b className="heading">Language:</b>
</label>
<select
value={this.state.language}
value={this.state.language_id}
onChange={this.language}
id="tags"
className="form-control form-inline mb-2 language"
Expand Down

0 comments on commit f25816e

Please sign in to comment.