Skip to content

Commit

Permalink
fixed front end bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
suhanacharya committed Jan 11, 2021
1 parent b38a724 commit 8bf7cf7
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ node_modules/
venv
# api/prycey.db
api/__pycache__
# api/.env
api/.env
1 change: 1 addition & 0 deletions api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ def rate(uid):
print(request.form.get('review'))
nr = int(request.form.get('rating'))
review = request.form.get('review')
print(uid)

if "user_id" in sess:
if 1 <= nr <= 5:
Expand Down
Binary file modified api/prycey.db
Binary file not shown.
16 changes: 9 additions & 7 deletions src/components/PostOrder/PostOrder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,26 @@ import StarRating from '../StarRating/StarRating';
function PostOrder(props) {
const {register, handleSubmit} = useForm();
const [rating, setRating] = useState(null);
const params = new URLSearchParams(props.location.search);
const id = params.get('id');
const seller = params.get('seller')

console.log(props)

useEffect(() => {
const params = new URLSearchParams(props.location.search);
const id = params.get('id');
const seller = params.get('seller')

console.log(seller)

}, [])

const onSubmit = (value) =>{
console.log(value, rating)
console.log(value)
let fd = new FormData();
fd.append('review', value.review);
fd.append('rating', rating);
axios.post(`http://127.0.0.1:5000/rating/${props.match.params.value}`, fd)
.then(response => toast(response.data.response, {position: toast.POSITION.TOP_CENTER}))
.catch(error => console.log(error))
// axios.post(`http://127.0.0.1:5000/rating/${props.match.params}`, fd)
// .then(response => toast(response.data.response, {position: toast.POSITION.TOP_CENTER}))
// .catch(error => console.log(error))
}
return (
<div>
Expand Down
26 changes: 21 additions & 5 deletions src/components/productPage/ProductPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,22 @@ function ProductPage({match}) {
<p className={Styles.productDescription}>
{values.description}
</p>
<p className={Styles.category}>{values.category}</p>
<p className={Styles.year}>years : {values.year}</p>
<p className={Styles.dateAdded}>{values.dateAdded}</p>
<div className={Styles.rowValue}>
<div className={Styles.catDiv}>
<p className={Styles.category}>{values.category}</p>
</div>
<div className={Styles.yearDiv}>
<div className={Styles.yearDiv1}>
Used
</div>
<p className={Styles.year}>{values.year} yrs</p>
</div>
</div>

<div className={Styles.postedRow}>
<p className={Styles.dateHeading}>Posted on : </p>
<p className={Styles.dateAdded}> {values.dateAdded}</p>
</div>

<div className={Styles.priceRow}>
<p className={Styles.priceMrp}>
Expand Down Expand Up @@ -161,8 +174,11 @@ function ProductPage({match}) {
</div>
<p style={{fontSize: '1.1rem', margin: '10px 0'}}>E-mail : {values.email}</p>
<p style={{fontSize: '1.1rem', margin: '10px 0'}}>Contact : +91 {values.contact}</p>
<Link to={`/seller/rating?id=${values.itemId}&&seller=${values.sellerId}`}>
<img style={{width: '40px', margin : '10px auto', cursor : 'pointer'}} src={Buy} alt='buy' />
<Link style={{textDecoration : 'none'}} to={`/seller/rating?id=${values.itemId}&&seller=${values.sellerId}`}>
<div style={{display : 'flex', margin: '0 auto', flexDirection : 'row', backgroundColor : 'white', width: '50%', justifyContent: 'baseline' , marginTop: '50px'}} role='button' tabIndex={0} >
<img style={{backgroundColor : '#00fff0', width: '27px' , height : '27px', padding: '9px 5px 7px 7px'}} src={Call} alt='call' />
<p style={{color: '#3d6cb9', fontSize: '1.1rem', padding: '10px 35px'}}>Purchase</p>
</div>
</Link>


Expand Down
62 changes: 58 additions & 4 deletions src/components/productPage/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,68 @@
font-size: 3rem;
}
.productDescription{
margin-top: 10px;
font-weight: 500;
font-size: 1.5rem;
width: 80%;
letter-spacing: 2px;
}
.category{
font-size: 1.4rem;
font-weight: 400;

.rowValue{
display: flex;
margin-top: 10px;

.catDiv{
margin-top: 5px;
background-color: $purple;
width: 100px;
text-align: center;
border-radius: 10px;


.category{
padding: 5px 0;
font-size: 1.2rem;
font-weight: 400;
color: white;

}
}
.yearDiv{

margin-left: 10px;
margin-top: 5px;
border: 3px solid $purple;
border-radius: 10px;
width: 100px;
display: flex;
flex-direction: row;
color: black;

.yearDiv1{
color: white;
background-color: $purple;
padding: 5px 7px;
}

.year{

padding: 5px 5px;
}
}
}
.postedRow{
margin-top: 10px;
display: flex;
.dateHeading{
font-size: 1.2rem;
}
.dateAdded{
font-size: 1.1rem;
color: #a3a1a1;
padding-top: 2px;
padding-left: 5px;
}
}
.priceRow{
display: flex;
Expand Down Expand Up @@ -55,7 +109,7 @@
margin-bottom: 100px;

.sellerTag{
color: $accent_blue;
color: white;
align-self: start;
}

Expand Down

0 comments on commit 8bf7cf7

Please sign in to comment.