Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My branch #23

Merged
merged 24 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,763 changes: 1,478 additions & 4,285 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@
"preview": "vite preview"
},
"dependencies": {
"@auth0/auth0-react": "^2.2.4",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted

"@radix-ui/react-checkbox": "1.1.1",
"@radix-ui/react-slot": "1.1.0",
"@reduxjs/toolkit": "2.2.6",
"class-variance-authority": "0.7.0",
"clsx": "2.1.1",
"jwt-decode": "4.0.0",
"lucide-react": "0.399.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-icons": "^5.2.1",
"react-redux": "9.1.2",
"react-router-dom": "6.24.0",
"tailwind-merge": "2.3.0",
Expand All @@ -34,8 +38,10 @@
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"postcss": "^8.4.38",
"react-router-dom": "6.24.0",
"tailwindcss": "^3.4.4",
"typescript": "^5.2.2",
"vite": "^5.3.1"
"vite": "^5.3.1",
"webpack-cli": "^5.1.4"
}
}
Empty file added src/App.css
Empty file.
42 changes: 22 additions & 20 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
import { BrowserRouter, Route, Routes } from "react-router-dom";
import LandingPage from "./Pages/LandingPage";
import NotFound from "./NotFound";

import './App.css'
import LoginForm from './Pages/LoginForm/LoginForm';
import Register from './components/reg/Register';
import LandingPage from './Pages/LandingPage'
import { BrowserRouter, Routes, Route } from 'react-router-dom';
import Librarylist from './Pages/Librarylist';
import Users from './Pages/Users';

function App() {
return (
<>
<BrowserRouter>
<Routes>
<Route path="*" element={<NotFound />} />
<Route path="LibraryManagement" element={<LandingPage />} />
<Route
path="LibraryManagement/management/login"
element={<LandingPage />}
/>
<Route
path="LibraryManagement/user/login"
element={<LandingPage />}
/>
</Routes>
</BrowserRouter>
</>
);
<BrowserRouter basename="/LibraryManagement">
<Routes>
<Route path="/" element={<LandingPage />} />
<Route path="/library/login" element={<LoginForm up='library'/>} />
<Route path="/user/login" element={<LoginForm up='user'/>} />
<Route path='/register' element={<Register/>}/>
<Route path='/librarylist' element={<Librarylist/>}/>
<Route path='/users' element={<Users/>}/>



</Routes>
</BrowserRouter>
)
}

export default App;
24 changes: 18 additions & 6 deletions src/Pages/LandingPage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
import { Button } from "@/components/ui/button";
import { useNavigate } from "react-router-dom";
import { Link } from "react-router-dom";

Check failure on line 3 in src/Pages/LandingPage.tsx

View workflow job for this annotation

GitHub Actions / build

'Link' is declared but its value is never read.
import { increment, decrement } from "../store/features/counter/counterSlice";
import { useDispatch, useSelector } from "react-redux";
import { RootState } from "../store/store";


const LandingPage = () => {
const navigate = useNavigate();

const handleCreateLibrary = () => {
navigate("library/login");
};

const handleJoinLibrary = () => {
navigate("user/login");
};



const count = useSelector((state: RootState) => state.counter.count);
const dispatch = useDispatch();

Expand Down Expand Up @@ -37,12 +51,10 @@


<div className="flex gap-[20px] mt-[50px]">
<Link to={"management/login"}>
<Button variant="outline">Create A Library</Button>
</Link>
<Link to={"management/login"}>
<Button>Join A Library</Button>
</Link>
<Button variant="outline" onClick={handleCreateLibrary}>
Create A Library
</Button>
<Button onClick={handleJoinLibrary}>Join A Library</Button>
</div>
</div>
);
Expand Down
166 changes: 166 additions & 0 deletions src/Pages/Librarylist.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
import { useState } from "react";
import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button";
import Nav from "@/mycomponents/Nav";

function Librarylist() {
const [isModalOpen, setIsModalOpen] = useState(false);
const [isSecondModalOpen, setIsSecondModalOpen] = useState(false);

const [selectLibrary, setSelectLibrary] = useState<Library | null>(null);

interface Library {
id: number;
name: string;
description: string;
image: string;
}

const libraries: Library[] = [
{
id: 1,
name: "library 1",
description: "hbn",
image: "./images/Google.jpg",
},
{
id: 2,
name: "library 2",
description: "good library",
image: "./images/Google.jpg",
},
{
id: 3,
name: "library 3",
description: "wifi available",
image: "./images/Google.jpg",
},
];

const openModal = (library: Library) => {
setSelectLibrary(library);
setIsModalOpen(true);
};

const openSecondModal = () => {
setIsModalOpen(false);
setIsSecondModalOpen(true);
};
const closeSecondModal = () => {
setIsSecondModalOpen(false);
};

return (
<div>
<Nav/>
<h1 className="text-[28px] ml-5 mt-3 font-bold">List of Libraries</h1>
<p className="text-gray-400 ml-5">Search for your suitable library</p>
<div className="flex items-center justify-center h-full ">
<div className="flex flex-col w-11/12 gap-10">
<Input className="mt-2" placeholder="Search Library"></Input>
{/* library lists */}
{libraries.map((library) => (
<div
key={library.id}
className="flex flex-row h-36 w-full border border-b-neutral-500"
>
<div className="h-28 w-28 mx-4 my-4 ">
<img src={library.image} alt="" />
</div>
<div className="space-y-2">
<h1 className="text-[28px] font-bold space-x-3">
{library.name}
</h1>
<p id="description" className="text-gray-400 ">
library having Ac, Wifi etc.
</p>
<Button onClick={() => openModal(library)}>Book Now</Button>
</div>
</div>
))}
</div>
</div>
{isModalOpen && selectLibrary && (
<div className="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50">
<div className="bg-white p-6 rounded shadow-lg w-2/5 flex flex-col items-center space-y-5">
<h2 className="text-2xl mb-4">{selectLibrary.name}</h2>
{/* Add your form elements here */}
<div className="font-medium w-full">
<p className="text-[25px]">Mobile number</p>
<div className=' h-9 border border-b-neutral-700 " '>
9783298810
</div>
</div>
<div className="font-medium w-full">
<p className="text-[25px]">Email</p>
<div className=' h-9 border border-b-neutral-700 " '>
[email protected]
</div>
</div>
<div className="font-medium w-full">
<p className="text-[25px]">Fees</p>
<div className=' h-9 border border-b-neutral-700 " '>
{"1000" + "₹"}
</div>
</div>
<div className="font-medium w-full">
<p className="text-[25px]">Adress</p>
<div className=' h-9 border border-b-neutral-700 " '>Jodhpur</div>
</div>
<Button className="mr-2 " onClick={openSecondModal}>
Proceed
</Button>
</div>
</div>
)}{" "}
{isSecondModalOpen && (
<div className="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50">
<div className="bg-white p-6 rounded shadow-lg w-2/5 flex flex-col items-center space-y-6">
<div className="w-full space-y-3 text-[18px] font-medium">
<div>
<p>Start Date</p>
</div>
<div>
<Input className="w-full" type="date" />
</div>
</div>
<div className="w-full space-y-3 text-[18px] font-medium">
<div>
<p>Months </p>
</div>
<div>
<Input className="w-full" type="number" />
</div>
</div>
<div className="w-full space-y-3">
<h1 className="text-[24px] font-medium">Pricing</h1>
<div className="flex w-full justify-between text-[18px] font-medium">
<div>
<p>price per month</p>
</div>
<div>1000</div>
</div>
<div className="flex w-full justify-between text-[18px] font-medium">
<div>
<p>Months</p>
</div>
<div>2</div>
</div>
<div className="flex w-full justify-between text-[24px] font-medium">
<div>
<p>Totel</p>
</div>
<div>2000</div>
</div>
<Button className="w-full" onClick={closeSecondModal}>
Book now
</Button>
</div>
</div>
</div>
)}
</div>
);
}

export default Librarylist;
111 changes: 111 additions & 0 deletions src/Pages/LoginForm/LoginForm.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import { FaUser, FaLock } from "react-icons/fa";
import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button";
import { Checkbox } from "@/components/ui/checkbox";
import { Link } from "react-router-dom";
import Quote from "@/mycomponents/Quote";
import { twMerge } from "tailwind-merge";
import { useNavigate } from "react-router-dom";
import libraryimage from "./images/library.jpg";
import googleimage from "./images/Google.jpg";
interface LoginFormProps {
up: string;
}

const LoginForm: React.FC<LoginFormProps> = (props) => {
const navigate = useNavigate();

const goList = () => {
if (props.up == "user") {
navigate("/librarylist");
} else {
navigate("/users");
}
};
return (
<div
className={twMerge("flex flex-col md:flex-row h-screen overflow-hidden")}
>
<div className={twMerge("md:w-1/2 relative")}>
<img
className={twMerge("h-full w-full object-cover")}
src={libraryimage}
alt=""
/>
<div className="absolute inset-0 bg-black bg-opacity-70 flex items-center justify-center text-white text-center">
<Quote />
</div>
</div>

<div className="md:w-1/2 flex items-center justify-center">
<form
onSubmit={goList}
className={twMerge(
"border border-gray-300 w-full md:w-3/5 h-7/10 p-6 rounded"
)}
>
<h1 className={twMerge("text-2xl text-center mb-6")}>Log In</h1>
<div className={twMerge("flex flex-col gap-6")}>
<div className={twMerge("relative")}>
<Input type="email" placeholder="Email" />
<FaUser
className={twMerge(
"absolute right-3 top-1/2 transform -translate-y-1/2"
)}
/>
</div>
<div className={twMerge("relative")}>
<Input type="password" placeholder="Password" />
<FaLock
className={twMerge(
"absolute right-3 top-1/2 transform -translate-y-1/2"
)}
/>
</div>
</div>
<div className={twMerge("flex items-center gap-14 mt-4")}>
<label>
<Checkbox className="ml-5" /> Remember me
</label>
<Link className={twMerge("text-blue-700")} to="/">
Forgot password?
</Link>
</div>
<Button type="submit" className={twMerge("w-full mt-6")}>
Login
</Button>
<p
className={twMerge(
'mt-6 text-center relative flex items-center my-4 before:content-[""] before:flex-1 before:border-b before:border-black before:mx-3 after:content-[""] after:flex-1 after:border-b after:border-black after:mx-3'
)}
>
Or Login with
</p>
<div className={twMerge("flex justify-center gap-4 mt-2")}>
<Button
variant="outline"
className={twMerge("flex items-center gap-1")}
>
<img
className={twMerge("h-3 w-3")}
src={googleimage}
alt="Google"
/>
Google
</Button>
</div>
<div className={twMerge("text-center mt-4")}>
<p>
Want to register?{" "}
<Link className={twMerge("text-blue-700")} to="/register">
Register
</Link>
</p>
</div>
</form>
</div>
</div>
);
};

export default LoginForm;
Binary file added src/Pages/LoginForm/images/Google.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Pages/LoginForm/images/library.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading