Skip to content

Commit

Permalink
Merge pull request #37 from msc49/adding-unavailable-button-to-profil…
Browse files Browse the repository at this point in the history
…e-page

Adding update button to profile page
  • Loading branch information
msc49 authored Feb 15, 2022
2 parents cf2ae47 + f9f6b9d commit 9e17950
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
3 changes: 1 addition & 2 deletions client/src/components/Home/HomeBanner.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import React from 'react';
import './Home.css';
import bannerImage from "../../components/images/woman-with-drill-blue.png";
import bannerImage from "../../components/images/woman-with-drill.png";


const HomeBanner = () => {
Expand All @@ -19,6 +19,5 @@ const HomeBanner = () => {
)
}


export default HomeBanner;

17 changes: 12 additions & 5 deletions client/src/components/Items/Item.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { Popup } from 'semantic-ui-react'
import { Rating } from 'semantic-ui-react'
import '../../img/image.png'

const Item = ({ item, profilePic, deleteItem, updateItem, uploadImage, borrowItem }) => {
const Item = ({ item, deleteItem, updateItem, uploadImage, borrowItem }) => {

const user = JSON.parse(localStorage.getItem('user'))

const {_id: id, name, description, images, lender, borrower} = item

Expand Down Expand Up @@ -68,10 +70,15 @@ const Item = ({ item, profilePic, deleteItem, updateItem, uploadImage, borrowIte
<img src={images[1] ? images[1].path : "https://react.semantic-ui.com//images/avatar/large/elliot.jpg"} class="hidden content" alt=""/>
</div>
</div>
<div className={`ui bottom attached ${borrower ? 'blue' : 'green'} button`} tabindex="0">
{borrower ? 'Queue' : 'Request'}
</div>


{user.user.username === lender.username ?
<div className={`ui bottom attached grey button`} tabindex="0" onClick={() => console.log('hi')}>
Update
</div> :
<div className={`ui bottom attached ${borrower ? 'blue' : 'green'} button`} tabindex="0">
{borrower ? 'Queue' : 'Request'}
</div>
}
</div>

<Link to={`/items/${id}`}>
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 @@ -56,13 +56,14 @@ const ItemList = ({session, refreshItems, setRefreshItems, profilePic}) => {
getItems()
}

const updateItem = async (event, name, description, lender, borrower, id) => {
const updateItem = async (event, name, description, lender, borrower, id, available) => {
event.preventDefault()
// const { data } =
await express.put(`/items/${id}`, {
item: {
name: name,
description: description,
available:available
}
})

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Items/UsersItemsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const UsersItemList = () => {


const renderedLendingList = itemList.map(item => {
if (item.lender._id == userId) {
if (item.lender._id === userId) {
return (
<Item
key={item._id}
Expand Down
Binary file modified client/src/components/images/woman-with-drill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9e17950

Please sign in to comment.