Skip to content

Commit

Permalink
home page only shows items that are available
Browse files Browse the repository at this point in the history
  • Loading branch information
sabrinalord committed Feb 16, 2022
1 parent f19851d commit d246e06
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion client/src/components/Items/Item.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ const Item = ({ item, deleteItem, borrowItem, getItems, setRefreshItems }) => {
<p></p>
<div className="meta">
Location: {lender.location}
{borrower ? <p><span className="ui blue text">Availble Soon</span></p>: <p><span className="ui green text">Available now</span></p>}
{item.available ? <p><span className="ui green text">Available now</span></p> :
borrower ? <p><span className="ui blue text">Availble Soon</span></p> : <p><span className="ui red text">Not available</span></p>}
</div>
</div>

Expand Down
3 changes: 2 additions & 1 deletion client/src/components/Items/ItemList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const ItemList = ({session, refreshItems, setRefreshItems, profilePic, setSearch
}

const renderedList = itemList.map(item => {
if(item.available) {
return (
<Item
key={item._id}
Expand All @@ -103,7 +104,7 @@ const ItemList = ({session, refreshItems, setRefreshItems, profilePic, setSearch
profilePic={profilePic}
getItems={getItems}
/>
)
)};
})

return (
Expand Down

0 comments on commit d246e06

Please sign in to comment.