diff --git a/client/src/components/Navbar.jsx b/client/src/components/Navbar.jsx index 97cf8ab..945df38 100644 --- a/client/src/components/Navbar.jsx +++ b/client/src/components/Navbar.jsx @@ -1,125 +1,264 @@ -import React, { useState } from 'react'; -import { Link } from 'react-router-dom'; -import { Avatar } from '@mantine/core'; -import { FaBars } from 'react-icons/fa'; -import { RxCross1 } from 'react-icons/rx'; -import { MdOutlineBusinessCenter, MdOutlineDashboard } from 'react-icons/md'; -import { Menu } from '@mantine/core'; -import { FaUserCircle, FaSave } from 'react-icons/fa'; -import { MdDoneAll } from 'react-icons/md'; -import { RiLogoutBoxFill } from 'react-icons/ri'; -import { toast } from 'react-toastify'; -import { useSelector, useDispatch } from 'react-redux'; -import { logOrNot } from '../actions/UserActions'; -import { useNavigate } from 'react-router-dom'; -import { logoutClearState } from '../slices/UserSlice'; -import { motion } from "framer-motion"; -import useIsMobile from '../hooks/useIsMobile'; +import { useState } from "react"; +import { Link, useLocation } from "react-router-dom"; +import { Avatar } from "@mantine/core"; +import { FaBars } from "react-icons/fa"; +import { RxCross1 } from "react-icons/rx"; +import { MdOutlineBusinessCenter, MdOutlineDashboard } from "react-icons/md"; +import { Menu } from "@mantine/core"; +import { FaUserCircle, FaSave } from "react-icons/fa"; +import { MdDoneAll } from "react-icons/md"; +import { RiLogoutBoxFill } from "react-icons/ri"; +import { toast } from "react-toastify"; +import { useSelector, useDispatch } from "react-redux"; +import { logOrNot } from "../actions/UserActions"; +import { useNavigate } from "react-router-dom"; +import { logoutClearState } from "../slices/UserSlice"; +import useIsMobile from "../hooks/useIsMobile"; export const Navbar = () => { - const { isLogin, me } = useSelector(state => state.user); - const [toggle, setToggle] = useState(false); - const dispatch = useDispatch(); - const navigate = useNavigate(); + const { isLogin, me } = useSelector((state) => state.user); + const [toggle, setToggle] = useState(false); + const dispatch = useDispatch(); + const navigate = useNavigate(); + const location = useLocation(); - - const isMobile = useIsMobile() - - const LogOut = () => { - localStorage.removeItem('userToken'); - localStorage.removeItem('role'); - dispatch(logOrNot()); - navigate('/'); - toast.success("Logout Successful !"); - dispatch(logoutClearState()); + const goHomeTop = () => { + if (location.pathname === "/") { + window.scrollTo({ top: 0, behavior: "smooth" }); + } else { + navigate("/"); } + }; - return ( - <> -
Contact Information
+Contact Information
Social Media:
-Social Media:
+
diff --git a/client/src/pages/Home.jsx b/client/src/pages/Home.jsx
index 4e524fc..569d117 100644
--- a/client/src/pages/Home.jsx
+++ b/client/src/pages/Home.jsx
@@ -1,250 +1,258 @@
-import React, { useEffect, useState } from 'react'
-import { Link } from 'react-router-dom'
-import { MetaData } from '../components/MetaData'
-import { useSelector, useDispatch } from 'react-redux';
-import { JobCard } from '../components/JobCard';
-import { getAllJobs } from '../actions/JobActions';
-import Testimonials from '../components/Testimonials/Testimonials.jsx';
-
+import { useEffect } from "react";
+import { Link } from "react-router-dom";
+import { MetaData } from "../components/MetaData";
+import { useSelector, useDispatch } from "react-redux";
+import { getAllJobs } from "../actions/JobActions";
+import Testimonials from "../components/Testimonials/Testimonials.jsx";
export const Home = () => {
-
- const [num, setNum] = useState(2);
- const dispatch = useDispatch()
- const { loading, allJobs } = useSelector(state => state.job)
- const [jobs, setJobs] = useState([])
-
-
- const data = [
- {
- link: "/images/JobData/1.jpg"
- },
- {
- link: "/images/JobData/2.jpg"
- },
- {
- link: "/images/JobData/3.jpg"
- },
- {
- link: "/images/JobData/4.jpg"
- },
- {
- link: "/images/JobData/5.jpg"
- },
- {
- link: "/images/JobData/6.jpg"
- },
- {
- link: "/images/JobData/7.jpg"
- },
- {
- link: "/images/JobData/8.jpg"
- },
- {
- link: "/images/JobData/9.jpg"
- },
- {
- link: "/images/JobData/10.jpg"
- },
- {
- link: "/images/JobData/11.jpg"
- },
- {
- link: "/images/JobData/12.jpg"
- },
- {
- link: "/images/JobData/13.jpg"
- },
- {
- link: "/images/JobData/14.jpg"
- },
- {
- link: "/images/JobData/15.jpg"
- },
- {
- link: "/images/JobData/16.jpg"
- },
- {
- link: "/images/JobData/17.jpg"
- },
- {
- link: "/images/JobData/18.jpg"
- },
- {
- link: "/images/JobData/19.jpg"
- },
- {
- link: "/images/JobData/20.jpg"
- }
- ]
-
-
- useEffect(() => {
- dispatch(getAllJobs())
-
- }, [])
-
-
-
- const convertDateFormat = (inputDate) => {
- const parts = inputDate.split('-');
- if (parts.length !== 3) {
- return "Invalid date format";
- }
-
- const day = parts[2];
- const month = parts[1];
- const year = parts[0];
-
- return `${day}-${month}-${year}`;
+ const dispatch = useDispatch();
+ const { loading, allJobs } = useSelector((state) => state.job);
+
+ const data = [
+ {
+ link: "/images/JobData/1.jpg",
+ },
+ {
+ link: "/images/JobData/2.jpg",
+ },
+ {
+ link: "/images/JobData/3.jpg",
+ },
+ {
+ link: "/images/JobData/4.jpg",
+ },
+ {
+ link: "/images/JobData/5.jpg",
+ },
+ {
+ link: "/images/JobData/6.jpg",
+ },
+ {
+ link: "/images/JobData/7.jpg",
+ },
+ {
+ link: "/images/JobData/8.jpg",
+ },
+ {
+ link: "/images/JobData/9.jpg",
+ },
+ {
+ link: "/images/JobData/10.jpg",
+ },
+ {
+ link: "/images/JobData/11.jpg",
+ },
+ {
+ link: "/images/JobData/12.jpg",
+ },
+ {
+ link: "/images/JobData/13.jpg",
+ },
+ {
+ link: "/images/JobData/14.jpg",
+ },
+ {
+ link: "/images/JobData/15.jpg",
+ },
+ {
+ link: "/images/JobData/16.jpg",
+ },
+ {
+ link: "/images/JobData/17.jpg",
+ },
+ {
+ link: "/images/JobData/18.jpg",
+ },
+ {
+ link: "/images/JobData/19.jpg",
+ },
+ {
+ link: "/images/JobData/20.jpg",
+ },
+ ];
+
+ useEffect(() => {
+ dispatch(getAllJobs());
+ });
+
+ const convertDateFormat = (inputDate) => {
+ const parts = inputDate.split("-");
+ if (parts.length !== 3) {
+ return "Invalid date format";
}
- return (
-
-
- <>
-
Your gateway to job opportunities.
- -Featured Jobs
-{allJobs[3].title}
-{allJobs[3].companyName}
-{allJobs[3].description.slice(0, 30) + "..."}
-{allJobs[5].title}
-{allJobs[5].companyName}
-{allJobs[5].description.slice(0, 30) + "..."}
-{allJobs[2].title}
-{allJobs[2].companyName}
-{allJobs[2].description.slice(0, 30) + "..."}
-Discover the Power of Possibility with JobLane: Where Your Professional Journey Takes Flight, Guided by a Network of Diverse Opportunities!
-+ Your gateway to job + opportunities. +
+Featured Jobs
+{allJobs[3].title}
++ {allJobs[3].companyName} +
++ {allJobs[3].description.slice(0, 30) + "..."} +
+{allJobs[5].title}
++ {allJobs[5].companyName} +
++ {allJobs[5].description.slice(0, 30) + "..."} +
+{allJobs[2].title}
++ {allJobs[2].companyName} +
++ {allJobs[2].description.slice(0, 30) + "..."} +
++ Discover the Power of Possibility with JobLane: Where Your + Professional Journey Takes Flight, Guided by a Network of Diverse + Opportunities! +
+