From b2f9d6f5f54e1df51c14cabb7e620bf05e8cbf83 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Tue, 26 Sep 2017 20:34:54 +0200 Subject: [PATCH] Added rating and background to the class constructor. Added type variable to url when requesting a movie/show and added a notification agent. Now this page is also updated to support mobile formatting, when tilted it shows the background image instead of poster image. --- client/app/components/MovieObject.jsx | 43 ++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/client/app/components/MovieObject.jsx b/client/app/components/MovieObject.jsx index 1349f68..bacf327 100644 --- a/client/app/components/MovieObject.jsx +++ b/client/app/components/MovieObject.jsx @@ -1,8 +1,12 @@ import React from 'react'; +import Notifications, {notify} from 'react-notify-toast'; + // StyleComponents import movieStyle from './styles/movieObjectStyle.jsx'; +var MediaQuery = require('react-responsive'); + class MovieObject { constructor(object) { this.id = object.id; @@ -10,7 +14,9 @@ class MovieObject { this.year = object.year; this.type = object.type; // Check if object.poster != undefined + this.rating = object.rating; this.poster = object.poster; + this.background = object.background; this.matchedInPlex = object.matchedInPlex; this.summary = object.summary; } @@ -20,10 +26,12 @@ class MovieObject { } requestMovie() { - // fetch('https://apollo.kevinmidboe.com/api/v1/plex/request/' + id, { - fetch('http://localhost:31459/api/v1/plex/request/' + this.id + '?type='+this.type, { + // fetch('http://localhost:31459/api/v1/plex/request/' + this.id + '?type='+this.type, { + fetch('https://apollo.kevinmidboe.com/api/v1/plex/request/' + this.id + '?type='+this.type, { method: 'POST' }); + + notify.show(this.title + ' requested!', 'success', 3000); } getElement() { @@ -31,8 +39,10 @@ class MovieObject { if (this.poster == null || this.poster == undefined) { var posterPath = 'https://openclipart.org/image/2400px/svg_to_png/211479/Simple-Image-Not-Found-Icon.png' } else { - var posterPath = 'https://image.tmdb.org/t/p/w154' + this.poster; + var posterPath = 'https://image.tmdb.org/t/p/w300' + this.poster; } + var backgroundPath = 'https://image.tmdb.org/t/p/w640_and_h360_bestv2/' + this.background; + var foundInPlex; if (this.matchedInPlex) { foundInPlex =