├── tripBook.com ├── public │ ├── ind.jpeg │ ├── applogo.png │ ├── favicon.ico │ └── vercel.svg ├── next.config.js ├── components │ ├── searchBox │ │ ├── searchBox.module.css │ │ └── searchBox.js │ ├── backgroundImg │ │ ├── bgComponent.module.css │ │ └── bgComponent.js │ ├── DatePicker.js │ ├── Filters.js │ ├── explore │ │ ├── slideShow.module.css │ │ ├── connectTravellers.js │ │ ├── slideShow.js │ │ └── nextTrip.js │ ├── pre_loader │ │ ├── loadingScreen.js │ │ └── loadingText.module.css │ ├── SearchForm.js │ ├── navbarSection │ │ ├── navbar.module.css │ │ ├── draverNav.js │ │ └── navbar.js │ ├── SearchCard.js │ └── Footer.jsx ├── db.connect.js ├── pages │ ├── api │ │ ├── user │ │ │ ├── index.js │ │ │ ├── signup │ │ │ │ ├── index.js │ │ │ │ └── dealer.js │ │ │ ├── refresh.js │ │ │ └── signin.js │ │ └── property │ │ │ ├── index.js │ │ │ └── [id].js │ ├── _app.js │ ├── flights.js │ ├── carrental.js │ ├── addproperty.js │ ├── listproperty.js │ ├── signin.js │ ├── signup.js │ ├── property │ │ ├── index.js │ │ └── [id] │ │ │ ├── index.js │ │ │ └── info.js │ └── index.js ├── models │ ├── user.model.js │ └── property.model.js ├── .gitignore ├── middlewares │ └── tokenVerify.js ├── context │ ├── AuthContextProvider.js │ └── GuestContext.js ├── package.json └── styles │ └── globals.css └── README.md /tripBook.com/public/ind.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adityabarshilia/TripBook/HEAD/tripBook.com/public/ind.jpeg -------------------------------------------------------------------------------- /tripBook.com/public/applogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adityabarshilia/TripBook/HEAD/tripBook.com/public/applogo.png -------------------------------------------------------------------------------- /tripBook.com/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adityabarshilia/TripBook/HEAD/tripBook.com/public/favicon.ico -------------------------------------------------------------------------------- /tripBook.com/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | reactStrictMode: false, 4 | } 5 | 6 | module.exports = nextConfig 7 | -------------------------------------------------------------------------------- /tripBook.com/components/searchBox/searchBox.module.css: -------------------------------------------------------------------------------- 1 | .searchformStyles{ 2 | display: flex; 3 | justify-content: space-between; 4 | gap: 20px; 5 | border:5px solid red 6 | } -------------------------------------------------------------------------------- /tripBook.com/db.connect.js: -------------------------------------------------------------------------------- 1 | import mongoose from "mongoose"; 2 | 3 | export const connect = async () => { 4 | if(mongoose.connection.readyState[0]) return; 5 | mongoose.connect(process.env.MONGODB_URI); 6 | }; -------------------------------------------------------------------------------- /tripBook.com/components/backgroundImg/bgComponent.module.css: -------------------------------------------------------------------------------- 1 | .bgImg { 2 | background-image: url("https://r-xx.bstatic.com/xdata/images/xphoto/2880x750/183939625.jpeg?k=f06b6ea8458f9377cc1293e39f6b3218d13c4a6576d61d51b989438e667d68fc&o="); 3 | /* width: 100%; 4 | height: 900px; */ 5 | background-size: 100% 100%; 6 | } 7 | 8 | .textOnImg { 9 | /* border: 2px solid greenyellow; */ 10 | margin-top: 5%; 11 | } 12 | -------------------------------------------------------------------------------- /tripBook.com/components/DatePicker.js: -------------------------------------------------------------------------------- 1 | import { useContext } from "react"; 2 | import { DateRangePicker } from "rsuite"; 3 | import "rsuite/dist/rsuite.css"; 4 | import { GuestContext } from "../context/GuestContext"; 5 | 6 | const Datepicker = () => { 7 | const { date, setDate } = useContext(GuestContext); 8 | console.log(date) 9 | return 10 | } 11 | 12 | export default Datepicker; -------------------------------------------------------------------------------- /tripBook.com/pages/api/user/index.js: -------------------------------------------------------------------------------- 1 | import { connect } from "../../../db.connect"; 2 | // import { UserModel } from "../../../models/user.model"; 3 | 4 | export default async function handler(req, res) { 5 | // const { method } = req; 6 | 7 | try { 8 | await connect(); 9 | } catch (e) { 10 | console.log(e); 11 | } 12 | 13 | try { 14 | // const products = await UserModel.find({}); 15 | res.status(200).send("awdawdawawd"); 16 | } catch (e) { 17 | res.status(400).send(e.message); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tripBook.com/models/user.model.js: -------------------------------------------------------------------------------- 1 | import { model, Schema, models } from "mongoose"; 2 | 3 | const UserSchema = new Schema({ 4 | name: { 5 | type: String, 6 | required: true, 7 | }, 8 | email: { 9 | type: String, 10 | required: true, 11 | unique: true, 12 | }, 13 | password: { 14 | type: String, 15 | required: true, 16 | }, 17 | role: { 18 | type: String, 19 | enum: ["user", "dealer"], 20 | }, 21 | }); 22 | 23 | const UserModel = models.user || model("user", UserSchema); 24 | export { UserModel }; -------------------------------------------------------------------------------- /tripBook.com/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | .pnpm-debug.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | -------------------------------------------------------------------------------- /tripBook.com/components/Filters.js: -------------------------------------------------------------------------------- 1 | import { Checkbox, Text } from "@chakra-ui/react"; 2 | 3 | const FilterBox = ({type, setFilter}) => { 4 | 5 | return ( 6 | setFilter(target.name)} m="5px"> 7 | 8 | { 9 | type === "Rating" ? ("> 9 Rating") 10 | : type === "Reviews" ? ("> 50 Reviews") 11 | : type === "Price" ? ("< 6000 Price") 12 | : null 13 | } 14 | 15 | 16 | ); 17 | }; 18 | 19 | export default FilterBox; 20 | -------------------------------------------------------------------------------- /tripBook.com/pages/api/property/index.js: -------------------------------------------------------------------------------- 1 | import { connect } from "../../../db.connect"; 2 | import { PropertyModel } from "../../../models/property.model"; 3 | 4 | export default async function handler(req, res) { 5 | const { method } = req; 6 | 7 | try { 8 | await connect(); 9 | } catch (e) { 10 | console.log(e); 11 | } 12 | 13 | if (method === "POST") { 14 | try { 15 | const properties = await PropertyModel.create(req.body); 16 | res 17 | .status(201) 18 | .send({ message: "property added successfully", properties }); 19 | } catch (e) { 20 | res.status(400).send(e.message); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tripBook.com/middlewares/tokenVerify.js: -------------------------------------------------------------------------------- 1 | import jwt from "jsonwebtoken"; 2 | 3 | const verify = (req,res,next) => { 4 | const { token } = req.headers; 5 | 6 | if (token) { 7 | jwt.verify(token, process.env.tsec, function(err, verified) { 8 | if (err) { 9 | return res.status(401).json({"error": true, "message": 'Unauthorized access. Login and try again' }); 10 | } 11 | req.verified = verified; 12 | next(); 13 | }); 14 | } else { 15 | return res.status(403).send({ 16 | "error": true, 17 | "message": 'Please login' 18 | }); 19 | } 20 | } 21 | 22 | export default verify; -------------------------------------------------------------------------------- /tripBook.com/context/AuthContextProvider.js: -------------------------------------------------------------------------------- 1 | import { useEffect } from "react"; 2 | import { createContext, useState } from "react"; 3 | 4 | export const AuthContext = createContext(); 5 | 6 | function getInitialState() { 7 | const initState = localStorage.getItem("authData") 8 | return initState ? JSON.parse(initState) : "" 9 | } 10 | 11 | const AuthContextProvider = ({ children }) => { 12 | const [auth, setAuth] = useState(""); 13 | 14 | useEffect(() => { 15 | setAuth(getInitialState); 16 | },[]); 17 | 18 | useEffect(() => { 19 | localStorage.setItem("authData", JSON.stringify(auth)); 20 | }, [auth]); 21 | return ( 22 | 23 | {children} 24 | 25 | ); 26 | }; 27 | 28 | export default AuthContextProvider; -------------------------------------------------------------------------------- /tripBook.com/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tripbook.com", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint" 10 | }, 11 | "dependencies": { 12 | "@chakra-ui/icons": "^2.0.13", 13 | "@chakra-ui/react": "^2.4.3", 14 | "@emotion/react": "^11.10.5", 15 | "@emotion/styled": "^11.10.5", 16 | "argon2": "^0.30.2", 17 | "axios": "^1.2.1", 18 | "framer-motion": "^7.7.2", 19 | "jsonwebtoken": "^8.5.1", 20 | "mongoose": "^6.8.0", 21 | "next": "13.0.6", 22 | "react": "18.2.0", 23 | "react-dom": "18.2.0", 24 | "react-icons": "^4.7.1", 25 | "react-simple-image-slider": "^2.4.1", 26 | "react-slideshow-image": "^4.1.1", 27 | "rsuite": "^5.23.2" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tripBook.com/components/explore/slideShow.module.css: -------------------------------------------------------------------------------- 1 | /* .mainBox{ 2 | border: 5px solid plum; 3 | } */ 4 | 5 | /* @media all and (min-width: 401px) and (max-width: 750px){ 6 | .Home_carousel_item_Third1{ 7 | display: grid; 8 | grid-template-columns: repeat(3,1fr); 9 | gap: 4%; 10 | } 11 | .Home_Featured_Brands_Item1 div:last-child{ 12 | position: relative; 13 | font-size: 80%; 14 | } 15 | 16 | .Home_carousel_item_Third1{ 17 | margin-bottom: 10%; 18 | } 19 | } 20 | 21 | 22 | @media all and (min-width: 280px) and (max-width: 400px){ 23 | .Home_carousel_item_Third1{ 24 | display: grid; 25 | grid-template-columns: repeat(2,1fr); 26 | gap: 4%; 27 | padding-bottom: 5%; 28 | margin-bottom: 8%; 29 | } 30 | .Home_Featured_Brands_Item1 div:last-child{ 31 | font-size: 50%; 32 | } 33 | } */ -------------------------------------------------------------------------------- /tripBook.com/models/property.model.js: -------------------------------------------------------------------------------- 1 | import { model, Schema, models } from "mongoose"; 2 | 3 | const PropertySchema = new Schema({ 4 | redirecturl: { 5 | type: String, 6 | }, 7 | imagescr: { 8 | type: String, 9 | required: true 10 | }, 11 | title: { 12 | type: String, 13 | required: true 14 | }, 15 | summary: { 16 | type: String, 17 | }, 18 | city: { 19 | type: String, 20 | required: true 21 | }, 22 | TravelText: { 23 | type: String, 24 | }, 25 | TravelText2: { 26 | type: String, 27 | }, 28 | rating: { 29 | type: Number, 30 | }, 31 | ratingStatus: { 32 | type: String, 33 | }, 34 | reviews: { 35 | type: Number, 36 | }, 37 | price: { 38 | type: Number, 39 | } 40 | }); 41 | 42 | const PropertyModel = models.property || model("property", PropertySchema); 43 | export { PropertyModel }; -------------------------------------------------------------------------------- /tripBook.com/pages/api/user/signup/index.js: -------------------------------------------------------------------------------- 1 | import { connect } from "../../../../db.connect"; 2 | import { UserModel } from "../../../../models/user.model"; 3 | import argon2id from "argon2"; 4 | 5 | export default async function handler(req, res) { 6 | const { method } = req; 7 | const { name, email, password } = req.body; 8 | try { 9 | await connect(); 10 | } catch (e) { 11 | console.log(e); 12 | } 13 | 14 | if (method === "POST") { 15 | try { 16 | const check = await UserModel.findOne({ email }); 17 | if (check) 18 | return res 19 | .status(400) 20 | .send({ message: "User with provided email already exists" }); 21 | 22 | const hash = await argon2id.hash(password); 23 | const user = await UserModel.create({ name, email, password: hash, role: "user" }); 24 | res.status(201).send({ message: "User Created", user }); 25 | } catch (e) { 26 | res.status(400).send(e.message); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tripBook.com/pages/api/user/signup/dealer.js: -------------------------------------------------------------------------------- 1 | import { connect } from "../../../../db.connect"; 2 | import { UserModel } from "../../../../models/user.model"; 3 | import argon2id from "argon2"; 4 | 5 | export default async function handler(req, res) { 6 | const { method } = req; 7 | const { name, email, password } = req.body; 8 | try { 9 | await connect(); 10 | } catch (e) { 11 | console.log(e); 12 | } 13 | 14 | if (method === "POST") { 15 | try { 16 | const check = await UserModel.findOne({ email }); 17 | if (check) 18 | return res 19 | .status(400) 20 | .send({ message: "User with provided email already exists" }); 21 | 22 | const hash = await argon2id.hash(password); 23 | const user = await UserModel.create({ name, email, password: hash, role: "dealer" }); 24 | res.status(201).send({ message: "Dealer Created", user }); 25 | } catch (e) { 26 | res.status(400).send(e.message); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tripBook.com/public/vercel.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /tripBook.com/components/pre_loader/loadingScreen.js: -------------------------------------------------------------------------------- 1 | import { Center } from "@chakra-ui/react"; 2 | import React from "react" 3 | import styles from "./loadingText.module.css" 4 | 5 | 6 | const LoadingScreen = () => { 7 | return ( 8 |
9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |
25 |
26 | ); 27 | }; 28 | 29 | export default LoadingScreen; -------------------------------------------------------------------------------- /tripBook.com/pages/api/user/refresh.js: -------------------------------------------------------------------------------- 1 | import { connect } from "../../../db.connect"; 2 | import { UserModel } from "../../../models/user.model"; 3 | import jwt from "jsonwebtoken"; 4 | 5 | export default async function handler(req, res) { 6 | const { method } = req; 7 | try { 8 | await connect(); 9 | } catch (e) { 10 | console.log(e); 11 | } 12 | 13 | if (method === "POST") { 14 | let verifiedUser; 15 | const { refreshToken } = req.body; 16 | if (!refreshToken) return res.status(401).send("Unauthorized access"); 17 | 18 | try { 19 | jwt.verify(refreshToken, process.env.rtsec, function (err, verified) { 20 | if (err) { 21 | return res 22 | .status(401) 23 | .json({ error: true, message: "Please relogin" }); 24 | } 25 | 26 | verifiedUser = verified; 27 | console.log(verifiedUser); 28 | }); 29 | const user = await UserModel.findOne({ _id: verifiedUser.id }); 30 | 31 | const token = jwt.sign( 32 | { id: user._id, name: user.name, role: user.role }, 33 | process.env.tsec, 34 | { 35 | expiresIn: process.env.tl, 36 | } 37 | ); 38 | 39 | return res.status(200).send({ token: token }); 40 | } catch (e) { 41 | res.status(404).send(e.message); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tripBook.com/components/backgroundImg/bgComponent.js: -------------------------------------------------------------------------------- 1 | import { Box, Container, Heading, Text } from "@chakra-ui/react"; 2 | import styles from "../backgroundImg/bgComponent.module.css"; 3 | function BgComponent({ heading, subHeading }) { 4 | return ( 5 | <> 6 | 12 | 13 | 19 | 20 | 25 | {heading} 26 | 27 |
28 | 29 | 33 | {subHeading} 34 | 35 |
36 |
37 |
38 |
39 | 40 | ); 41 | } 42 | 43 | export default BgComponent; 44 | -------------------------------------------------------------------------------- /tripBook.com/pages/api/property/[id].js: -------------------------------------------------------------------------------- 1 | import { connect } from "../../../db.connect"; 2 | import { PropertyModel } from "../../../models/property.model"; 3 | 4 | export default async function handler(req, res) { 5 | const { method } = req; 6 | const { id } = req.query; 7 | 8 | try { 9 | await connect(); 10 | } catch (e) { 11 | console.log(e); 12 | } 13 | 14 | if (method === "DELETE") { 15 | try { 16 | const property = await PropertyModel.findOneAndDelete({ _id: id }); 17 | res.status(200).send({ message: "Deleted", property }); 18 | } catch (e) { 19 | res.status(400).send(e.message); 20 | } 21 | } 22 | 23 | if (method === "PUT") { 24 | try { 25 | const property = await PropertyModel.findOneAndReplace( 26 | { _id: id }, 27 | req.body, 28 | { new: true } 29 | ); 30 | res.status(200).send({ message: "Replaced", property }); 31 | } catch (e) { 32 | res.status(400).send(e.message); 33 | } 34 | } 35 | 36 | if (method === "PATCH") { 37 | try { 38 | const property = await PropertyModel.findOneAndUpdate( 39 | { _id: id }, 40 | req.body, 41 | { new: true } 42 | ); 43 | res.status(200).send({ message: "Updated", property }); 44 | } catch (e) { 45 | res.status(400).send(e.message); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tripBook.com/pages/_app.js: -------------------------------------------------------------------------------- 1 | import '../styles/globals.css' 2 | import { ChakraProvider } from '@chakra-ui/react'; 3 | import AuthContextProvider from '../context/AuthContextProvider'; 4 | import Footer from '../components/Footer'; 5 | import React ,{ useState , useEffect } from "react" 6 | import LoadingScreen from '../components/pre_loader/loadingScreen'; 7 | // import {ToastContainer} from 'react-nextjs-toast'; 8 | import GuestContextProvider from "../context/GuestContext"; 9 | 10 | 11 | function MyApp({ Component, pageProps }) { 12 | 13 | // *********************************pre loader start************************************ 14 | 15 | const [loading, setLoading] = useState(false); 16 | 17 | useEffect(() => { 18 | setTimeout(() => { 19 | setLoading(true); 20 | },2000); 21 | }, []); 22 | // *********************************pre loader end************************************ 23 | 24 | 25 | return ( 26 | <> 27 | {loading? 28 | ( 29 | 30 | 31 | 32 | {/* */} 33 |