done
This commit is contained in:
parent
ad712108c0
commit
17fc533c25
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -27,7 +27,7 @@
|
|||
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css">
|
||||
<!-- fonts -->
|
||||
<link href="https://fonts.googleapis.com/css2?family=Raleway:wght@400;500;600;800&family=Sen:wght@400;700;800&display=swap" rel="stylesheet">
|
||||
<script type="module" crossorigin src="/assets/index-S1fS9cGv.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-DW_yaEwf.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-CyAHZLBw.css">
|
||||
</head>
|
||||
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
import { useEffect } from "react";
|
||||
import Footer from "./Footer";
|
||||
import Navbar from "./Navbar";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { showUser } from "../redux/features/userSlice";
|
||||
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
|
||||
const Dashboard = () => {
|
||||
|
||||
const { user } = useSelector((state) => ({ ...state.auth }));
|
||||
const dispatch = useDispatch();
|
||||
const userId = user?.result?._id;
|
||||
|
||||
useEffect(() => {
|
||||
if (userId) {
|
||||
dispatch(showUser(userId));
|
||||
}
|
||||
}, [userId, dispatch]);
|
||||
|
||||
return (
|
||||
|
||||
|
@ -25,14 +15,14 @@ const Dashboard = () => {
|
|||
<Navbar />
|
||||
<br /> <br /> <br /> <br />
|
||||
|
||||
|
||||
<main style={{ flex: 1 }}>
|
||||
|
||||
<section
|
||||
className="py-19 py-md-5 py-xl-8"
|
||||
style={{ backgroundColor: "#FFFFFF" }}
|
||||
>
|
||||
|
||||
|
||||
|
||||
<div className="container-fluid px-0">
|
||||
|
||||
<div className="row gy-4 align-items-center justify-content-center ">
|
||||
|
@ -47,6 +37,9 @@ const Dashboard = () => {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div className="col-12 col-md-6 col-xl-5">
|
||||
<div
|
||||
className="card border-0 rounded-4 shadow-lg"
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
|
||||
import { NavLink } from "react-router-dom";
|
||||
|
||||
const Header = () => {
|
||||
return (
|
||||
<>
|
||||
|
||||
<div className="container-fluid p-0 m-0">
|
||||
<nav
|
||||
className="navbar navbar-expand-lg w-100"
|
||||
style={{
|
||||
backgroundColor: "#000000",
|
||||
position: "fixed", // Make the navbar fixed at the top
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
zIndex: 1000, // Ensure the navbar is above other elements
|
||||
}}
|
||||
>
|
||||
<div className="container-fluid d-flex align-items-center justify-content-between">
|
||||
|
||||
|
||||
<div className="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
|
||||
<form className="form-inline my-2 my-lg-0">
|
||||
<div className="login_text">
|
||||
<ul>
|
||||
<li>
|
||||
<NavLink to="/login" className="nav-link">
|
||||
Login
|
||||
</NavLink>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<i className="fa fa-user" aria-hidden="true" />
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div className="quote_btn">
|
||||
<NavLink to="/register" className="nav-link">
|
||||
Register
|
||||
</NavLink>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default Header
|
|
@ -1,13 +1,23 @@
|
|||
import { NavLink } from "react-router-dom";
|
||||
import logo from "../logo.png";
|
||||
|
||||
const Navbar = () => {
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import { NavLink } from "react-router-dom";
|
||||
import { setLogout } from "../redux/features/authSlice";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
const Navbar = () => {
|
||||
const { user } = useSelector((state) => ({ ...state.auth }));
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const handleLogout = () => {
|
||||
dispatch(setLogout());
|
||||
navigate("/");
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="container-fluid p-0 m-0">
|
||||
<nav
|
||||
<div
|
||||
className="navbar navbar-expand-lg w-100"
|
||||
style={{
|
||||
backgroundColor: "#000000",
|
||||
|
@ -63,38 +73,34 @@ const Navbar = () => {
|
|||
</NavLink>
|
||||
</li>
|
||||
|
||||
|
||||
<li className="nav-item">
|
||||
<NavLink to="/contact" className="nav-link">
|
||||
Contact Us
|
||||
</NavLink>
|
||||
</li>
|
||||
</ul>
|
||||
<form className="form-inline my-2 my-lg-0">
|
||||
<div className="login_text">
|
||||
<ul>
|
||||
<li>
|
||||
<NavLink to="/login" className="nav-link">
|
||||
Login
|
||||
</NavLink>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<i className="fa fa-user" aria-hidden="true" />
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div className="quote_btn">
|
||||
|
||||
{user?.result?._id ? (
|
||||
<NavLink to="/dashboard">Dashboard</NavLink>
|
||||
) : (
|
||||
<NavLink to="/register" className="nav-link">
|
||||
Register
|
||||
</NavLink>
|
||||
)}
|
||||
|
||||
</div>
|
||||
</form>
|
||||
{user?.result?._id ? (
|
||||
<NavLink to="/login">
|
||||
<p className="header-text" onClick={handleLogout}>
|
||||
Logout
|
||||
</p>
|
||||
</NavLink>
|
||||
) : (
|
||||
<NavLink to="/login" className="nav-link">
|
||||
Login
|
||||
</NavLink>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue