@@ -12,6 +16,12 @@ export default function ListDetails(props) {
{props.data.runtime} min
}
+ {props.data.genres &&
+
+
+ {genres}
+
+ }
{props.data.rating} ({props.data.votes} counts)
diff --git a/src/public/js/components/loader/loader.js b/src/public/js/components/loader/loader.js
new file mode 100644
index 0000000..0992754
--- /dev/null
+++ b/src/public/js/components/loader/loader.js
@@ -0,0 +1,17 @@
+import React from 'react'
+import Loading from 'react-loading'
+
+export default function Loader() {
+ return (
+
+ )
+}
diff --git a/src/public/js/components/movies/list.js b/src/public/js/components/movies/list.js
index c1b4731..d66bffe 100644
--- a/src/public/js/components/movies/list.js
+++ b/src/public/js/components/movies/list.js
@@ -2,6 +2,7 @@ import React from 'react'
import ListPosters from '../list/posters'
import ListDetails from '../list/details'
+import Loader from '../loader/loader'
class MovieButtons extends React.Component {
constructor(props) {
@@ -53,7 +54,24 @@ class MovieButtons extends React.Component {
export default class MovieList extends React.Component {
componentWillMount() {
- this.props.fetchMovies(this.props.moviesUrl);
+ if (this.props.moviesUrl) {
+ this.props.fetchMovies(this.props.moviesUrl);
+ } else if (this.props.params && this.props.params.search != "") {
+ this.props.searchMovies({
+ key: this.props.params.search
+ });
+ }
+ }
+ componentWillUpdate(nextProps, nextState) {
+ if (!nextProps.params || nextProps.params.search === "") {
+ return
+ }
+ if (this.props.params.search === nextProps.params.search) {
+ return
+ }
+ this.props.searchMovies({
+ key: nextProps.params.search
+ });
}
render() {
const movies = this.props.movieStore.movies;
@@ -63,6 +81,12 @@ export default class MovieList extends React.Component {
index = 0;
}
const selectedMovie = movies[index];
+
+ // Loading
+ if (this.props.movieStore.loading) {
+ return (
);
+ }
+
return (
-1)
+ {
+ displayMovieSearch = true;
+ }
+ if (isLoggedIn && location.indexOf("shows") > -1)
+ {
+ displayShowSearch = true;
+ }
return (
@@ -53,6 +75,30 @@ export default class NavBar extends React.Component {
}
+ {displayMovieSearch &&
+
+
+
+ }
+ {displayShowSearch &&
+
+
+
+ }
diff --git a/src/public/js/components/shows/details.js b/src/public/js/components/shows/details.js
index 9f33991..04043b0 100644
--- a/src/public/js/components/shows/details.js
+++ b/src/public/js/components/shows/details.js
@@ -1,10 +1,15 @@
import React from 'react'
+import Loader from '../loader/loader'
export default class ShowDetails extends React.Component {
componentWillMount() {
this.props.fetchShowDetails(this.props.params.imdbId);
}
render() {
+ // Loading
+ if (this.props.showStore.loading) {
+ return ();
+ }
return (
diff --git a/src/public/js/components/shows/list.js b/src/public/js/components/shows/list.js
index 1d83f0c..8b0703f 100644
--- a/src/public/js/components/shows/list.js
+++ b/src/public/js/components/shows/list.js
@@ -3,6 +3,7 @@ import { Link } from 'react-router'
import ListDetails from '../list/details'
import ListPosters from '../list/posters'
+import Loader from '../loader/loader'
function ShowButtons(props) {
const imdbLink = `http://www.imdb.com/title/${props.show.imdb_id}`;
@@ -20,7 +21,24 @@ function ShowButtons(props) {
export default class ShowList extends React.Component {
componentWillMount() {
- this.props.fetchShows(this.props.showsUrl);
+ if (this.props.showsUrl) {
+ this.props.fetchShows(this.props.showsUrl);
+ } else if (this.props.params && this.props.params.search != "") {
+ this.props.searchShows({
+ key: this.props.params.search
+ });
+ }
+ }
+ componentWillUpdate(nextProps, nextState) {
+ if (!nextProps.params || nextProps.params.search === "") {
+ return
+ }
+ if (this.props.params.search === nextProps.params.search) {
+ return
+ }
+ this.props.searchShows({
+ key: nextProps.params.search
+ });
}
render() {
const shows = this.props.showStore.shows;
@@ -30,6 +48,12 @@ export default class ShowList extends React.Component {
index = 0;
}
const selectedShow = shows[index];
+
+ // Loading
+ if (this.props.showStore.loading) {
+ return (
);
+ }
+
return (