Skip to content

Commit

Permalink
Merge pull request #27 from arielclj/master
Browse files Browse the repository at this point in the history
Refinement of UI
  • Loading branch information
chrishkchris authored Jun 16, 2020
2 parents efb58ac + 099fecc commit c9741a8
Show file tree
Hide file tree
Showing 14 changed files with 202 additions and 20 deletions.
3 changes: 3 additions & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@
"echarts": "^4.7.0",
"echarts-for-react": "^2.0.16",
"html-loader": "^1.1.0",
"particlesjs": "^2.2.3",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-bootstrap": "^1.0.1",
"react-dom": "^16.13.1",
"react-dropzone": "^11.0.1",
"react-particles-js": "^3.2.1",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
"react-sweet-progress": "^1.1.2",
Expand Down
Binary file added web/public/favicon-old.ico
Binary file not shown.
Binary file modified web/public/favicon.ico
Binary file not shown.
31 changes: 30 additions & 1 deletion web/src/Home/Home.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,42 @@
.Home .lander {
z-index: 99999;
padding: 80px 0;
text-align: center;
}

.Home .lander h1 {
z-index: 99999;
font-family: "Open Sans", sans-serif;
font-weight: 600;
}

.Home .lander p {
z-index: 99999;
color: #999;
}
}

/* to replace background image
.Home {
background: url("../components/images.jpg") no-repeat center center fixed;
background-size:cover;
-webkit-background-size:cover;
-moz-background-size:cover;
-o-background-size:cover;
min-width:100vw;
min-height:100vh;
} */

body {
margin: 0;
padding: 0;
/* more styles */
}

.particles {
position: fixed;
right: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -1;
}
39 changes: 24 additions & 15 deletions web/src/Home/Home.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
import React, {Component} from "react";
import Button from '@material-ui/core/Button';
import history from '../history';
import React, { Component } from "react";
import "./Home.css";
import Particles from 'react-particles-js';

const particlesOptions = {
"particles": {
"line_linked": {
"enable": true,
"color": "#615555",
"width": 0.5

},
"color": { value: "#000000" },
"number": {
"value": 50
},
"size": { "value": 3 },

}
};

export default class Home extends Component {
render() {
return (
<div className ="Home">

<div className="Home">
<div className="lander">
<Particles className="particles" params={particlesOptions} />
<h1>Predictions</h1>
<p>Select from models below</p>
<form>

<Button variant="contained" color="primary" onClick={() => history.push('/ImageClassification')}>Image Classification</Button><br/><br/>
<Button variant="contained" color="primary" onClick={() => history.push('/QuestionAnswering')}>Question Answering</Button><br/><br/>
<Button variant="contained" color="primary" onClick={() => history.push('/PosTagging')}>Pos Tagging</Button><br/><br/>
<Button variant="contained" color="primary" onClick={() => history.push('/TabularClassification')}>Tabular Classification</Button><br/><br/>
<Button variant="contained" color="primary" onClick={() => history.push('/TabularRegression')}>Tabular Regression</Button><br/><br/>
<Button variant="contained" color="primary" onClick={() => history.push('/SpeechRecognition')}>Speech Recognition</Button><br/><br/>
<Button variant="contained" color="primary" onClick={() => history.push('/ObjectDetection')}>Object Detection</Button>
</form>
<p>To insert a brief description of Singa-Easy Models and objective of application</p>
</div>
</div>

);
}
}
27 changes: 24 additions & 3 deletions web/src/ImageClassification/ImageClassification.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,23 @@ class ImageClassification extends React.Component {
this.setState({ predictorHost: e.target.value });
}

handleClick = (e) => {
e.preventDefault();
navigator.permissions.query({
name: 'clipboard-read',
allowWithoutGesture: true
}).then(result => {
console.log(result);
if (result.state === 'prompt' || result.state === 'granted' ) {
navigator.clipboard.readText().then(
clipText => { this.setState({ predictorHost:clipText });
document.getElementById("url").value = clipText;
});
}
else {alert("Permission to access clipboard denied!")}
})

}
onDrop = files => {
console.log("onDrop called, acceptedFiles: ", files)
const currentFile = files[0]
Expand Down Expand Up @@ -255,11 +272,15 @@ class ImageClassification extends React.Component {
</Typography>
<form onSubmit={this.handleSubmit} align="center">
<div className="predhost">
<input type="text"
value={this.state.predictorHost}
<input id="url"
type="text"
value=""
onChange={this.handleChange}
className="form-control" />
</div>
<Button variant="contained"
color="primary"
onClick={this.handleClick}>Paste link here</Button>
</form>
<br />
<Divider />
Expand Down Expand Up @@ -295,7 +316,7 @@ class ImageClassification extends React.Component {
</div>
<div className={classes.contentWrapper}>
<div className={classes.progbarStatus}>

{this.state.formState === "loading" &&
<React.Fragment>
<LinearProgress color="secondary" />
Expand Down
22 changes: 22 additions & 0 deletions web/src/QuestionAnswering/QuestionAnswering.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import axios from 'axios';

import Button from '@material-ui/core/Button';

class QuestionAnswering extends React.Component {
state = {
Expand Down Expand Up @@ -51,6 +52,24 @@ class QuestionAnswering extends React.Component {
}


handleClick = (e) => {
e.preventDefault();
navigator.permissions.query({
name: 'clipboard-read',
allowWithoutGesture: true
}).then(result => {
console.log(result);
if (result.state === 'prompt' || result.state === 'granted' ) {
navigator.clipboard.readText().then(
clipText => {
document.getElementById("url").value = clipText;
});
}
else {alert("Permission to access clipboard denied!")}
})

}

render() {
return (
<div className="QuestionAnsweringContainer">
Expand All @@ -72,6 +91,9 @@ class QuestionAnswering extends React.Component {
<p>
<input type="text" name="url" id="url" className="myurl" placeholder="input url from server" value={this.state.url} onChange=
{this.handleChange} />
<Button variant="contained"
color="primary"
onClick={this.handleClick}>Paste link here</Button>
</p>

<div className="col-m-8">
Expand Down
4 changes: 4 additions & 0 deletions web/src/Routes.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import React, {Component} from "react";
import {Router, Switch, Route} from "react-router-dom";

import Header from './components/Header'
import Home from './Home/Home';
import ImageClassification from "./ImageClassification/ImageClassification";
import QuestionAnswering from "./QuestionAnswering/QuestionAnswering";
import history from './history';


export default class Routes extends Component {
render() {
return(

<Router history={history}>
<Header />
<Switch>
<Route path="/" exact component={Home} />
<Route path="/ImageClassification" component={ImageClassification} />
Expand Down
35 changes: 35 additions & 0 deletions web/src/components/Header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react';
import Link from '@material-ui/core/Link';
import Breadcrumbs from '@material-ui/core/Breadcrumbs';
import history from '../history';

function handleClick(e) {
console.info('Breadcrumb clicked');
history.push(Link.href)
}

const Header = () => {
return (
<Breadcrumbs aria-label="breadcrumb">
<nav>
<Link href="/" onClick={handleClick}color ="inherit">Home</Link>
{" | "}
<Link href="/ImageClassification" onClick={handleClick}color ="inherit">Image Classification</Link>
{" | "}
<Link href="/QuestionAnswering" onClick={handleClick}color ="inherit">Question Answering</Link>
{" | "}
<Link href="/PosTagging" onClick={handleClick}color ="inherit">POS Tagging</Link>
{" | "}
<Link href="/TabularClassification" onClick={handleClick}color ="inherit">Tabular Classification</Link>
{" | "}
<Link href="/TabularRegression" onClick={handleClick}color ="inherit">Tabular Regression</Link>
{" | "}
<Link href="/SpeechRecognition" onClick={handleClick}color ="inherit">Speech Recognition</Link>
{" | "}
<Link href="/ObjectDetection" onClick={handleClick}color ="inherit">Object Detection</Link>
</nav>
</Breadcrumbs>
);
};

export default Header;
20 changes: 20 additions & 0 deletions web/src/components/NavBar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react'
import AppBar from '@material-ui/core/AppBar'
import Toolbar from '@material-ui/core/Toolbar'
import Typography from '@material-ui/core/Typography'

const NavBar = () => {
return(
<div>
<AppBar position = "static">
<Toolbar>
<Typography variant = "title" color="inherit">
Singa-Easy Prediction Models
</Typography>
</Toolbar>
</AppBar>
</div>
)
}

export default NavBar;
Binary file added web/src/components/images.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions web/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
} */

body,html {
height:100%;
margin: 0;
}
3 changes: 3 additions & 0 deletions web/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import ReactDOM from 'react-dom';
import * as serviceWorker from './serviceWorker';
import {BrowserRouter as Router} from 'react-router-dom';

import NavBar from './components/NavBar';
import Routes from './Routes';

ReactDOM.render(
<Router>
<div className="App">

<NavBar />
<Routes />
</div>
</Router>,
Expand Down
33 changes: 32 additions & 1 deletion web/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7736,6 +7736,11 @@ parseurl@~1.3.2, parseurl@~1.3.3:
resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4"
integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==

particlesjs@^2.2.3:
version "2.2.3"
resolved "https://registry.yarnpkg.com/particlesjs/-/particlesjs-2.2.3.tgz#4d213ca740679fc1ccc772e8d864b884a091f37e"
integrity sha512-f0rL80Agqdsrnv/uhlLewv+LMdiXHu9MYPzMv0ZLPM06nLx3zmAXMH882fxqO6Uzb91csli8WlWaYd2XPN0d/Q==

pascal-case@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/pascal-case/-/pascal-case-3.1.1.tgz#5ac1975133ed619281e88920973d2cd1f279de5f"
Expand Down Expand Up @@ -7832,6 +7837,11 @@ path-type@^4.0.0:
resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==

pathseg@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/pathseg/-/pathseg-1.2.0.tgz#22af051e28037671e7799e296fe96c5dcbe53acd"
integrity sha512-+pQS7lTaoVIXhaCW7R3Wd/165APzZHWzYVqe7dxzdupxQwebgpBaCmf0/XZwmoA/rkDq3qvzO0qv4d5oFVrBRw==

pbkdf2@^3.0.3:
version "3.0.17"
resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.17.tgz#976c206530617b14ebb32114239f7b09336e93a6"
Expand Down Expand Up @@ -8968,6 +8978,14 @@ react-overlays@^3.1.2:
uncontrollable "^7.0.0"
warning "^4.0.3"

react-particles-js@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/react-particles-js/-/react-particles-js-3.2.1.tgz#a331e80519c9e70f448090915def088f72ed6ed3"
integrity sha512-sZ6jmwbbHQOtqsChlI7X9iee+iN4C1g9BLch2f9Ck9dvJmAaVT8/kQB1gOQLROFKIFIzQyt34gXzrI7ZNwNspQ==
dependencies:
lodash "^4.17.11"
tsparticles "^1.13.6"

react-router-dom@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.2.0.tgz#9e65a4d0c45e13289e66c7b17c7e175d0ea15662"
Expand All @@ -8981,7 +8999,7 @@ react-router-dom@^5.2.0:
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"

react-router@5.2.0:
react-router@5.2.0, react-router@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.2.0.tgz#424e75641ca8747fbf76e5ecca69781aa37ea293"
integrity sha512-smz1DUuFHRKdcJC0jobGo8cVbhO3x50tCL4icacOlcwDOEQPq4TMqwx3sY1TP+DvtTgz4nm3thuo7A+BK2U0Dw==
Expand Down Expand Up @@ -10508,6 +10526,19 @@ tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35"
integrity sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==

tslib@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.0.tgz#18d13fc2dce04051e20f074cc8387fd8089ce4f3"
integrity sha512-lTqkx847PI7xEDYJntxZH89L2/aXInsyF2luSafe/+0fHOMjlBNXdH6th7f70qxLDhul7KZK0zC8V5ZIyHl0/g==

tsparticles@^1.13.6:
version "1.15.1"
resolved "https://registry.yarnpkg.com/tsparticles/-/tsparticles-1.15.1.tgz#65718d9f8169e6e260fad48572ef0e0631f6c1ab"
integrity sha512-yvk613dW6aTqziDUTH2O5q+8K5MyNMnZkqD1Od1FBWi+ekFmwUwVtWGTiEmmhq5+D/a3AEe60TQCLekT910b2w==
dependencies:
pathseg "^1.2.0"
tslib "^2.0.0"

tsutils@^3.17.1:
version "3.17.1"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759"
Expand Down

0 comments on commit c9741a8

Please sign in to comment.