Skip to content

Commit ef79c25

Browse files
committed
move to movie
add button that jumps to movie in the list if the chose movie already exists.
1 parent 95f0260 commit ef79c25

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

services/gui/app/views/public/app.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,22 @@ function suggestTitle() {
8484
}
8585

8686
const renderSuggestion = suggestion => {
87+
const bIsInWatchlist = isInWatchList(suggestion);
8788
return `
8889
<div class="suggestion flex-parent">
8990
<div class="flex-child short-and-fixed my-auto d-flex">
90-
<i class="fas ${isInWatchList(suggestion) ? '' : 'fa-plus-circle'} addSuggestionButton my-auto ml-2"></i>
91-
<img loading="lazy" class="ml-2 my-auto" src="${suggestion.Poster}" width="33px" height="50px">
91+
<a ${
92+
bIsInWatchlist ? `href='#watch-list-item-${suggestion.imdbID}'` : ""
93+
} class=" my-auto ml-2">
94+
<i class="fas ${
95+
bIsInWatchlist
96+
? "fa-arrow-alt-circle-down text-secondary"
97+
: "fa-plus-circle"
98+
} addSuggestionButton"></i>
99+
</a>
100+
<img loading="lazy" class="ml-2 my-auto" src="${
101+
suggestion.Poster
102+
}" width="33px" height="50px">
92103
</div>
93104
<div class="flex-child long-and-truncated-with-child my-auto ml-2">
94105
<h4 class="my-1">${suggestion.Title}</h4>
@@ -105,11 +116,12 @@ const onSuggestionSelected = suggestion => {
105116
suggestion.imdbID,
106117
suggestion.Year,
107118
suggestion.Poster
108-
)
119+
);
109120
}
110121
};
111122

112-
const isInWatchList = suggestion => moveez.titles.some(title => title.imdbID === suggestion.imdbID);
123+
const isInWatchList = suggestion =>
124+
moveez.titles.some(title => title.imdbID === suggestion.imdbID);
113125

114126
//add a new title
115127
function addTitle(name, imdbID, year, poster) {

services/gui/app/views/title/index.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<div id="watchList" class="col-lg-8">
2222
<% titles.forEach(function(title){ %>
2323
<% if(!title.seen) { %>
24-
<div class="card mb-3">
24+
<div id="watch-list-item-<%=title.imdbID%>" class="card mb-3">
2525
<div class="row no-gutters">
2626
<div class="col maximumWidthForPoster">
2727
<img src="<%= title.poster %>" class="card-img posterSize" loading="lazy" alt="cover">

services/gui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"mocha": "^2.4.5",
5353
"nodemon": "^1.18.4",
5454
"nyc": "^11.4.1",
55+
"prettier": "^1.18.2",
5556
"react": "^16.6.3",
5657
"react-dom": "^16.6.3",
5758
"sinon": "^7.2.7"

0 commit comments

Comments
 (0)