File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed
Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -84,11 +84,22 @@ function suggestTitle() {
8484}
8585
8686const 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
115127function addTitle ( name , imdbID , year , poster ) {
Original file line number Diff line number Diff line change 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" >
Original file line number Diff line number Diff line change 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"
You can’t perform that action at this time.
0 commit comments