Changed the way html for the object is created, but need to do this with React native functions. Also added a few functions that will be for requesting items.
This commit is contained in:
@@ -6,16 +6,37 @@ class MovieObject {
|
||||
this.title = object.title;
|
||||
this.year = object.year;
|
||||
// Check if object.poster != undefined
|
||||
this.poster = 'https://image.tmdb.org/t/p/w150' + object.poster;
|
||||
this.poster = object.poster;
|
||||
this.matchedInPlex = object.matchedInPlex
|
||||
}
|
||||
|
||||
requestExisting(id) {
|
||||
console.log('Exists', id)
|
||||
}
|
||||
|
||||
requestMovie(id) {
|
||||
console.log(id);
|
||||
}
|
||||
|
||||
getElement() {
|
||||
var returnString = [
|
||||
<p>{this.title} ({this.year})</p>,
|
||||
<img src={this.poster}></img>,
|
||||
<br></br>
|
||||
]
|
||||
return returnString;
|
||||
var returnList = []
|
||||
|
||||
returnList.push(<p>{this.title} ({this.year})</p>)
|
||||
|
||||
var posterPath, buttonState;
|
||||
if (this.poster != undefined) {
|
||||
posterPath = 'https://image.tmdb.org/t/p/w150' + this.poster;
|
||||
}
|
||||
returnList.push(<img src={posterPath}></img>);
|
||||
|
||||
if (this.matchedInPlex) {
|
||||
returnList.push(<button onClick={() => this.requestExisting(this.id)}>Request anyway</button>)
|
||||
} else {
|
||||
returnList.push(<button onClick={() => this.requestMovie(this.id)}>Request</button>)
|
||||
}
|
||||
|
||||
returnList.push(<br></br>);
|
||||
return returnList;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user