Setup of yarn and package.json. Also added first page which queries api for info
This commit is contained in:
23
client/app/components/App.jsx
Normal file
23
client/app/components/App.jsx
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
./app/components/App.jsx
|
||||||
|
|
||||||
|
<FetchData url={"https://apollo.kevinmidboe.com/api/v1/plex/playing"} />
|
||||||
|
*/
|
||||||
|
import React from 'react';
|
||||||
|
import FetchData from './FetchData.js';
|
||||||
|
import ListStrays from './ListStrays.jsx'
|
||||||
|
|
||||||
|
export default class App extends React.Component {
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div style={{textAlign: 'center'}}>
|
||||||
|
<h1>Welcome to Seasoned</h1>
|
||||||
|
</div>
|
||||||
|
<ListStrays />
|
||||||
|
|
||||||
|
<FetchData />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
58
client/app/components/FetchData.js
Normal file
58
client/app/components/FetchData.js
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
class FetchData extends React.Component {
|
||||||
|
constructor(props){
|
||||||
|
super(props)
|
||||||
|
this.state = {
|
||||||
|
imgUrls: [],
|
||||||
|
hei: '1',
|
||||||
|
intervalId: null,
|
||||||
|
url: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount(){
|
||||||
|
var that = this;
|
||||||
|
fetch("https://apollo.kevinmidboe.com/api/v1/plex/playing").then(
|
||||||
|
function(response){
|
||||||
|
response.json().then(function(data){
|
||||||
|
console.log(data.size);
|
||||||
|
that.setState({
|
||||||
|
imgUrls: that.state.imgUrls.concat(data.video)
|
||||||
|
})
|
||||||
|
console.log(data.video.title);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
// use intervalId from the state to clear the interval
|
||||||
|
clearInterval(this.state.intervalId);
|
||||||
|
}
|
||||||
|
|
||||||
|
getPlaying() {
|
||||||
|
console.log('Should not reach')
|
||||||
|
// Need callback to work
|
||||||
|
// Should try to clear out old requests to limit mem use
|
||||||
|
}
|
||||||
|
|
||||||
|
render(){
|
||||||
|
return(
|
||||||
|
<div className="FetchData">
|
||||||
|
{this.state.imgUrls.map((imgObj) => {
|
||||||
|
return ([
|
||||||
|
<span>{imgObj.title}</span>,
|
||||||
|
<span>{imgObj.season}</span>,
|
||||||
|
<span>{imgObj.episode}</span>,
|
||||||
|
]);
|
||||||
|
})}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export default FetchData;
|
||||||
45
client/app/components/ListStrays.jsx
Normal file
45
client/app/components/ListStrays.jsx
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
class ListStrays extends React.Component {
|
||||||
|
constructor(props){
|
||||||
|
super(props)
|
||||||
|
this.state = {
|
||||||
|
strays: [],
|
||||||
|
hei: '1'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount(){
|
||||||
|
var that = this;
|
||||||
|
fetch('https://apollo.kevinmidboe.com/api/v1/seasoned/all').then(
|
||||||
|
function(response){
|
||||||
|
response.json().then(function(data){
|
||||||
|
// console.log(data);
|
||||||
|
that.setState({
|
||||||
|
strays: that.state.strays.concat(data)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
render(){
|
||||||
|
return(
|
||||||
|
<div className="ListStrays">
|
||||||
|
{this.state.strays.map((strayObj) => {
|
||||||
|
if (strayObj.verified == 0) {
|
||||||
|
var url = "https://kevinmidboe.com/seasoned/verified.html?id=" + strayObj.id;
|
||||||
|
console.log(url);
|
||||||
|
return ([
|
||||||
|
<span key={strayObj.id}>{strayObj.name}</span>,
|
||||||
|
<a href={url}>{strayObj.id}</a>
|
||||||
|
])
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ListStrays;
|
||||||
12
client/app/index.html
Normal file
12
client/app/index.html
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>seasoned Shows</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="root">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
15
client/app/index.js
Normal file
15
client/app/index.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* @Author: KevinMidboe
|
||||||
|
* @Date: 2017-06-01 21:08:55
|
||||||
|
* @Last Modified by: KevinMidboe
|
||||||
|
* @Last Modified time: 2017-06-01 21:34:32
|
||||||
|
|
||||||
|
./client/index.js
|
||||||
|
which is the webpack entry file
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import ReactDOM from 'react-dom';
|
||||||
|
import App from './components/App.jsx';
|
||||||
|
|
||||||
|
ReactDOM.render(<App />, document.getElementById('root'));
|
||||||
@@ -5,9 +5,22 @@
|
|||||||
"repository": "https://github.com/KevinMidboe/seasonedShows",
|
"repository": "https://github.com/KevinMidboe/seasonedShows",
|
||||||
"author": "Kevin Midboe",
|
"author": "Kevin Midboe",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"scripts": {
|
||||||
|
"start": "webpack-dev-server"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"html-webpack-plugin": "^2.28.0",
|
||||||
"path": "^0.12.7",
|
"path": "^0.12.7",
|
||||||
|
"react": "^15.5.4",
|
||||||
|
"react-dom": "^15.5.4",
|
||||||
"webpack": "^2.6.1",
|
"webpack": "^2.6.1",
|
||||||
"webpack-dev-server": "^2.4.5"
|
"webpack-dev-server": "^2.4.5"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"babel-core": "^6.24.1",
|
||||||
|
"babel-loader": "^7.0.0",
|
||||||
|
"babel-preset-env": "^1.5.1",
|
||||||
|
"babel-preset-es2015": "^6.24.1",
|
||||||
|
"babel-preset-react": "^6.24.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
33
client/webpack.config.js
Normal file
33
client/webpack.config.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* @Author: KevinMidboe
|
||||||
|
* @Date: 2017-06-01 19:09:16
|
||||||
|
* @Last Modified by: KevinMidboe
|
||||||
|
* @Last Modified time: 2017-06-01 22:11:51
|
||||||
|
*/
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
|
const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
|
||||||
|
template: './app/index.html',
|
||||||
|
filename: 'index.html',
|
||||||
|
inject: 'body'
|
||||||
|
})
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
entry: './app/index.js',
|
||||||
|
output: {
|
||||||
|
path: path.resolve('dist'),
|
||||||
|
filename: 'index_bundle.js'
|
||||||
|
},
|
||||||
|
devServer: {
|
||||||
|
headers: { "Access-Control-Allow-Origin": "*" }
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
loaders: [
|
||||||
|
{ test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ },
|
||||||
|
{ test: /\.jsx$/, loader: 'babel-loader', exclude: /node_modules/ }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
plugins: [HtmlWebpackPluginConfig]
|
||||||
|
}
|
||||||
1072
client/yarn.lock
1072
client/yarn.lock
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user