Skip to content

Commit

Permalink
Added a message for when there are no movies in the wish list so far …
Browse files Browse the repository at this point in the history
…and link to go to the Browse List to add some.

Added a message for when there are no movies in the wish list so far and link to go to the Browse List to add some.
  • Loading branch information
Erin Doyle committed Mar 17, 2019
1 parent ecef454 commit 32ed99b
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/browse/BrowseList.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const BrowseList = ({ movieList, wishlist, movieActions }) => {
const inWishlist = !!wishlist[movieId];

return (
<Movie movieId={movieId} movie={movie} movieActions={movieActions(movieId, inWishlist)}/>
<Movie key={movieId} movieId={movieId} movie={movie} movieActions={movieActions(movieId, inWishlist)}/>
);
});
};
Expand Down
4 changes: 2 additions & 2 deletions src/primitives/Movie.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ const Movie = ({ movieId, movie, movieActions }) => {
const imgSrc = `${process.env.PUBLIC_URL}/moviePosters/${movieId}.jpg`;

return (
<div key={movieId} className="card mb-3">
<div className="card mb-3">
<div className="row">
<div className="col-1"><img src={imgSrc} alt="movie" /></div>
<div className="col">
<div className="card-body">
<h5 className="card-title">{name} ({year})</h5>
<h6 class="card-subtitle mb-2 text-muted">{rating} | {runtime} { genre ? `| ${genre}` : null }</h6>
<h6 className="card-subtitle mb-2 text-muted">{rating} | {runtime} { genre ? `| ${genre}` : null }</h6>
<p className="card-text">{description}</p>
<p className="card-text text-muted">Director: {director} | Stars: {stars}</p>

Expand Down
2 changes: 1 addition & 1 deletion src/wishlist/MovieEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class MovieEditor extends Component {
<div className="modal-body">
<div className="form-group">
<label>Notes:</label>
<textarea class="form-control" value={notes} onChange={this.handleChangeNotes} />
<textarea className="form-control" value={notes} onChange={this.handleChangeNotes} />
</div>
</div>
<div className="modal-footer">
Expand Down
19 changes: 11 additions & 8 deletions src/wishlist/MovieWishlist.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { NavLink } from 'react-router-dom';
import { NavLink, Link } from 'react-router-dom';

import WishList from './WishList';
import getWishlistActions from './getWishlistActions';
Expand Down Expand Up @@ -76,13 +76,16 @@ class MovieWishlist extends Component {
</li>
</ul>

<div>
<WishList
movieList={wishlist}
watched={match.params.status === 'watched'}
movieActions={movieActions}
/>
</div>
{Object.keys(wishlist).length
? <div>
<WishList
movieList={wishlist}
watched={match.params.status === 'watched'}
movieActions={movieActions}
/>
</div>
: <p>No Movies in your Wish List! <Link to="/browse">Add some</Link>!</p>
}

{ showEditor
? <MovieEditor movie={movieInEditing} updateMovie={this.handleUpdateMovie} />
Expand Down
2 changes: 1 addition & 1 deletion src/wishlist/WishList.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const WishList = ({ movieList, watched, movieActions }) => {
return Object.entries(movieList)
.filter(isWatched)
.map(([ movieId, movie ]) =>
<Movie movieId={movieId} movie={movie} movieActions={movieActions(movieId, movie.watched)}/>
<Movie key={movieId} movieId={movieId} movie={movie} movieActions={movieActions(movieId, movie.watched)}/>
);
};

Expand Down
2 changes: 1 addition & 1 deletion src/wishlist/getWishlistActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const getMovieActions = (showEditor, setAsWatched, setAsUnwatched, handleRemove)
const removeClickHandler = () => handleRemove(movieId);

return (
<div class="btn-group">
<div className="btn-group">
<button className="btn btn-secondary" onClick={watchClickHandler}>{watchButtonText}</button>
<button className="btn btn-secondary" onClick={editClickHandler}>Edit</button>
<button className="btn btn-secondary" onClick={removeClickHandler}>Remove</button>
Expand Down

0 comments on commit 32ed99b

Please sign in to comment.