From 6153728cd2a441bcaf70e01296773beb4114a388 Mon Sep 17 00:00:00 2001 From: azizwazzeni Date: Sun, 19 Feb 2023 13:11:24 +0100 Subject: [PATCH] changes --- client/dist/index.html | 6 +- client/dist/style.css | 767 +++++++++++++++++++++++++- client/src/components/About.jsx | 9 +- client/src/components/Addproudect.jsx | 141 +++++ client/src/components/Aganse.jsx | 31 ++ client/src/components/Home.jsx | 1 + client/src/components/Items.jsx | 48 +- client/src/components/Profile.jsx | 143 ++++- client/src/components/SignIn.jsx | 25 +- client/src/components/SignUp.jsx | 17 +- client/src/components/Update.jsx | 118 ++++ client/src/components/Userposts.jsx | 80 +++ client/src/index.jsx | 55 +- server/controllers/post.controller.js | 3 +- server/controllers/user.controller.js | 2 +- 15 files changed, 1374 insertions(+), 72 deletions(-) create mode 100644 client/src/components/Addproudect.jsx create mode 100644 client/src/components/Aganse.jsx create mode 100644 client/src/components/Update.jsx create mode 100644 client/src/components/Userposts.jsx diff --git a/client/dist/index.html b/client/dist/index.html index 791f145..77242a1 100644 --- a/client/dist/index.html +++ b/client/dist/index.html @@ -3,14 +3,16 @@ - Item List + Housify + +
- +
\ No newline at end of file diff --git a/client/dist/style.css b/client/dist/style.css index ed68848..02a4403 100644 --- a/client/dist/style.css +++ b/client/dist/style.css @@ -24,7 +24,7 @@ body { background-repeat: no-repeat; background-position: center; background-size:cover; - height: 80vh; + height: 100% } @@ -123,7 +123,6 @@ body { } - /* Slideshow */ .slideshow { margin-top: 4%; @@ -142,11 +141,11 @@ body { background-position: center; height: 90vh; width: 100%; - /* border : 10px solid white; */ - border-radius: 5%; + + height:698px } - /* Buttons */ + .slideshowDots { text-align: center; @@ -182,8 +181,8 @@ body { } .signup { - margin-top: 65px; - margin-left: 40vh; + + margin-left: 50px; opacity: 0.85; align-items: center; justify-content: center; @@ -195,25 +194,753 @@ body { gap: 10px; } .aziz { - background-image: url("https://res.cloudinary.com/dsaso2a8g/image/upload/v1676568596/sign_up_or_contract_qzqy35.jpg"); - background-repeat: no-repeat; + + display: flex; + justify-content: center; + align-items: center; + width: 100vw; + background-image: url(https://res.cloudinary.com/dsaso2a8g/image/upload/v1676568596/sign_up_or_contract_qzqy35.jpg); + background-size: cover; background-position: center; - background-size:cover; + box-sizing: border-box; + font-size: 119.5%; + height: 856px; + + } + + .allcard{ + display: grid; + justify-content: center; + align-items: normal; + width: 99vw; + height: 134vh; + background-color: #ffffff; + box-sizing: border-box; + font-size: 63.5%; + box-sizing: inherit; + } + + .container { + display: flex; + justify-content: space-between; + width: 100%; + margin: 20px 0 80px; + flex-wrap: wrap + + } + .cardI { + margin: 2px; + background-color: white; + box-shadow: 0 5px 10px 0 rgb(0 0 0 / 50%); + width: 535px; + height: 410px; + margin-top: -38px; position: relative; - top : 0px; + top: 120px; + } + .cardI:hover .card__caption { + top: 50%; + transform: translateY(-50%); + } + .cardI:hover .card__image { + transform: translateY(-10px); + } + .cardI:hover .card__thumb::after { + top: 0; + } + .cardI:hover .card__snippet { + margin: 20px 0; + } + .card__thumb { + position: relative; + max-height: 400px; + overflow: hidden; + height: 334px + } + @media (min-width: 1024px) { + .card__thumb { + max-height: 500px; + } + } + .card__thumb::after { + position: absolute; + top: 0; + display: block; + content: ''; + width: 100%; + height: 100%; + background: linear-gradient(0deg, rgba(0, 0, 0, .5) 40%, rgba(255, 255, 255, 0) 100%); + transition: 0.3s; + } + @media (min-width: 1024px) { + .card__thumb::after { + top: calc(100% - 140px); + } + } + .card__image { + transition: 0.5s ease-in-out; + height: 359px + } + .card__caption { + position: absolute; + top: 50%; + z-index: 1; + padding: 0 20px; + color: white; + transform: translateY(-50%); + text-align: center; + transition: 0.3s; + } + @media (min-width: 1024px) { + .card__caption { + top: calc(100% - 110px); + transform: unset; + } + } + .card__title { + display: -webkit-box; + max-height: 85px; + overflow: hidden; + font-family: 'Playfair Display', serif; + font-size: 23px; + line-height: 28px; + text-shadow: 0px 1px 5px black; + text-overflow: ellipsis; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; + } + .card__snippet { + display: -webkit-box; + max-height: 150px; + margin: 20px 0; + overflow: hidden; + font-family: 'Roboto', sans-serif; + font-size: 16px; + line-height: 20px; + text-overflow: ellipsis; + transition: 0.5s ease-in-out; + -webkit-line-clamp: 5; + -webkit-box-orient: vertical; + } + @media (min-width: 1024px) { + .card__snippet { + margin: 60px 0; + } + } + .card__button { + display: inline-block; + padding: 10px 20px; + color: white; + border: 1px solid white; + font-family: 'Roboto', sans-serif; + font-size: 12px; + text-transform: uppercase; + text-decoration: none; + transition: 0.3s; + } + .card__button:hover { + color: black; + background-color: white; + } + .disclaimer { + position: fixed; + bottom: -15px; + left: 50%; + z-index: 2; + box-sizing: border-box; + width: 100%; + padding: 20px 10px; + background-color: white; + transform: translateX(-50%); + font-family: 'Roboto', sans-serif; + font-size: 14px; + text-align: center; + } + .disclaimer__link { + color: #755d87; + text-decoration: none; + } + .allprofiles{ + display: grid; + justify-content: center; + align-items: normal; + width: 99vw; + height: 134vh; + background-color: #ffffff; + box-sizing: border-box; + font-size: 63.5%; + box-sizing: inherit; + } + .navProfile{ + font-size: 16px; + } + + .containerProfile img { + width: 464px; + height: 473px; + position: absolute; + top: 54px; + left: 39px; } + .containerProfile p { + position: absolute; + top: 11%; + left: 53%; + font-size: 25px; + width: 428px; + } + .containerProfile{ + background-color: #bdbdbd6e; + width: 1000px; + height: 621px; + position: absolute; + top: 96px; + left: 16%; + border-style: ridge; + } + + .containerProfile button { + background-color: white; + color: #0a122d; + border: 2px solid #78393991; + width: 90px; + height: 39px; + + margin: 10px 12px; + position: relative; + top: 69%; + left: 58%; + } + + .containerProfile button:hover { + background-color: #555555; + color: white; + } + + + @import url(https://fonts.googleapis.com/css?family=Cookie|Raleway:300,700,400); +*{ + box-sizing: border-box; + font-size: 1em; + margin: 0; + padding: 0; +} +.UpdatePage{ + background-color: rgb(255, 255, 255); + font-size: 18px; + width: 99vw; + height: 134vh; +} +.containerUpdate{ + border-radius: 0.5em; + box-shadow: 0 0 1em 0 rgb(51 51 51 / 25%); + display: block; + max-width: 566px; + overflow: hidden; + -webkit-transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); + padding: 2em; + position: absolute; + top: 61%; + left: 50%; + z-index: 1; + width: 100%; + background-color: #2d2927ad +} + +.container:after{ + background: rgba(255,255,255,0.6); + content: ''; + display: block; + height: 100%; + position: absolute; + top: 0; + left: 0; + z-index: -1; + width: 100%; +} +form button.submit{ + background: rgb(255 255 255); + border: 1px solid #333; + padding: 0.5em 0.5em; + -webkit-transition: all 0.25s; + transition: all 0.25s; + margin: 10px 17px; + width: 100px; +} +form button:hover, +form button:focus, +form button:active, +form button.loading{ + background: #333; + color: #fff; + outline: none; +} +form button.success{ + background: #27ae60; + border-color: #27ae60; + color: #fff; +} +@-webkit-keyframes spin{ + from{ transform: rotate(0deg); } + to{ transform: rotate(360deg); } +} +@keyframes spin{ + from{ transform: rotate(0deg); } + to{ transform: rotate(360deg); } +} +form button span.loading-spinner{ + -webkit-animation: spin 0.5s linear infinite; + animation: spin 0.5s linear infinite; + border: 2px solid #fff; + border-top-color: transparent; + border-radius: 50%; + display: inline-block; + height: 1em; + width: 1em; +} -.loginlogo { - justify-content: center; +form label{ + border-bottom: 1px solid #333; + display: block; + font-size: 1.25em; + margin-bottom: 0.5em; + -webkit-transition: all 0.25s; + transition: all 0.25s; +} +form label.col-one-half{ + float: left; + width: 50%; +} +form label.col-one-half:nth-of-type(even){ + border-left: 1px solid #333; + padding-left: 0.25em; +} +form label input{ + + width: 100%; +} +form label input:focus{ + outline: none; +} +form label input:-webkit-autofill{ + background-color: transparent !important; +} +form label span.label-text{ + display: block; + font-size: 0.5em; + font-weight: bold; + padding-left: 0.5em; + text-transform: uppercase; + -webkit-transition: all 0.25s; + transition: all 0.25s; + color: #e8e7e7; +} +form label.checkbox{ + border-bottom: 0; + text-align: center; +} +form label.checkbox input{ + display: none; +} +form label.checkbox span{ + font-size: 0.5em; +} +form label.checkbox span:before{ + content: '\e157'; + display: inline-block; + font-family: 'Glyphicons Halflings'; + font-size: 1.125em; + padding-right: 0.25em; + position: relative; + top: 1px; +} +form label.checkbox input:checked + span:before{content: '\e067';} +form label.invalid{border-color: #c0392b !important;} +form label.invalid span.label-text{color: #c0392b;} +form label.password{position: relative;} +form label.password button.toggle-visibility{ + background: none; + border: none; + cursor: pointer; + font-size: 0.75em; + line-height: 1em; + position: absolute; + top: 50%; + right: 0.5em; + text-align: center; + -webkit-transform: translateY(-50%); + -ms-transform: translateY(-50%); + transform: translateY(-50%); + -webkit-transition: all 0.25s; + transition: all 0.25s; +} +form label.password button.toggle-visibility:hover, +form label.password button.toggle-visibility:focus, +form label.password button.toggle-visibility:active{ + color: #000; + outline: none; +} +form label.password button.toggle-visibility span{vertical-align: middle;} + +h1{ + font-size: 3em; + margin: 0 0 0.5em 0; + text-align: center; + font-family: 'Cookie', cursive; +} +h1 img{ + height: auto; + margin: 0 auto; + max-width: 240px; + width: 100%; +} + + +.text-center{ + text-align: center; +} + + +aside { + color: #fff; + width: 250px; + padding-left: 20px; + height: 130vh; + background-image: linear-gradient(30deg , #100909, #f64171bf); + border-top-right-radius: 80px; + position: absolute; +} + +aside a { + font-size: 12px; + color: #fff; + display: block; + padding: 12px; + padding-left: 30px; + text-decoration: none; + -webkit-tap-highlight-color:transparent; +} + +aside a:hover { + color: #3f5efb; + background: #fff; + outline: none; + position: relative; + background-color: #fff; + border-top-left-radius: 20px; + border-bottom-left-radius: 20px; +} + +aside a i { + margin-right: 5px; +} + +aside a:hover::after { + content: ""; + position: absolute; + background-color: transparent; + bottom: 100%; + right: 0; + height: 35px; + width: 35px; + border-bottom-right-radius: 18px; + box-shadow: 0 20px 0 0 #fff; +} + +aside a:hover::before { + content: ""; + position: absolute; + background-color: transparent; + top: 38px; + right: 0; + height: 35px; + width: 35px; + border-top-right-radius: 18px; + box-shadow: 0 -20px 0 0 #fff; +} + +aside p { + margin: 0; + padding: 40px 0; +} + + +.social { + height: 0; +} + +.social i:before { + width: 14px; + height: 14px; + font-size: 14px; + position: fixed; + color: #fff; + background: #0077B5; + padding: 10px; + border-radius: 50%; + top:5px; + right:5px; +} +.containerAdd { + border-radius: 0.5em; + box-shadow: 0 0 1em 0 rgb(51 51 51 / 25%); + display: block; + max-width: 610px; + overflow: hidden; + -webkit-transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); + padding: 2em; + position: absolute; + top: 76%; + left: 50%; + z-index: 1; + width: 100%; + background-color: #2d2927ad; + height: 900px; +} + +.containerAdd form label span.label-text { + display: block; + font-size: 0.5em; + font-weight: bold; + padding-left: 0.5em; + text-transform: uppercase; + -webkit-transition: all 0.25s; + transition: all 0.25s; + color: #f6f6f6; +} +#imgadd{ + display: none; +} +.imagecontainer{ + width: 1150px; + height: 540px; + background-color: #ead9d996; + + position: absolute; + left: 19%; + top: 17%; +} +.detailcards{ + position: absolute; + top: 12%; + display: inline-table; + left: 25%; + flex-grow: initial; + gap: 27px; + border-style: outset; + border-width: 11px -2px 5px 4px; + border-color: var(); + border-radius: 1.2rem; + width: 60%; + margin: 35px 43px; +} + + +.detailcards img { + width: 300px; + height: 220px; + margin: 16px; +} +.detailcards h5 { + font-size: 35px; + position: absolute; + top: 4%; + left: 76%; + border-style: inherit; + border-radius: 11px; + align-items: center; + color: #2c3035 +} +.detailcards h3 { + display: inline-table; + margin: 10px; + font-size: 18px; +} +.detailcards h4 { + position: absolute; + top: 16%; + left: 77%; + font-size: 26px; + color: #c2149eb0; +} + +#h4{ + position: absolute; + top: 16%; + left: 88%; + font-size: 26px; + color: #c2149eb0; +} +.detailcards p { + font-size: 17px; +} +.detailcards button { + background-color: white; + color: #282121; + border: 2px solid #555555; + width: 65px; + height: 39px; + margin: 10px; position: relative; - top:-80px; - right: -60px; + left: 180px; +} + +.detailcards button:hover { + background-color: #555555; + color: white; +} + +.aganse{ + background-color: rgb(255, 255, 255); + font-size: 18px; + width: 99vw; + height: 134vh; + font-family: "open sans"; + color: #444; + font-size: 1em; + +} + +@import url("https://fonts.googleapis.com/css?family=Open+Sans:400,600,700"); + + .containerrr { + padding: 15px; +} + .clearfloat { + content: ''; + display: block; + clear: both; } -.form { - margin-top: -70px; + .cards { + list-style: none; + margin: 94px; + padding: 0; + text-align: center; } + .cards li { + display: inline-block; + margin: 10px; + padding: 20px; + border: 1px solid rgba(0,0,0,0.2); + border-radius: 25px; + box-shadow: 0 0 15px rgba(0,0,0,0.5); + font-size: 0.9em; + transition: all 0.2s ease-in-out; + text-align: center; +} + .cards li:after, .cards li:before { + content: ''; + display: block; + clear: both; +} + .cards li img { + display: inline-block; + width: 100%; + height: auto; + max-width: 150px; + border-radius: 50%; + box-shadow: 0 0 2px rgba(0,0,0,0.5); + transition: all 0.5s ease-in-out; +} + .cards li .details { + float: left; + text-align: left; + transition: all 0.5s ease-in-out; + text-shadow: 1px 1px rgba(0,0,0,0); + min-width: 250px; +} + .cards li .details > span, .cards li .details > a { + display: block; + padding: 0 15px 0 35px; + margin-bottom: 15px; + text-decoration: none; + position: relative; +} + .cards li .details > span:before, .cards li .details > a:before { + display: inline-block; + font: normal normal normal 13px/1 FontAwesome; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + margin-right: 15px; + width: 15px; + text-align: center; + color: #444; +} + .cards li .details a { + color: #57893c; + transition: color 0.5s ease-in-out; +} + .cards li .details a:hover, .cards li .details a:focus { + color: #97c77e; + transition: color 0.5s ease-in-out; +} + .cards li .details .name { + font-weight: 600; +} + .cards li .details .name:before { + content: "\f2c0"; +} + .cards li .details .title:before { + content: "\f2c1"; +} + .cards li .details .phone:before { + content: "\f095"; +} + .cards li .details .email:before { + content: "\f003"; +} + .cards li:hover { + background: rgba(235,237,189,0.5); + transition: all 0.2s ease-in-out; + transform: scale(1.03); +} + .cards li:hover img { + box-shadow: 0 0 10px rgba(0,0,0,0.6); + transition: all 0.4s ease-in-out; +} + .cards li:hover .details { + transition: all 0.5s ease-in-out; + text-shadow: 1px 1px #dfe295; +} + @media (max-width: 550px) { + .cards li { + display: block; + width: auto; + max-width: 200px; + margin: 30px auto; + } + .cards li img, .cards li .details { + float: none; + } + .cards li img { + margin: 0 auto; + } + .cards li .details { + margin-top: 20px; + text-align: center; + min-width: 0; + } + .cards li .details span, .cards li .details a { + padding: 0; + white-space: break-all; + word-wrap: break-word; + } + .cards li .details span:before, .cards li .details a:before { + display: none; + } +} + #h4P{ + position: absolute; + top: 24%; + left: 81%; + font-size: 26px; + color: #c2149eb0; + } + -.namelast { - border-width:4px ; -} \ No newline at end of file diff --git a/client/src/components/About.jsx b/client/src/components/About.jsx index 0800a0a..59b7e50 100644 --- a/client/src/components/About.jsx +++ b/client/src/components/About.jsx @@ -2,7 +2,14 @@ import React from 'react' const About = () => { return ( -
About us !!
+ +
+ + + +
+ + ) } diff --git a/client/src/components/Addproudect.jsx b/client/src/components/Addproudect.jsx new file mode 100644 index 0000000..f800070 --- /dev/null +++ b/client/src/components/Addproudect.jsx @@ -0,0 +1,141 @@ +import React, { useState } from 'react' +import { useNavigate } from 'react-router'; +import axios from 'axios'; +function Addproudect(props) { + + const navigate = useNavigate() + const [price,Setprice]=useState("") + const [adress,Setadress]=useState("") + const [type,Settype]=useState("") + const [fore,Setfore]=useState("") + const [descreption,Setdescreption]=useState("") + const[area,Setarea]=useState("") + const [NbofBeds,SetNbofBeds]=useState("") + const[NbofBathrooms,SetNbofBathrooms]=useState("") + const [NbofKitchen,SetNbofKitchen]=useState("") + const [img, setImg] = useState("") + + + + + const handelclick = ()=>{ + axios.post(`/api/housify/${props.user[0]._id}`, { + Price: price, + type: type, + for: fore, + NbofBeds : NbofBeds, + NbofBathrooms: NbofBathrooms, + NbofKitchen: NbofKitchen , + Area: area, + description:descreption, + Adress:adress, + images:img + + } + ).then((result)=>{props.setrelod(!relod)}). + catch((err)=>{console.log(err);}); + + } + + + + + + return ( + + +
+ + +
+
+

+ + Authentic Collection + +

+
+ +
+ + + + + + + + + + + + + + + + + +
+ + +
+
+ +
+ +
+ ) +} + +export default Addproudect diff --git a/client/src/components/Aganse.jsx b/client/src/components/Aganse.jsx new file mode 100644 index 0000000..1b67096 --- /dev/null +++ b/client/src/components/Aganse.jsx @@ -0,0 +1,31 @@ +import React from 'react' + +function Aganse() { + return ( +
+ + + +
+ +
+ + +
+ ) +} + +export default Aganse diff --git a/client/src/components/Home.jsx b/client/src/components/Home.jsx index 8cc0f9b..dec8e6d 100644 --- a/client/src/components/Home.jsx +++ b/client/src/components/Home.jsx @@ -15,6 +15,7 @@ const Home = (props) => {
+

with Housify your income will got height initul they reach the sky

diff --git a/client/src/components/Items.jsx b/client/src/components/Items.jsx index d6b1cd1..16281c9 100644 --- a/client/src/components/Items.jsx +++ b/client/src/components/Items.jsx @@ -1,9 +1,49 @@ import React from 'react' +import { Navigate, useNavigate } from 'react-router'; + +function Items(props) { + const navigate = useNavigate() + +console.log(props.user); + -function Items() { return ( -
Items
- ) -} +
+ <> + +{props.data.map((ele,index)=>{ + +return ( + +
+
+
+ Picture by Kyle Cottrell +
+

{ele.Adress}

+

${ele.Price}

+

{ele.description}

+ (navigate("/SignUp"))} className="card__button">Read more +
+
+
+
+ + + +) + + + + +})} + + + + + + +
+ )} export default Items \ No newline at end of file diff --git a/client/src/components/Profile.jsx b/client/src/components/Profile.jsx index 2a01c20..4abf651 100644 --- a/client/src/components/Profile.jsx +++ b/client/src/components/Profile.jsx @@ -1,12 +1,147 @@ -import React from 'react' +import { Key } from '@mui/icons-material'; +import axios from 'axios'; +import React, { useState } from 'react' +import { Navigate, useNavigate } from 'react-router'; + + + function Profile(props) { + + const navigate = useNavigate() +const [Details,SetDetails]=useState(true) +const [idd,Setidd]=useState("") + + + + const handelclick = ()=>{ + axios.delete(`http://localhost:3000/api/housify/${props.user[0]._id}`).then + ((result)=>{console.log(result)}).catch((err)=>{console.log(err);}) + } + + return ( + +
+ + {Details && <>
+ +
+ + + + + + + +{ props.data.map((ele,index)=>{ + + return ( + +
+
+
+ +
+

{ele.Adress}

+

${ele.Price}

+

{ele.description}

+ { SetDetails(!Details) , Setidd(ele._id) ; + }} className="card__button">Read more +
+
+
+
+ + + + )})} +

with Housify your income will got height initul they reach the sky

+ +
+
} + + +{!Details && <>
+
+ + + + + + +{props.data.filter((element)=> ( element._id === idd)).map((element,index)=> { return ( -
- Welcome to your profile + + <> +
+ {element.images.map((ele,index)=>{ return ( + + + )})} +
{element.type}
+

{element.Adress}

+

{element.description}

+

{element.for}

+

NbofBeds : {element.NbofBeds}

+

NbofBathrooms : {element.NbofBathrooms}

+

NbofKitchen : {element.NbofKitchen}

+

{element.Area}m2

+

${element.Price}

+ + + +
)})} + +
} + +
) } -export default Profile \ No newline at end of file +export default Profile diff --git a/client/src/components/SignIn.jsx b/client/src/components/SignIn.jsx index b0c9d29..de32b55 100644 --- a/client/src/components/SignIn.jsx +++ b/client/src/components/SignIn.jsx @@ -5,7 +5,7 @@ import { Card, Form, Button } from "react-bootstrap"; import "bootstrap/dist/css/bootstrap.min.css"; import axios from "axios"; -const SignIn = () => { +const SignIn = (props) => { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); @@ -16,6 +16,19 @@ const SignIn = () => { password: password, }; + const handleClick=()=>{ + const filtred=props.user.filter((e)=>{ + return e.email===email}) + + console.log(filtred); + if(!!filtred.length){ + props.setUser(filtred) + + } + + else alert("T rawwaa7 signUp") + navigate("/SignIn")} + const handleEmail = (e) => { e.preventDefault(); setEmail(e.target.value); @@ -50,7 +63,7 @@ const SignIn = () => { <> - +
@@ -65,16 +78,16 @@ const SignIn = () => { onChange={handlePassword} /> -
(navigate("/SignUp"))}> - Ma3ndekch Compte!! Fech Testanna !! + If you don't have account you can create account
- +

with Housify your income will got height initul they reach the sky

); }; diff --git a/client/src/components/SignUp.jsx b/client/src/components/SignUp.jsx index 86e8c8b..e65b322 100644 --- a/client/src/components/SignUp.jsx +++ b/client/src/components/SignUp.jsx @@ -89,17 +89,19 @@ export default function SignUp() { }; return ( -
+
+ + -

Sajjel Rou7ek

+

SignUp

-
 Name  lastName 
+              
 FirstName  lastName 
               
@@ -157,14 +159,15 @@ export default function SignUp() {
(navigate("/SignIn"))}> - 3ndek Compte ? Connecti mela !! + If you have account you can LogIn
-
+
+

with Housify your income will got height initul they reach the sky

diff --git a/client/src/components/Update.jsx b/client/src/components/Update.jsx new file mode 100644 index 0000000..be5c658 --- /dev/null +++ b/client/src/components/Update.jsx @@ -0,0 +1,118 @@ +import axios from 'axios'; +import React, { useState } from 'react' +import { useNavigate } from 'react-router'; + + + +function update(props) { + + + console.log(props.user); + + const navigate = useNavigate() + const [firstname,Setfirstname]=useState("") + const [lastname,Setlastname]=useState("") + const [contact,Setcontact]=useState("") + const [email,Setemail]=useState("") + const [password,Setpassword]=useState("") + const [age,Setage]=useState("") + const [img,Setimg]=useState("") + + + const handelclick = ()=>{ +axios.put(`/api/items/${props.user[0]._id}`, { + FirstName : firstname, + LastName: lastname, + Age:age, + email:email, + password:password, + contact:contact +}).then((result)=>{console.log(result);}).catch((err)=>{console.log(err)})} + + return ( + + + + + +
+ + + + + + +
+
+

+ + Authentic Collection + +

+
+ +
+ + + + + + + + +
+ + +
+
+ + + + + +
+
+ ) +} + +export default update diff --git a/client/src/components/Userposts.jsx b/client/src/components/Userposts.jsx new file mode 100644 index 0000000..6420523 --- /dev/null +++ b/client/src/components/Userposts.jsx @@ -0,0 +1,80 @@ +import React from 'react' +import { useNavigate } from 'react-router'; +import Search from './Search.jsx'; + +function Userposts(props) { + + const navigate=useNavigate() + const handelclick = ()=>{ + axios.delete(`/api/items/${props.user[0]._id}`).then + ((result)=>{console.log(result)}).catch((err)=>{console.log(err);}) + } + return ( + +
+ +
+ + + + + + + + +{ props.data.filter((element)=>(element.user === props.user[0]._id)).map((ele,index)=>{ + + return ( + +
+ +
+
+ Picture by Kyle Cottrell +
+

{ele.Adress}

+

${ele.Price}

+

{ele.description}

+ Read more +
+
+
+
+ + + )})} +

with Housify your income will got height initul they reach the sky

+ +
+
+ + + ) +} + + + + +export default Userposts diff --git a/client/src/index.jsx b/client/src/index.jsx index af27b16..7a2c74c 100644 --- a/client/src/index.jsx +++ b/client/src/index.jsx @@ -11,17 +11,24 @@ import Profile from './components/Profile.jsx' import Home from "./components/Home.jsx" import About from "./components/About.jsx" import Search from './components/Search.jsx' +import Update from './components/Update.jsx' +import Userposts from './components/Userposts.jsx' +import Addproudect from './components/Addproudect.jsx' +import Aganse from './components/Aganse.jsx' const App = () => { - const [items, setItems] = useState([]) + const [user, setUser] = useState([]) + const [data,setdata]=useState([]) + const [relod,Setrelod]=useState(false) + useEffect(() => { $.ajax({ url: '/api/items', success: (data) => { console.log(data) - setItems(data) + setUser(data) }, headers : {"authorization" : localStorage.getItem("bearer")}, error: (err) => { @@ -30,9 +37,16 @@ const App = () => { }) }, []) + useEffect(()=> { + axios.get("/api/housify").then((result)=>{ + setdata(result.data)}).catch((err)=>{ + console.log(err); + })},[relod]) + + const search = (query) => { console.log(query); -let newData = items.filter((e) => { +let newData = user.filter((e) => { return e.for.toLowerCase().includes(query.toLowerCase()); }); setItems(newData); @@ -46,45 +60,34 @@ return (
  • Home
  • About us
  • -
  • Posts
  • -
  • Login
  • -
  • SignUp
  • +
  • Posts
  • +
  • Login
  • +
  • SignUp
  • +
}> }> - }> - }> + }> + }> }> - }> + }> + }> + }> + }> + }> - {/*
-

Housify 4 Sell&Buy

-
*/} +
) - // return ( - // - //
- - // - // - // - //
- //
- // ) } ReactDOM.render(, document.getElementById('app')) diff --git a/server/controllers/post.controller.js b/server/controllers/post.controller.js index 8c61c79..16a4efc 100644 --- a/server/controllers/post.controller.js +++ b/server/controllers/post.controller.js @@ -13,6 +13,7 @@ const selectPost = async function (req, res) { const addpost = async function (req, res) { try { + const id=req.params.id const items = await Post.create({ Price : req.body.Price, @@ -24,7 +25,7 @@ const addpost = async function (req, res) { NbofKitchen:req.body.NbofKitchen, Area: req.body.Area, description: req.body.description, - Address: req.body.Address, + Adress: req.body.Adress, images: req.body.images, user:id }); diff --git a/server/controllers/user.controller.js b/server/controllers/user.controller.js index d1a7102..1a4cc6f 100644 --- a/server/controllers/user.controller.js +++ b/server/controllers/user.controller.js @@ -11,7 +11,7 @@ cloudinary.config({ }); -const User = require("../database-mongo/Item.model.js"); +const {User} = require("../database-mongo/Item.model.js"); const selectAll = function (req, res) {