Compare commits
3 Commits
c05d369d8a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| e993d93f03 | |||
| b03b0997e2 | |||
| a84ea3be76 |
120
keynest/package-lock.json
generated
@@ -12,9 +12,12 @@
|
|||||||
"@testing-library/jest-dom": "^6.6.3",
|
"@testing-library/jest-dom": "^6.6.3",
|
||||||
"@testing-library/react": "^16.2.0",
|
"@testing-library/react": "^16.2.0",
|
||||||
"@testing-library/user-event": "^13.5.0",
|
"@testing-library/user-event": "^13.5.0",
|
||||||
|
"axios": "^1.9.0",
|
||||||
|
"lorem-ipsum": "^2.0.8",
|
||||||
"react": "^19.1.0",
|
"react": "^19.1.0",
|
||||||
"react-dom": "^19.1.0",
|
"react-dom": "^19.1.0",
|
||||||
"react-router-dom": "^7.4.1",
|
"react-modal": "^3.16.3",
|
||||||
|
"react-router-dom": "^7.5.3",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"styled-components": "^6.1.16",
|
"styled-components": "^6.1.16",
|
||||||
"web-vitals": "^2.1.4"
|
"web-vitals": "^2.1.4"
|
||||||
@@ -3674,12 +3677,6 @@
|
|||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/cookie": {
|
|
||||||
"version": "0.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz",
|
|
||||||
"integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/@types/eslint": {
|
"node_modules/@types/eslint": {
|
||||||
"version": "8.56.12",
|
"version": "8.56.12",
|
||||||
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.12.tgz",
|
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.12.tgz",
|
||||||
@@ -4932,6 +4929,32 @@
|
|||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/axios": {
|
||||||
|
"version": "1.9.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.9.0.tgz",
|
||||||
|
"integrity": "sha512-re4CqKTJaURpzbLHtIi6XpDv20/CnpXOtjRY5/CU32L8gU8ek9UIivcfvSWvmKEngmVbrUtPpdDwWDWL7DNHvg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"follow-redirects": "^1.15.6",
|
||||||
|
"form-data": "^4.0.0",
|
||||||
|
"proxy-from-env": "^1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/axios/node_modules/form-data": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"asynckit": "^0.4.0",
|
||||||
|
"combined-stream": "^1.0.8",
|
||||||
|
"es-set-tostringtag": "^2.1.0",
|
||||||
|
"mime-types": "^2.1.12"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/axobject-query": {
|
"node_modules/axobject-query": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz",
|
||||||
@@ -7902,6 +7925,12 @@
|
|||||||
"url": "https://github.com/sindresorhus/execa?sponsor=1"
|
"url": "https://github.com/sindresorhus/execa?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/exenv": {
|
||||||
|
"version": "1.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/exenv/-/exenv-1.2.2.tgz",
|
||||||
|
"integrity": "sha512-Z+ktTxTwv9ILfgKCk32OX3n/doe+OcLTRtqK9pcL+JsP3J1/VW8Uvl4ZjLlKqeW4rzK4oesDOGMEMRIZqtP4Iw==",
|
||||||
|
"license": "BSD-3-Clause"
|
||||||
|
},
|
||||||
"node_modules/exit": {
|
"node_modules/exit": {
|
||||||
"version": "0.1.2",
|
"version": "0.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz",
|
||||||
@@ -11272,6 +11301,31 @@
|
|||||||
"loose-envify": "cli.js"
|
"loose-envify": "cli.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/lorem-ipsum": {
|
||||||
|
"version": "2.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/lorem-ipsum/-/lorem-ipsum-2.0.8.tgz",
|
||||||
|
"integrity": "sha512-5RIwHuCb979RASgCJH0VKERn9cQo/+NcAi2BMe9ddj+gp7hujl6BI+qdOG4nVsLDpwWEJwTVYXNKP6BGgbcoGA==",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"commander": "^9.3.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"lorem-ipsum": "dist/bin/lorem-ipsum.bin.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8.x",
|
||||||
|
"npm": ">= 5.x"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lorem-ipsum/node_modules/commander": {
|
||||||
|
"version": "9.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
|
||||||
|
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": "^12.20.0 || >=14"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/lower-case": {
|
"node_modules/lower-case": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz",
|
||||||
@@ -13699,6 +13753,12 @@
|
|||||||
"node": ">= 0.10"
|
"node": ">= 0.10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/proxy-from-env": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/psl": {
|
"node_modules/psl": {
|
||||||
"version": "1.15.0",
|
"version": "1.15.0",
|
||||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.15.0.tgz",
|
"resolved": "https://registry.npmjs.org/psl/-/psl-1.15.0.tgz",
|
||||||
@@ -13987,6 +14047,28 @@
|
|||||||
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
|
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/react-lifecycles-compat": {
|
||||||
|
"version": "3.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
|
||||||
|
"integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/react-modal": {
|
||||||
|
"version": "3.16.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-modal/-/react-modal-3.16.3.tgz",
|
||||||
|
"integrity": "sha512-yCYRJB5YkeQDQlTt17WGAgFJ7jr2QYcWa1SHqZ3PluDmnKJ/7+tVU+E6uKyZ0nODaeEj+xCpK4LcSnKXLMC0Nw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"exenv": "^1.2.0",
|
||||||
|
"prop-types": "^15.7.2",
|
||||||
|
"react-lifecycles-compat": "^3.0.0",
|
||||||
|
"warning": "^4.0.3"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^0.14.0 || ^15.0.0 || ^16 || ^17 || ^18 || ^19",
|
||||||
|
"react-dom": "^0.14.0 || ^15.0.0 || ^16 || ^17 || ^18 || ^19"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react-refresh": {
|
"node_modules/react-refresh": {
|
||||||
"version": "0.11.0",
|
"version": "0.11.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz",
|
||||||
@@ -13997,12 +14079,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-router": {
|
"node_modules/react-router": {
|
||||||
"version": "7.4.1",
|
"version": "7.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.5.3.tgz",
|
||||||
"integrity": "sha512-Vmizn9ZNzxfh3cumddqv3kLOKvc7AskUT0dC1prTabhiEi0U4A33LmkDOJ79tXaeSqCqMBXBU/ySX88W85+EUg==",
|
"integrity": "sha512-3iUDM4/fZCQ89SXlDa+Ph3MevBrozBAI655OAfWQlTm9nBR0IKlrmNwFow5lPHttbwvITZfkeeeZFP6zt3F7pw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/cookie": "^0.6.0",
|
|
||||||
"cookie": "^1.0.1",
|
"cookie": "^1.0.1",
|
||||||
"set-cookie-parser": "^2.6.0",
|
"set-cookie-parser": "^2.6.0",
|
||||||
"turbo-stream": "2.4.0"
|
"turbo-stream": "2.4.0"
|
||||||
@@ -14021,12 +14102,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-router-dom": {
|
"node_modules/react-router-dom": {
|
||||||
"version": "7.4.1",
|
"version": "7.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.5.3.tgz",
|
||||||
"integrity": "sha512-L3/4tig0Lvs6m6THK0HRV4eHUdpx0dlJasgCxXKnavwhh4tKYgpuZk75HRYNoRKDyDWi9QgzGXsQ1oQSBlWpAA==",
|
"integrity": "sha512-cK0jSaTyW4jV9SRKAItMIQfWZ/D6WEZafgHuuCb9g+SjhLolY78qc+De4w/Cz9ybjvLzShAmaIMEXt8iF1Cm+A==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react-router": "7.4.1"
|
"react-router": "7.5.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20.0.0"
|
"node": ">=20.0.0"
|
||||||
@@ -16837,6 +16918,15 @@
|
|||||||
"makeerror": "1.0.12"
|
"makeerror": "1.0.12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/warning": {
|
||||||
|
"version": "4.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz",
|
||||||
|
"integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"loose-envify": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/watchpack": {
|
"node_modules/watchpack": {
|
||||||
"version": "2.4.2",
|
"version": "2.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz",
|
||||||
|
|||||||
@@ -7,9 +7,12 @@
|
|||||||
"@testing-library/jest-dom": "^6.6.3",
|
"@testing-library/jest-dom": "^6.6.3",
|
||||||
"@testing-library/react": "^16.2.0",
|
"@testing-library/react": "^16.2.0",
|
||||||
"@testing-library/user-event": "^13.5.0",
|
"@testing-library/user-event": "^13.5.0",
|
||||||
|
"axios": "^1.9.0",
|
||||||
|
"lorem-ipsum": "^2.0.8",
|
||||||
"react": "^19.1.0",
|
"react": "^19.1.0",
|
||||||
"react-dom": "^19.1.0",
|
"react-dom": "^19.1.0",
|
||||||
"react-router-dom": "^7.4.1",
|
"react-modal": "^3.16.3",
|
||||||
|
"react-router-dom": "^7.5.3",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"styled-components": "^6.1.16",
|
"styled-components": "^6.1.16",
|
||||||
"web-vitals": "^2.1.4"
|
"web-vitals": "^2.1.4"
|
||||||
|
|||||||
BIN
keynest/public/images/Image10.png
Normal file
|
After Width: | Height: | Size: 92 KiB |
BIN
keynest/public/images/Image11.png
Normal file
|
After Width: | Height: | Size: 131 KiB |
BIN
keynest/public/images/Image12.png
Normal file
|
After Width: | Height: | Size: 123 KiB |
BIN
keynest/public/images/Image4.png
Normal file
|
After Width: | Height: | Size: 135 KiB |
BIN
keynest/public/images/Image5.png
Normal file
|
After Width: | Height: | Size: 139 KiB |
BIN
keynest/public/images/Image6.png
Normal file
|
After Width: | Height: | Size: 127 KiB |
BIN
keynest/public/images/Image7.png
Normal file
|
After Width: | Height: | Size: 191 KiB |
BIN
keynest/public/images/Image8.png
Normal file
|
After Width: | Height: | Size: 139 KiB |
BIN
keynest/public/images/Image9.png
Normal file
|
After Width: | Height: | Size: 162 KiB |
BIN
keynest/public/images/apartment1.jpg
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
keynest/public/images/apartment2.jpg
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
keynest/public/images/apartment3.jpg
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
keynest/public/images/apartment4.jpg
Normal file
|
After Width: | Height: | Size: 430 KiB |
BIN
keynest/public/images/apartment5.jpg
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
keynest/public/images/apartment6.jpg
Normal file
|
After Width: | Height: | Size: 268 KiB |
@@ -1,21 +1,54 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import './App.css';
|
import './App.css';
|
||||||
|
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
|
||||||
import Header from './components/Header';
|
import Header from './components/Header';
|
||||||
import ApartmentRentals from './components/ApartmentRentals';
|
import ApartmentRentals from './components/ApartmentRentals';
|
||||||
import ApartmentOptions from './components/ApartmentOptions';
|
import ApartmentOptions from './components/ApartmentOptions';
|
||||||
import ApartmentAmenities from './components/ApartmentAmenities';
|
import { AuthProvider, useAuth } from './components/AuthContext';
|
||||||
import NearbyAttractions from './components/NearbyAttractions';
|
import BookingPage from './components/BookingPage';
|
||||||
|
import MyRentals from './components/MyRentals';
|
||||||
|
import Footer from './components/Footer';
|
||||||
|
import ApartmentList from './components/ApartmentList';
|
||||||
|
import { RentalProvider } from './components/RentalContext'; // Corrected import path
|
||||||
|
|
||||||
|
function AppContent() {
|
||||||
|
const { isLoggedIn, logout, user } = useAuth();
|
||||||
|
|
||||||
function App() {
|
|
||||||
return (
|
return (
|
||||||
<div className='app'>
|
<div className='app'>
|
||||||
<Header />
|
<Header />
|
||||||
|
{isLoggedIn ? (
|
||||||
|
<>
|
||||||
<ApartmentRentals />
|
<ApartmentRentals />
|
||||||
<ApartmentOptions />
|
<ApartmentOptions />
|
||||||
<ApartmentAmenities />
|
<Footer />
|
||||||
<NearbyAttractions />
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<ApartmentRentals />
|
||||||
|
<ApartmentOptions />
|
||||||
|
<Footer />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function App() {
|
||||||
|
return (
|
||||||
|
<Router>
|
||||||
|
<AuthProvider>
|
||||||
|
<RentalProvider> {/* Added RentalProvider here */}
|
||||||
|
<Routes>
|
||||||
|
<Route path="/" element={<AppContent />} />
|
||||||
|
<Route path="/apartment-list" element={<ApartmentList />} />
|
||||||
|
<Route path="/booking/:apartmentId" element={<BookingPage />} />
|
||||||
|
<Route path="/myrentals" element={<MyRentals />} />
|
||||||
|
</Routes>
|
||||||
|
</RentalProvider> {/* RentalProvider wraps Routes */}
|
||||||
|
</AuthProvider>
|
||||||
|
</Router>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export default App;
|
export default App;
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
.apartment_header{
|
|
||||||
background-color: #FCFBFC;
|
|
||||||
}
|
|
||||||
.apartment__Amenities{
|
|
||||||
position: absolute;
|
|
||||||
width: 1290px;
|
|
||||||
height: 187px;
|
|
||||||
top: 800px;
|
|
||||||
text-align: center;
|
|
||||||
left: 290px;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
}
|
|
||||||
.icon__Amenities{
|
|
||||||
position: absolute;
|
|
||||||
width: 43px;
|
|
||||||
height: 44px;
|
|
||||||
left: 624px;
|
|
||||||
}
|
|
||||||
.heading__Amenities{
|
|
||||||
position: absolute;
|
|
||||||
width: 1290px;
|
|
||||||
height: 56px;
|
|
||||||
top: 61px;
|
|
||||||
font-family: 'Instrument Serif';
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 46px;
|
|
||||||
line-height: 120%;
|
|
||||||
text-align: center;
|
|
||||||
color: #1F1E1F;
|
|
||||||
}
|
|
||||||
.info__Amenities{
|
|
||||||
position: absolute;
|
|
||||||
width: 608px;
|
|
||||||
height: 54px;
|
|
||||||
left: 341px;
|
|
||||||
top: 131px;
|
|
||||||
font-family: 'Nunito';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 18px;
|
|
||||||
line-height: 150%;
|
|
||||||
text-align: center;
|
|
||||||
color: #999798;
|
|
||||||
}
|
|
||||||
.img__Amenitiess{
|
|
||||||
position: absolute;
|
|
||||||
width: 1281px;
|
|
||||||
height: 587px;
|
|
||||||
left: 379px;
|
|
||||||
top: 1000px;
|
|
||||||
display: flex;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.img__Amenities{
|
|
||||||
width: 377px;
|
|
||||||
height: 506px;
|
|
||||||
align-self: stretch;
|
|
||||||
padding-right: 25px;
|
|
||||||
}
|
|
||||||
.img__Amenities1{
|
|
||||||
width: 779px;
|
|
||||||
height: 506px;
|
|
||||||
border-radius: 0px;
|
|
||||||
align-self: stretch;
|
|
||||||
}
|
|
||||||
.img_name{
|
|
||||||
font-family: 'Nunito';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 19px;
|
|
||||||
line-height: 120%;
|
|
||||||
color: #666464;
|
|
||||||
flex: none;
|
|
||||||
}
|
|
||||||
.img_info{
|
|
||||||
font-family: 'Nunito';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 17px;
|
|
||||||
line-height: 120%;
|
|
||||||
color: #727174;
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { Link, useNavigate } from 'react-router-dom';
|
|
||||||
import './ApartmentAmenities.css';
|
|
||||||
|
|
||||||
function ApartmentAmenities(){
|
|
||||||
return(
|
|
||||||
<header className='apartment'>
|
|
||||||
<div className='apartment_header'>
|
|
||||||
<div className='apartment__Amenities'>
|
|
||||||
<img className ='icon__Amenities' src={process.env.PUBLIC_URL + '/images/Icon.jpg'} alt='изображение' />
|
|
||||||
<h1 className='heading__Amenities'>Apartment Amenities</h1>
|
|
||||||
<p className='info__Amenities'>Enjoy a range of modern amenities in our apartments, from fully-equipped kitchens to en-suite laundry facilities, ensuring your comfort and convenience</p>
|
|
||||||
</div>
|
|
||||||
<div className='img__Amenitiess'>
|
|
||||||
<div>
|
|
||||||
<img className ='img__Amenities' src={process.env.PUBLIC_URL + '/images/Image2.png'} alt='изображение' />
|
|
||||||
<p className='img_name'>Stunning Views</p>
|
|
||||||
<p className='img_info'>Natural Lighting</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<img className ='img__Amenities1' src={process.env.PUBLIC_URL + '/images/Image3.png'} alt='изображение' />
|
|
||||||
<p className='img_name'>Relaxing Atmosphere</p>
|
|
||||||
<p className='img_info'>Cozy Interiors</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ApartmentAmenities;
|
|
||||||
46
keynest/src/components/ApartmentList.css
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
.apartment-list-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.apartment-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, minmax(300px, 1fr)); /* Всегда два столбца */
|
||||||
|
gap: 20px;
|
||||||
|
padding-top: 60px;
|
||||||
|
padding-right: 300px;
|
||||||
|
padding-left: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.apartment-card {
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 15px;
|
||||||
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.apartment-image {
|
||||||
|
width: 100%;
|
||||||
|
height: 200px;
|
||||||
|
object-fit: contain; /* Изображение отображается полностью, сохраняя пропорции */
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.apartment-price {
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.apartment-card button {
|
||||||
|
background-color: #242323;
|
||||||
|
color: white;
|
||||||
|
padding: 10px 15px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.apartment-card button:hover {
|
||||||
|
background-color: #0056b3;
|
||||||
|
}
|
||||||
31
keynest/src/components/ApartmentList.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import './ApartmentList.css';
|
||||||
|
import apartments from '../../src/storage/apartments.json'; // Импортируйте JSON-файл
|
||||||
|
|
||||||
|
function ApartmentList() {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const handleBookApartment = (apartmentId) => {
|
||||||
|
navigate(`/booking/${apartmentId}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="apartment-list-container">
|
||||||
|
<h1>Available Apartments</h1>
|
||||||
|
<div className="apartment-grid">
|
||||||
|
{apartments.map(apartment => (
|
||||||
|
<div key={apartment.id} className="apartment-card">
|
||||||
|
<img src={process.env.PUBLIC_URL + apartment.imageUrl} alt={apartment.name} className="apartment-image" />
|
||||||
|
<h2>{apartment.name}</h2>
|
||||||
|
<p>{apartment.description}</p>
|
||||||
|
<p className="apartment-price">{apartment.price}</p>
|
||||||
|
<button onClick={() => handleBookApartment(apartment.id)}>Book Now</button>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ApartmentList;
|
||||||
@@ -1,18 +1,33 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Link, useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import './ApartmentRentals.css';
|
import './ApartmentRentals.css';
|
||||||
|
|
||||||
function ApartmentRentals(){
|
function ApartmentRentals() {
|
||||||
return(
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const handleBookNowClick = () => {
|
||||||
|
navigate('/apartment-list'); // Переход на страницу ApartmentList
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
<header className='apartment'>
|
<header className='apartment'>
|
||||||
<img className ='backround__section' src={process.env.PUBLIC_URL + '/images/Section.png'} alt='изображение' />
|
<img
|
||||||
|
className='backround__section'
|
||||||
|
src={process.env.PUBLIC_URL + '/images/Section.png'}
|
||||||
|
alt='изображение'
|
||||||
|
/>
|
||||||
<div className='Apartament__content'>
|
<div className='Apartament__content'>
|
||||||
<h1 className='heading'>Short-term and Long-term Apartment Rentals</h1>
|
<h1 className='heading'>Short-term and Long-term Apartment Rentals</h1>
|
||||||
<p className='info'>Discover the perfect apartment for your needs, whether it's a quick stay or a long-term investment</p>
|
<p className='info'>Discover the perfect apartment for your needs, whether it's a quick stay or a long-term investment</p>
|
||||||
<button className='content__button'>Book Now</button>
|
<button
|
||||||
|
className='content__button'
|
||||||
|
onClick={handleBookNowClick}
|
||||||
|
>
|
||||||
|
Book Now
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ApartmentRentals;
|
export default ApartmentRentals;
|
||||||
41
keynest/src/components/AuthContext.js
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import React, { createContext, useState, useEffect, useContext } from 'react';
|
||||||
|
|
||||||
|
const AuthContext = createContext();
|
||||||
|
|
||||||
|
export const AuthProvider = ({ children }) => {
|
||||||
|
const [user, setUser] = useState(() => {
|
||||||
|
// При инициализации проверяем, есть ли данные в localStorage
|
||||||
|
const storedUser = localStorage.getItem('user');
|
||||||
|
return storedUser ? JSON.parse(storedUser) : null;
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// При изменении user сохраняем его в localStorage
|
||||||
|
if (user) {
|
||||||
|
localStorage.setItem('user', JSON.stringify(user));
|
||||||
|
} else {
|
||||||
|
// Если user становится null, удаляем данные из localStorage
|
||||||
|
localStorage.removeItem('user');
|
||||||
|
}
|
||||||
|
}, [user]);
|
||||||
|
|
||||||
|
const login = (userData) => {
|
||||||
|
setUser(userData);
|
||||||
|
};
|
||||||
|
|
||||||
|
const logout = () => {
|
||||||
|
setUser(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
const isLoggedIn = !!user;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AuthContext.Provider value={{ user, isLoggedIn, login, logout }}>
|
||||||
|
{children}
|
||||||
|
</AuthContext.Provider>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useAuth = () => {
|
||||||
|
return useContext(AuthContext);
|
||||||
|
};
|
||||||
18
keynest/src/components/AuthModal.css
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
.auth-modal {
|
||||||
|
position: fixed; /* Или absolute, если нужно позиционировать относительно родителя */
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%); /* Центрирование */
|
||||||
|
z-index: 1000; /* Убедитесь, что z-index достаточно высок */
|
||||||
|
/* Другие стили */
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-modal-overlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: rgba(0, 0, 0, 0.5); /* Полупрозрачный фон */
|
||||||
|
z-index: 999; /* Меньше, чем z-index модального окна */
|
||||||
|
}
|
||||||
105
keynest/src/components/AuthModal.js
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
import React, { useState } from 'react';
|
||||||
|
import Modal from 'react-modal';
|
||||||
|
|
||||||
|
Modal.setAppElement('#root');
|
||||||
|
|
||||||
|
function AuthModal({ isOpen, onRequestClose, onLogin }) {
|
||||||
|
const [username, setUsername] = useState('');
|
||||||
|
const [password, setPassword] = useState('');
|
||||||
|
const [isLogin, setIsLogin] = useState(true);
|
||||||
|
|
||||||
|
const modalStyles = {
|
||||||
|
overlay: {
|
||||||
|
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
||||||
|
zIndex: 1000
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
top: '50%',
|
||||||
|
left: '50%',
|
||||||
|
right: 'auto',
|
||||||
|
bottom: 'auto',
|
||||||
|
marginRight: '-50%',
|
||||||
|
transform: 'translate(-50%, -50%)',
|
||||||
|
padding: '20px',
|
||||||
|
width: '300px',
|
||||||
|
borderRadius: '8px',
|
||||||
|
boxShadow: '0 4px 8px rgba(0, 0, 0, 0.1)',
|
||||||
|
border: 'none'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const formStyles = {
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
gap: '15px'
|
||||||
|
};
|
||||||
|
|
||||||
|
const inputStyles = {
|
||||||
|
padding: '10px',
|
||||||
|
borderRadius: '4px',
|
||||||
|
border: '1px solid #ccc',
|
||||||
|
fontSize: '16px'
|
||||||
|
};
|
||||||
|
|
||||||
|
const buttonStyles = {
|
||||||
|
padding: '12px',
|
||||||
|
borderRadius: '4px',
|
||||||
|
border: 'none',
|
||||||
|
backgroundColor: '#242323',
|
||||||
|
color: 'white',
|
||||||
|
fontSize: '16px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
':hover': {
|
||||||
|
backgroundColor: '#0056b3'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const toggleButtonStyles = {
|
||||||
|
background: 'none',
|
||||||
|
border: 'none',
|
||||||
|
color: '#007bff',
|
||||||
|
cursor: 'pointer',
|
||||||
|
fontSize: '14px',
|
||||||
|
textDecoration: 'underline'
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSubmit = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
onLogin(username, password);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
isOpen={isOpen}
|
||||||
|
onRequestClose={onRequestClose}
|
||||||
|
style={modalStyles}
|
||||||
|
contentLabel={isLogin ? "Login Modal" : "Register Modal"}
|
||||||
|
>
|
||||||
|
<h2>{isLogin ? 'Login' : 'Register'}</h2>
|
||||||
|
<form style={formStyles} onSubmit={handleSubmit}>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
placeholder="Username"
|
||||||
|
value={username}
|
||||||
|
onChange={e => setUsername(e.target.value)}
|
||||||
|
style={inputStyles}
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
placeholder="Password"
|
||||||
|
value={password}
|
||||||
|
onChange={e => setPassword(e.target.value)}
|
||||||
|
style={inputStyles}
|
||||||
|
/>
|
||||||
|
<button type="submit" style={buttonStyles}>
|
||||||
|
{isLogin ? 'Login' : 'Register'}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<button style={toggleButtonStyles} onClick={() => setIsLogin(!isLogin)}>
|
||||||
|
{isLogin ? 'Create an account' : 'Already have an account?'}
|
||||||
|
</button>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AuthModal;
|
||||||
104
keynest/src/components/AuthProvider.js
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
import React, { createContext, useState, useEffect, useContext } from 'react';
|
||||||
|
// import axios from 'axios'; // Убираем axios
|
||||||
|
import users from './storage/users.json'; // Импортируем JSON
|
||||||
|
|
||||||
|
const AuthContext = createContext();
|
||||||
|
|
||||||
|
export const useAuth = () => useContext(AuthContext);
|
||||||
|
|
||||||
|
export const AuthProvider = ({ children }) => {
|
||||||
|
const [user, setUser] = useState(null);
|
||||||
|
const [token, setToken] = useState(localStorage.getItem('token') || null);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const initializeAuth = async () => {
|
||||||
|
setLoading(true);
|
||||||
|
if (token) {
|
||||||
|
// axios.defaults.headers.common['Authorization'] = `Bearer ${token}`; // Убираем axios
|
||||||
|
try {
|
||||||
|
// Замените на реальный запрос к API для получения данных пользователя
|
||||||
|
// const response = await axios.get('/api/user'); // Убираем axios
|
||||||
|
// setUser(response.data); // Убираем axios
|
||||||
|
// Ищем пользователя в JSON файле по токену (username)
|
||||||
|
const storedUsername = localStorage.getItem('username');
|
||||||
|
const foundUser = users.find(u => u.username === storedUsername);
|
||||||
|
if (foundUser) {
|
||||||
|
setUser(foundUser);
|
||||||
|
} else {
|
||||||
|
logout();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Ошибка при аутентификации:', error);
|
||||||
|
logout(); // Очищаем токен, если он недействителен
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setLoading(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
initializeAuth();
|
||||||
|
}, [token]);
|
||||||
|
|
||||||
|
const login = async ({ username, password }) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const foundUser = users.find(u => u.username === username && u.password === password);
|
||||||
|
if (foundUser) {
|
||||||
|
const newToken = username; // В качестве токена используем username
|
||||||
|
localStorage.setItem('token', newToken);
|
||||||
|
localStorage.setItem('username', username); // Сохраняем username
|
||||||
|
setToken(newToken);
|
||||||
|
// axios.defaults.headers.common['Authorization'] = `Bearer ${newToken}`; // Убираем axios
|
||||||
|
setUser(foundUser);
|
||||||
|
resolve();
|
||||||
|
} else {
|
||||||
|
reject(new Error('Неверный логин или пароль'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const register = async ({ username, password }) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
// Проверяем, существует ли уже пользователь с таким именем
|
||||||
|
const existingUser = users.find(u => u.username === username);
|
||||||
|
if (existingUser) {
|
||||||
|
reject(new Error('Пользователь с таким именем уже существует'));
|
||||||
|
} else {
|
||||||
|
// В реальном приложении нужно добавить пользователя в базу данных
|
||||||
|
// Здесь мы просто эмулируем добавление
|
||||||
|
const newUser = {
|
||||||
|
id: users.length + 1,
|
||||||
|
username,
|
||||||
|
password
|
||||||
|
};
|
||||||
|
users.push(newUser);
|
||||||
|
// Автоматически логиним после регистрации
|
||||||
|
login({ username, password })
|
||||||
|
.then(resolve)
|
||||||
|
.catch(reject);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const logout = () => {
|
||||||
|
localStorage.removeItem('token');
|
||||||
|
localStorage.removeItem('username');
|
||||||
|
setToken(null);
|
||||||
|
setUser(null);
|
||||||
|
// delete axios.defaults.headers.common['Authorization']; // Убираем axios
|
||||||
|
};
|
||||||
|
|
||||||
|
const value = {
|
||||||
|
user,
|
||||||
|
token,
|
||||||
|
login,
|
||||||
|
register,
|
||||||
|
logout,
|
||||||
|
loading,
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AuthContext.Provider value={value}>
|
||||||
|
{!loading && children}
|
||||||
|
</AuthContext.Provider>
|
||||||
|
);
|
||||||
|
};
|
||||||
135
keynest/src/components/BookingPage.css
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
|
||||||
|
.dark-theme {
|
||||||
|
background-color: #fff;
|
||||||
|
color: #000;
|
||||||
|
font-family: 'Nunito';
|
||||||
|
padding: 20px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark-theme h1 {
|
||||||
|
color: #242323;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark-theme p {
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.booking-form {
|
||||||
|
width: 90%;
|
||||||
|
max-width: 600px;
|
||||||
|
padding: 30px;
|
||||||
|
background-color: #000;
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group label {
|
||||||
|
color: #c6c3c3;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group input {
|
||||||
|
padding: 12px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: #fff;
|
||||||
|
color: #000;
|
||||||
|
font-size: 16px;
|
||||||
|
transition: background-color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group input:focus {
|
||||||
|
background-color: #eee;
|
||||||
|
outline: none;
|
||||||
|
box-shadow: 0 0 0 2px #242323;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.submit-button {
|
||||||
|
background-color: #242323;
|
||||||
|
color: #fff;
|
||||||
|
padding: 14px 24px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 18px;
|
||||||
|
transition: background-color 0.3s ease;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submit-button:hover {
|
||||||
|
background-color: #242323;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submit-button:focus {
|
||||||
|
outline: none;
|
||||||
|
box-shadow: 0 0 0 3px rgba(217, 217, 217, 0.5);
|
||||||
|
}
|
||||||
|
.message {
|
||||||
|
margin-top: 20px;
|
||||||
|
padding: 15px;
|
||||||
|
border-radius: 5px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success {
|
||||||
|
background-color: #4CAF50;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error {
|
||||||
|
background-color: #F44336;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.back-to-home-button {
|
||||||
|
background-color: #242323;
|
||||||
|
color: #fff;
|
||||||
|
padding: 10px 15px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 16px;
|
||||||
|
position: absolute;
|
||||||
|
top: 20px;
|
||||||
|
left: 20px;
|
||||||
|
transition: background-color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-to-home-button:hover {
|
||||||
|
background-color: #242323;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-to-home-button:focus {
|
||||||
|
outline: none;
|
||||||
|
box-shadow: 0 0 0 3px rgba(220, 220, 220, 0.5);
|
||||||
|
}
|
||||||
|
.apartment-price {
|
||||||
|
color: #fff;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
.booking-form h2 {
|
||||||
|
color: #fff;
|
||||||
|
font-size: 24px;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
139
keynest/src/components/BookingPage.js
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
import React, { useState } from 'react';
|
||||||
|
import { useParams, useNavigate } from 'react-router-dom';
|
||||||
|
import './BookingPage.css';
|
||||||
|
import apartments from '../../src/storage/apartments.json';
|
||||||
|
import { useRentalContext } from './RentalContext'; // Import useRentalContext
|
||||||
|
|
||||||
|
function BookingPage() {
|
||||||
|
const { apartmentId } = useParams();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const apartment = apartments.find(apartment => apartment.id === parseInt(apartmentId));
|
||||||
|
const [formData, setFormData] = useState({
|
||||||
|
name: '',
|
||||||
|
email: '',
|
||||||
|
checkin: '',
|
||||||
|
checkout: ''
|
||||||
|
});
|
||||||
|
const [message, setMessage] = useState('');
|
||||||
|
const [isSuccess, setIsSuccess] = useState(false);
|
||||||
|
const { addRental } = useRentalContext(); // Use addRental from RentalContext
|
||||||
|
|
||||||
|
const handleChange = (e) => {
|
||||||
|
setFormData({ ...formData, [e.target.name]: e.target.value });
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSubmit = async (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
const checkinDate = new Date(formData.checkin);
|
||||||
|
const checkoutDate = new Date(formData.checkout);
|
||||||
|
const today = new Date();
|
||||||
|
today.setHours(0, 0, 0, 0);
|
||||||
|
|
||||||
|
if (checkinDate < today) {
|
||||||
|
setMessage('Check-in date cannot be in the past.');
|
||||||
|
setIsSuccess(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkoutDate <= checkinDate) {
|
||||||
|
setMessage('Check-out date must be after check-in date.');
|
||||||
|
setIsSuccess(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const userId = localStorage.getItem('user_id');
|
||||||
|
if (!userId) {
|
||||||
|
setMessage('Please log in to make a booking.');
|
||||||
|
setIsSuccess(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const newRental = {
|
||||||
|
id: Date.now(),
|
||||||
|
userId: userId,
|
||||||
|
apartmentId: apartmentId,
|
||||||
|
name: formData.name,
|
||||||
|
email: formData.email,
|
||||||
|
checkin: formData.checkin,
|
||||||
|
checkout: formData.checkout,
|
||||||
|
apartmentName: apartment.name, // Include apartment name
|
||||||
|
apartmentPrice: apartment.price, // Include apartment price
|
||||||
|
status: 'Pending'
|
||||||
|
};
|
||||||
|
|
||||||
|
addRental(newRental); // Add the new rental to the context
|
||||||
|
|
||||||
|
setMessage('Booking successful!');
|
||||||
|
setIsSuccess(true);
|
||||||
|
setFormData({ name: '', email: '', checkin: '', checkout: '' });
|
||||||
|
} catch (error) {
|
||||||
|
setMessage('Booking failed. Please try again.');
|
||||||
|
setIsSuccess(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleBackToHome = () => {
|
||||||
|
navigate('/');
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!apartment) {
|
||||||
|
return (
|
||||||
|
<div className="booking-page dark-theme">
|
||||||
|
<button className="back-to-home-button" onClick={handleBackToHome}>
|
||||||
|
Back to Home
|
||||||
|
</button>
|
||||||
|
<h1>Apartment Not Found</h1>
|
||||||
|
<p>The requested apartment could not be found.</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="booking-page dark-theme">
|
||||||
|
<button className="back-to-home-button" onClick={handleBackToHome}>
|
||||||
|
Back to Home
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<h1>Book Your Apartment Now!</h1>
|
||||||
|
<p>Please fill out the form below to complete your booking.</p>
|
||||||
|
|
||||||
|
<form className="booking-form" onSubmit={handleSubmit}>
|
||||||
|
<h2 className='name'>{apartment.name}</h2>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<label htmlFor="name">Name:</label>
|
||||||
|
<input type="text" id="name" name="name" required value={formData.name} onChange={handleChange} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<label htmlFor="email">Email:</label>
|
||||||
|
<input type="email" id="email" name="email" required value={formData.email} onChange={handleChange} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<label htmlFor="checkin">Check-in Date:</label>
|
||||||
|
<input type="date" id="checkin" name="checkin" required value={formData.checkin} onChange={handleChange} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<label htmlFor="checkout">Check-out Date:</label>
|
||||||
|
<input type="date" id="checkout" name="checkout" required value={formData.checkout} onChange={handleChange} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p className="apartment-price">{apartment.price}</p>
|
||||||
|
|
||||||
|
<button type="submit" className="submit-button">Complete Booking</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{message && (
|
||||||
|
<div className={`message ${isSuccess ? 'success' : 'error'}`}>
|
||||||
|
{message}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BookingPage;
|
||||||
66
keynest/src/components/Footer.css
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
.footer {
|
||||||
|
background-color: #333;
|
||||||
|
color: #fff;
|
||||||
|
padding: 40px 0;
|
||||||
|
font-family: 'Nunito', sans-serif;
|
||||||
|
margin-top: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-container {
|
||||||
|
width: 90%;
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: 0 auto;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-around;
|
||||||
|
top: 1000px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-section {
|
||||||
|
margin-bottom: 30px;
|
||||||
|
flex: 1;
|
||||||
|
min-width: 250px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-section h3 {
|
||||||
|
color: #a6a5a8;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-section p {
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.social-links a {
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
margin-right: 15px;
|
||||||
|
transition: color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.social-links a:hover {
|
||||||
|
color: #bb86fc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-bottom {
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 20px;
|
||||||
|
width: 100%;
|
||||||
|
padding-top: 20px;
|
||||||
|
border-top: 1px solid #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-bottom p {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-bottom a {
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-bottom a:hover {
|
||||||
|
color: #bb86fc;
|
||||||
|
}
|
||||||
35
keynest/src/components/Footer.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import './Footer.css';
|
||||||
|
|
||||||
|
function Footer() {
|
||||||
|
return (
|
||||||
|
<footer className="footer">
|
||||||
|
<div className="footer-container">
|
||||||
|
<div className="footer-section">
|
||||||
|
<h3>About KeyNest</h3>
|
||||||
|
<p>KeyNest is your trusted platform for finding the perfect apartment rental. We connect renters with quality properties and exceptional service.</p>
|
||||||
|
</div>
|
||||||
|
<div className="footer-section">
|
||||||
|
<h3>Contact Us</h3>
|
||||||
|
<p>Email: info@keynest.com</p>
|
||||||
|
<p>Phone: +7 (904) 456-7890</p>
|
||||||
|
<p>Address: Oktyabrsky Prospekt 19, Syktyvkar, Russia</p>
|
||||||
|
</div>
|
||||||
|
<div className="footer-section">
|
||||||
|
<h3>Follow Us</h3>
|
||||||
|
<div className="social-links">
|
||||||
|
<a href="#" target="_blank" rel="noopener noreferrer">VKontakte</a>
|
||||||
|
<a href="#" target="_blank" rel="noopener noreferrer">Telegram</a>
|
||||||
|
<a href="#" target="_blank" rel="noopener noreferrer">WhatsApp</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="footer-bottom">
|
||||||
|
<p>© {new Date().getFullYear()} KeyNest. All rights reserved.</p>
|
||||||
|
<p><a href="/terms">Terms of Service</a> | <a href="/privacy">Privacy Policy</a></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Footer;
|
||||||
@@ -21,11 +21,14 @@ body{
|
|||||||
}
|
}
|
||||||
.menu {
|
.menu {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
.menu a{
|
.menu a{
|
||||||
margin-right: 158px;
|
margin-right: 158px;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #242323;
|
||||||
}
|
}
|
||||||
.login-button{
|
.button{
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
margin-right: 300px;
|
margin-right: 300px;
|
||||||
@@ -37,6 +40,7 @@ body{
|
|||||||
color: aliceblue;
|
color: aliceblue;
|
||||||
padding-left: 39px;
|
padding-left: 39px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo{
|
.logo{
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -1,25 +1,81 @@
|
|||||||
import React from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { Link, useNavigate } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import './Header.css';
|
import './Header.css';
|
||||||
|
import AuthModal from './AuthModal.js';
|
||||||
|
import { useAuth } from './AuthContext.js';
|
||||||
|
import { useRentalContext } from './RentalContext'; // Import useRentalContext
|
||||||
|
|
||||||
function Header(){
|
function Header() {
|
||||||
return(
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||||
|
const { isLoggedIn, login, logout } = useAuth();
|
||||||
|
const [users, setUsers] = useState([]);
|
||||||
|
const { clearRentals } = useRentalContext(); // Use clearRentals from RentalContext
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
fetchUsers();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const fetchUsers = async () => {
|
||||||
|
try {
|
||||||
|
const data = require('../../src/storage/users.json');
|
||||||
|
setUsers(data);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Ошибка при загрузке пользователей:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const openModal = () => {
|
||||||
|
console.log('openModal called');
|
||||||
|
setIsModalOpen(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeModal = () => {
|
||||||
|
setIsModalOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleLogin = async (username, password) => {
|
||||||
|
console.log('handleLogin called', username, password);
|
||||||
|
const user = users.find(user => user.username === username && user.password === password);
|
||||||
|
|
||||||
|
if (user) {
|
||||||
|
// Успешная аутентификация
|
||||||
|
login(user); // Сохраняем данные пользователя в AuthContext
|
||||||
|
localStorage.setItem('user_id', user.user_id.toString()); // Сохраняем user_id в localStorage
|
||||||
|
closeModal();
|
||||||
|
} else {
|
||||||
|
// Неверные учетные данные
|
||||||
|
alert('Неверное имя пользователя или пароль');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleLogout = () => {
|
||||||
|
logout();
|
||||||
|
localStorage.removeItem('user_id'); // Удаляем user_id из localStorage при выходе
|
||||||
|
clearRentals(); // Clear rentals from context
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
<header>
|
<header>
|
||||||
<div className='container'>
|
<div className="container">
|
||||||
<div className='logo'>
|
<div className="logo">
|
||||||
<img src={process.env.PUBLIC_URL + '/images/Logo(Nav) (1).png'} alt='изображение' />
|
<img src={process.env.PUBLIC_URL + '/images/Logo(Nav) (1).png'} alt="изображение" />
|
||||||
<span>KeyNest</span>
|
<span>KeyNest</span>
|
||||||
</div>
|
</div>
|
||||||
<nav className='menu'>
|
<nav className="menu">
|
||||||
<a>Home</a>
|
<Link to="/">Home</Link>
|
||||||
<a>About</a>
|
<Link to="/about">About</Link>
|
||||||
<a>Rentals</a>
|
<Link to="/myrentals">Rentals</Link>
|
||||||
<a>Contact</a>
|
<Link to="/contact">Contact</Link>
|
||||||
</nav>
|
</nav>
|
||||||
<button className='login-button'>Login</button>
|
{isLoggedIn ? (
|
||||||
|
<button className="logout-button button" onClick={handleLogout}>Logout</button>
|
||||||
|
) : (
|
||||||
|
<button className="login-button button" onClick={openModal}>Login</button>
|
||||||
|
)}
|
||||||
|
<AuthModal isOpen={isModalOpen} onRequestClose={closeModal} onLogin={handleLogin} />
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Header;
|
export default Header;
|
||||||
63
keynest/src/components/MyRentals.css
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
.my-rentals-page {
|
||||||
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
|
padding: 20px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #f4f4f4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-rentals-page h1 {
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rentals-list {
|
||||||
|
width: 90%;
|
||||||
|
max-width: 800px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rental-item {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
padding: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
transition: transform 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rental-item:hover {
|
||||||
|
transform: translateY(-5px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rental-item h3 {
|
||||||
|
color: #242324;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rental-item p {
|
||||||
|
color: #555;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
.back-to-home-button {
|
||||||
|
background-color: #242323;
|
||||||
|
color: #fff;
|
||||||
|
padding: 10px 15px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 16px;
|
||||||
|
position: absolute;
|
||||||
|
top: 20px;
|
||||||
|
left: 20px;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: background-color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-to-home-button:hover {
|
||||||
|
background-color: #242323;
|
||||||
|
}
|
||||||
60
keynest/src/components/MyRentals.js
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
import React, { useState, useEffect } from 'react';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
import './MyRentals.css';
|
||||||
|
import { useRentalContext } from './RentalContext';
|
||||||
|
import rentalsData from '../../src/storage/rentals.json'; // Import rentals data
|
||||||
|
|
||||||
|
function MyRentals() {
|
||||||
|
const { rentals } = useRentalContext();
|
||||||
|
const [rentalsFromJson, setRentalsFromJson] = useState([]);
|
||||||
|
const currentUserId = localStorage.getItem('user_id') || null;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// Load rentals from JSON
|
||||||
|
setRentalsFromJson(rentalsData);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Filter rentals from JSON for the current user
|
||||||
|
const userRentalsFromJson = rentalsFromJson.filter(rental => rental.userId === currentUserId);
|
||||||
|
|
||||||
|
// Combine rentals from context and JSON
|
||||||
|
const combinedRentals = [...rentals.filter(rental => rental.userId === currentUserId), ...userRentalsFromJson];
|
||||||
|
|
||||||
|
if (!currentUserId) {
|
||||||
|
return (
|
||||||
|
<div className="my-rentals-page">
|
||||||
|
<Link to="/" className="back-to-home-button">
|
||||||
|
Back to Home
|
||||||
|
</Link>
|
||||||
|
<h1>My Rentals</h1>
|
||||||
|
<p>Please log in to view your rentals.</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="my-rentals-page">
|
||||||
|
<Link to="/" className="back-to-home-button">
|
||||||
|
Back to Home
|
||||||
|
</Link>
|
||||||
|
<h1>My Rentals</h1>
|
||||||
|
<div className="rentals-list">
|
||||||
|
{combinedRentals.length === 0 ? (
|
||||||
|
<p>No rentals found.</p>
|
||||||
|
) : (
|
||||||
|
combinedRentals.map((rental) => (
|
||||||
|
<div key={rental.id} className="rental-item">
|
||||||
|
<h3>{rental.apartmentName || rental.title}</h3>
|
||||||
|
<p>Name: {rental.name}</p>
|
||||||
|
<p>Check-in: {rental.checkin}</p>
|
||||||
|
<p>Check-out: {rental.checkout}</p>
|
||||||
|
<p>Status: {rental.status}</p>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MyRentals;
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
.the__subtitle{
|
|
||||||
position: absolute;
|
|
||||||
width: 1180px;
|
|
||||||
height: 20px;
|
|
||||||
left: 341px;
|
|
||||||
top: 1600px;
|
|
||||||
font-family: 'Nunito';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 16px;
|
|
||||||
line-height: 120%;
|
|
||||||
text-align: center;
|
|
||||||
color: #B8B7B9;
|
|
||||||
}
|
|
||||||
.Attractions__header{
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.Attractions{
|
|
||||||
width: 1180px;
|
|
||||||
height: 56px;
|
|
||||||
left: 347px;
|
|
||||||
top: 1645px;
|
|
||||||
color: #292729;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
.Attractions1{
|
|
||||||
padding-top: 10px;
|
|
||||||
width: 711px;
|
|
||||||
height: 81px;
|
|
||||||
left: calc(50% - 760px/2 + 0.5px);
|
|
||||||
top: 1700px;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { Link, useNavigate } from 'react-router-dom';
|
|
||||||
import './NearbyAttractions.css';
|
|
||||||
|
|
||||||
function NearbyAttractions(){
|
|
||||||
return(
|
|
||||||
<header className='apartment'>
|
|
||||||
<div className='Attractions__header'>
|
|
||||||
<div className='Attractions__content'>
|
|
||||||
<p className='the__subtitle'>Nearby Attractions</p>
|
|
||||||
<p className='heading__Amenities Attractions'>Explore the City</p>
|
|
||||||
<p className='info__Amenities Attractions1'>Discover the best of urban living with our centrally located apartments, offering easy access to top restaurants, entertainment, and cultural destinations</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default NearbyAttractions;
|
|
||||||
24
keynest/src/components/RentalContext.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
// RentalContext.js
|
||||||
|
import React, { createContext, useState, useContext } from 'react';
|
||||||
|
|
||||||
|
const RentalContext = createContext();
|
||||||
|
|
||||||
|
export const useRentalContext = () => useContext(RentalContext);
|
||||||
|
|
||||||
|
export const RentalProvider = ({ children }) => {
|
||||||
|
const [rentals, setRentals] = useState([]);
|
||||||
|
|
||||||
|
const addRental = (newRental) => {
|
||||||
|
setRentals([...rentals, newRental]);
|
||||||
|
};
|
||||||
|
|
||||||
|
const clearRentals = () => {
|
||||||
|
setRentals([]);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<RentalContext.Provider value={{ rentals, addRental, clearRentals }}>
|
||||||
|
{children}
|
||||||
|
</RentalContext.Provider>
|
||||||
|
);
|
||||||
|
};
|
||||||
44
keynest/src/storage/apartments.json
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"name": "Cozy Studio Apartment",
|
||||||
|
"description": "A perfect studio for solo travelers or couples.",
|
||||||
|
"imageUrl": "/images/apartment1.jpg",
|
||||||
|
"price": "$80/night"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"name": "Spacious Family Apartment",
|
||||||
|
"description": "Ideal for families with kids, featuring multiple bedrooms.",
|
||||||
|
"imageUrl": "/images/apartment2.jpg",
|
||||||
|
"price": "$150/night"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"name": "Luxury Penthouse",
|
||||||
|
"description": "Experience the ultimate in luxury living with stunning city views.",
|
||||||
|
"imageUrl": "/images/apartment3.jpg",
|
||||||
|
"price": "$300/night"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"name": "Modern Loft Apartment",
|
||||||
|
"description": "Stylish loft apartment in the heart of the city.",
|
||||||
|
"imageUrl": "/images/apartment4.jpg",
|
||||||
|
"price": "$120/night"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"name": "Beachfront Villa",
|
||||||
|
"description": "Enjoy breathtaking ocean views from this stunning beachfront villa.",
|
||||||
|
"imageUrl": "/images/apartment5.jpg",
|
||||||
|
"price": "$500/night"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 6,
|
||||||
|
"name": "Mountain Retreat Cabin",
|
||||||
|
"description": "Escape to the mountains in this cozy and secluded cabin.",
|
||||||
|
"imageUrl": "/images/apartment6.jpg",
|
||||||
|
"price": "$180/night"
|
||||||
|
}
|
||||||
|
]
|
||||||
30
keynest/src/storage/rentals.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"rentals_id": "1",
|
||||||
|
"userId": "2",
|
||||||
|
"title": "Cozy Apartment in Downtown",
|
||||||
|
"location": "123 Main St, Cityville",
|
||||||
|
"checkin": "2024-05-01",
|
||||||
|
"checkout": "2024-05-07",
|
||||||
|
"status": "Confirmed"
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rentals_id": "2",
|
||||||
|
"userId": "2",
|
||||||
|
"title": "Luxury Condo with Ocean View",
|
||||||
|
"location": "456 Ocean Ave, Beach City",
|
||||||
|
"checkin": "2024-06-10",
|
||||||
|
"checkout": "2024-06-17",
|
||||||
|
"status": "Pending"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rentals_id": "3",
|
||||||
|
"userId": "3",
|
||||||
|
"title": "Modern Loft in Arts District",
|
||||||
|
"location": "789 Art Lane, Culturetown",
|
||||||
|
"checkin": "2024-07-01",
|
||||||
|
"checkout": "2024-07-08",
|
||||||
|
"status": "Completed"
|
||||||
|
}
|
||||||
|
]
|
||||||
15
keynest/src/storage/users.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
[{
|
||||||
|
"user_id": "1",
|
||||||
|
"password":"pass",
|
||||||
|
"username": "login"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"user_id": "2",
|
||||||
|
"password":"123",
|
||||||
|
"username": "123"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"user_id": "3",
|
||||||
|
"password":"321",
|
||||||
|
"username": "321"
|
||||||
|
}]
|
||||||