Request ui #16

Merged
KevinMidboe merged 12 commits from request_ui into master 2017-08-06 07:26:22 +00:00
14 changed files with 2697 additions and 361 deletions

2
.gitignore vendored
View File

@@ -1,5 +1,4 @@
__pycache__ __pycache__
nohup.out
shows.db shows.db
.DS_Store .DS_Store
env_variables.py env_variables.py
@@ -11,3 +10,4 @@ webpage/js/env_variables.js
client/dist client/dist
src/webserver/access.log src/webserver/access.log
conf/development.json conf/development.json
yarn-error.log

Binary file not shown.

41
client/app/app.scss Normal file
View File

@@ -0,0 +1,41 @@
@font-face {
font-family: "din";
src: url('/app/DIN-Regular-webfont.woff')
}
html {
font-family: 'din', 'Open Sans', sans-serif;
display: inline-block;
color:red;
}
#requestMovieList {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.movie_wrapper {
color:red;
display: flex;
align-content: center;
width: 30%;
background-color: #ffffff;
height: 231px;
margin: 20px;
-webkit-box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.15);
-moz-box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.15);
box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.15);
}
.movie_content {
margin-left: 15px;
}
.movie_header {
font-size: 1.6em;
}

View File

@@ -8,11 +8,23 @@ import FetchData from './FetchData.js';
import ListStrays from './ListStrays.jsx' import ListStrays from './ListStrays.jsx'
import SearchRequest from './SearchRequest.jsx'; import SearchRequest from './SearchRequest.jsx';
import WebFont from 'webfontloader';
WebFont.load({
google: {
families: ['Titillium Web:300,400,700', 'sans-serif']
}
});
var background = {
backgroundColor: '#fafafa'
}
export default class App extends React.Component { export default class App extends React.Component {
render() { render() {
return ( return (
<div style={background}>
<div> <div>
<div style={{textAlign: 'center'}}>
<h1>Welcome to Seasoned</h1> <h1>Welcome to Seasoned</h1>
</div> </div>
<ListStrays /> <ListStrays />

View File

@@ -1,5 +1,7 @@
import React from 'react'; import React from 'react';
require('../app.scss');
class MovieObject { class MovieObject {
constructor(object) { constructor(object) {
this.id = object.id; this.id = object.id;
@@ -12,36 +14,52 @@ class MovieObject {
} }
requestExisting(movie) { requestExisting(movie) {
console.log('Exists', movie) console.log('Exists', movie);
} }
requestMovie(id) { requestMovie(id) {
fetch('http://localhost:31459/api/v1/plex/request/' + id, { fetch('http://localhost:31459/api/v1/plex/request/' + id, {
method: 'POST' method: 'POST'
}) });
} }
getElement() { getElement() {
var returnList = [] var movie_wrapper = {
display: 'flex',
returnList.push(<p>{this.title} ({this.year})</p>) alignContent: 'center',
width: '30%',
var posterPath, buttonState; backgroundColor: '#ffffff',
if (this.poster != undefined) { height: '231px',
posterPath = 'https://image.tmdb.org/t/p/w150' + this.poster; margin: '20px',
boxShadow: '0px 0px 5px 1px rgba(0,0,0,0.15)'
}
var movie_content = {
marginLeft: '15px'
}
var movie_header = {
fontSize: '1.6' + 'em'
} }
returnList.push(<img src={posterPath}></img>);
var posterPath = 'https://image.tmdb.org/t/p/w154' + this.poster;
var buttonState;
if (this.matchedInPlex) { if (this.matchedInPlex) {
returnList.push(<button onClick={() => this.requestExisting(this)}>Request anyway</button>) buttonState = <button onClick={() => {this.requestExisting(this)}}>Request anyway</button>;
} else { } else {
returnList.push(<button onClick={() => this.requestMovie(this.id)}>Request</button>) buttonState = <button onClick={() => {this.requestMovie(this.id)}}>Request</button>;
} }
returnList.push(<span>{this.overview}</span>); return (
<div key={this.id} style={movie_wrapper}>
returnList.push(<br></br>); <img src={posterPath}></img>
return returnList; <div style={movie_content}>
<span style={movie_header}>{this.title} ({this.year})</span>
<br></br>
{buttonState}
<br></br>
<span>{this.overview}</span>
</div>
</div>)
} }
} }

View File

@@ -82,8 +82,20 @@ class SearchRequest extends React.Component {
render(){ render(){
var body = {
fontFamily: "'Roboto', 'Open Sans', sans-serif",
display: 'inline-block'
}
var requestMovieList = {
display: 'flex',
flexWrap: 'wrap',
justifyContent: 'center'
}
return( return(
<div> <div style={body}>
<input <input
type="text" type="text"
onKeyPress={(event) => this._handleQueryKeyPress(event)} onKeyPress={(event) => this._handleQueryKeyPress(event)}
@@ -94,9 +106,9 @@ class SearchRequest extends React.Component {
<br></br> <br></br>
<br></br> <br></br>
<span id='requestMovieList' ref='requestMovieList'> <div id='requestMovieList' ref='requestMovieList' style={requestMovieList}>
{this.state.responseMovieList} {this.state.responseMovieList}
</span> </div>
</div> </div>
) )
} }

View File

@@ -9,11 +9,13 @@
"start": "webpack-dev-server" "start": "webpack-dev-server"
}, },
"dependencies": { "dependencies": {
"css-loader": "^0.28.4",
"html-webpack-plugin": "^2.28.0", "html-webpack-plugin": "^2.28.0",
"path": "^0.12.7", "path": "^0.12.7",
"react": "^15.5.4", "react": "^15.5.4",
"react-dom": "^15.5.4", "react-dom": "^15.5.4",
"webpack": "^2.6.1", "webfontloader": "^1.6.28",
"webpack": "^3.3.0",
"webpack-dev-server": "^2.4.5" "webpack-dev-server": "^2.4.5"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -26,8 +26,16 @@ module.exports = {
module: { module: {
loaders: [ loaders: [
{ test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ }, { test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ },
{ test: /\.jsx$/, loader: 'babel-loader', exclude: /node_modules/ } { test: /\.jsx$/, loader: 'babel-loader', exclude: /node_modules/ },
{ test: /\.scss$/, loader: 'css-loader', exclude: /node_modules/ },
{ test: /\.css$/, loader: 'style-loader!css!scss', exclude: /node_modules/ }
// { test: /\.css$/, loader: 'style-loader!css-loader!', exclude: /node_modules/ },
// query: {
// presets: ['es2015']
// }
// { test: /\.css-loader$/, loader: 'style-loader!css-loader', exclude: /node_modules/ }
] ]
}, },
plugins: [HtmlWebpackPluginConfig] plugins: [HtmlWebpackPluginConfig]
} };

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +0,0 @@
{
"database": {
"host": "shows.db"
},
"webserver": {
"port": 31459
},
"tmdb": {
"apiKey": "9fa154f5355c37a1b9b57ac06e7d6712"
}
}

View File

@@ -8,13 +8,13 @@
"body-parser": "~1.0.1", "body-parser": "~1.0.1",
"cross-env": "^3.1.3", "cross-env": "^3.1.3",
"express": "~4.0.0", "express": "~4.0.0",
"mongoose": "~3.6.13", "mongoose": "^3.6.13",
"moviedb": "^0.2.7", "moviedb": "^0.2.7",
"node-cache": "^4.1.1", "node-cache": "^4.1.1",
"nodemailer": "^4.0.1", "nodemailer": "^4.0.1",
"python-shell": "^0.4.0", "python-shell": "^0.4.0",
"request": "^2.81.0", "request": "^2.81.0",
"request-promise": "^4.2", "request-promise": "^4.2",
"sqlite": "^2.5.0" "sqlite3": "^2.5.0"
} }
} }

View File

@@ -1,19 +1,19 @@
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const sqlite = require('sqlite'); const sqlite3 = require('sqlite3');
class SqliteDatabase { class SqliteDatabase {
constructor(host) { constructor(host) {
this.host = host; this.host = host;
this.connection = sqlite; this.connection = sqlite3;
// this.schemaDirectory = path.join(__dirname, 'schemas'); // this.schemaDirectory = path.join(__dirname, 'schemas');
} }
connect() { connect() {
return Promise.resolve() return Promise.resolve()
.then(() => sqlite.open(this.host)) .then(() => new sqlite3.Database(this.host))
} }
all(sql, parameters) { all(sql, parameters) {

View File

@@ -18,7 +18,7 @@ class mailTemplate {
return ` return `
<h1>${info.name} ${info.year}</h1> <h1>${info.name} ${info.year}</h1>
<img src=${info.poster}> <img src="${info.poster}">
` `
} }
} }

1042
yarn.lock Normal file

File diff suppressed because it is too large Load Diff