Skip to content

Commit

Permalink
bug-fix (Heroku build):
Browse files Browse the repository at this point in the history
-Changes to the loading of the borrowed books
  • Loading branch information
Benny Ogidan authored and Benny Ogidan committed Nov 22, 2017
1 parent d10c50d commit 6622ffc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,11 @@ class DisplayLandingBooks extends React.Component {
render() {
const fetchingState = this.props.isFetching ?
<Preloader size="big" className="center-align" /> : null;

const getAllBooks = (this
.props
.books) ? this
.recentBooks) ? this
.props
.books
.recentBooks
.map(book => (<Book
key={book.id}
id={book.id}
Expand All @@ -71,7 +70,9 @@ class DisplayLandingBooks extends React.Component {
return (
<div className="recent-books">
<Row>
<div className="landing-page-image">
{[...getAllBooks]}
</div>
</Row>
</div>
);
Expand All @@ -87,7 +88,7 @@ DisplayLandingBooks.defaultProps = {
};

const mapStateToProps = ({ bookReducer }) => ({
books: bookReducer.recentBooksList,
recentBooks: bookReducer.recentBooksList,
isFetching: bookReducer.fetchingBooks
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,7 @@ class DisplayBookModal extends React.Component {
$(`#modal-${this.props.id}`).modal({opacity: 0})
})
}


render(){
const isBorrowed = (this.props.borrowedBooksList.books) ? this.props.borrowedBooksList.books.map(book => {
return (book.bookid)
}) : [];
const loanstatus = isBorrowed.includes(this.state.bookId)

if(!this.props.isAuthenticated){
return(
<Modal id={`modal-${this.props.id}`} fixedFooter header="Loan Book">
Expand All @@ -87,7 +80,12 @@ return(
}

else{
const isBorrowed = (this.props.borrowedBooksList.books) ? this.props.borrowedBooksList.books.map(book => {
return (book.bookid)
}) : [];
const loanstatus = isBorrowed.includes(this.state.bookId)
return (

<Modal id={`modal-${this.props.id}`} fixedFooter header="Loan Book"
actions={<div>{!loanstatus ?
<Button className="loan-button" onClick={this.handleBorrowClick}> Loan </Button> :
Expand Down
5 changes: 4 additions & 1 deletion client/src/app/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ p {
padding-top: 20px;
}

.landing-page-image .card{
max-width: 85% !important;
}

form p {
color: $secondary-color;
Expand Down Expand Up @@ -167,7 +170,7 @@ form p {
}

.overlay-main {
margin-top: -59vh;
margin-top: -56vh;
padding: 50px;
width: calc(100% - 20px);
max-width: 1600px;
Expand Down

0 comments on commit 6622ffc

Please sign in to comment.