|
|
|
@ -1,17 +1,22 @@ |
|
|
|
|
import logo from './logo.svg'; |
|
|
|
|
import './App.css'; |
|
|
|
|
import { BrowserRouter as Router, Routes, Route, useNavigate } from "react-router-dom"; |
|
|
|
|
import Dashboard2 from './view/dashboard2/Dashboard2'; |
|
|
|
|
import Header from './components/header/Header'; |
|
|
|
|
import Nav from './components/nav/Nav'; |
|
|
|
|
import Dashboard from './view/dashboard/Dashboard'; |
|
|
|
|
import Accounting from './view/accounting/Accounting'; |
|
|
|
|
import Messages from './view/messages/Messages'; |
|
|
|
|
import logo from "./logo.svg"; |
|
|
|
|
import "./App.css"; |
|
|
|
|
import { |
|
|
|
|
BrowserRouter as Router, |
|
|
|
|
Routes, |
|
|
|
|
Route, |
|
|
|
|
useNavigate, |
|
|
|
|
} from "react-router-dom"; |
|
|
|
|
import Dashboard2 from "./view/dashboard2/Dashboard2"; |
|
|
|
|
import Header from "./components/header/Header"; |
|
|
|
|
import Nav from "./components/nav/Nav"; |
|
|
|
|
import Dashboard from "./view/dashboard/Dashboard"; |
|
|
|
|
import Accounting from "./view/accounting/Accounting"; |
|
|
|
|
import Messages from "./view/messages/Messages"; |
|
|
|
|
import { ToastContainer } from "react-toastify"; |
|
|
|
|
import "react-toastify/dist/ReactToastify.css"; |
|
|
|
|
// import "react-modern-drawer/dist/index.css";
|
|
|
|
|
import Login from './view/login/Login'; |
|
|
|
|
import { useEffect, useState } from 'react'; |
|
|
|
|
import Login from "./view/login/Login"; |
|
|
|
|
import { useEffect, useState } from "react"; |
|
|
|
|
// import {useParams} from 'react-router-dom';
|
|
|
|
|
|
|
|
|
|
import avatar1 from "./assets/img/avatar/080cd026ce8cd30f68acfa086ebde7fb.jpg"; |
|
|
|
@ -21,21 +26,22 @@ import avatar4 from "./assets/img/avatar/alexander-hipp-iEEBWgY_6lA-unsplash.jpg |
|
|
|
|
import avatar5 from "./assets/img/avatar/julian-wan-WNoLnJo7tS8-unsplash.jpg"; |
|
|
|
|
import avatar6 from "./assets/img/avatar/nicolas-horn-MTZTGvDsHFY-unsplash.jpg"; |
|
|
|
|
import avatar7 from "./assets/img/avatar/pexels-yuri-manei-2690323.jpg"; |
|
|
|
|
import LoginSignUp from './view/LoginSignUp'; |
|
|
|
|
import Register from './view/register' |
|
|
|
|
import Services from './view/services'; |
|
|
|
|
import LoginSignUp from "./view/LoginSignUp"; |
|
|
|
|
import Register from "./view/register"; |
|
|
|
|
import Services from "./view/services"; |
|
|
|
|
|
|
|
|
|
import {Provider, provider} from 'react-redux'; |
|
|
|
|
import store from './redux/store'; |
|
|
|
|
import ContactUs from './view/contact'; |
|
|
|
|
import ENTER_EXAM from './view/Exam/EnterExam/index' |
|
|
|
|
import EXAM from './view/Exam' |
|
|
|
|
import CallBack from './view/CallBack'; |
|
|
|
|
import AdminPanel from './view/admin'; |
|
|
|
|
import AddProduct from './view/addProduct'; |
|
|
|
|
import AddExam from './view/addExam'; |
|
|
|
|
import ChatPage from './view/chatPage'; |
|
|
|
|
import ShoppingCart from './components/ShoppingCart'; |
|
|
|
|
import { Provider, provider } from "react-redux"; |
|
|
|
|
import store from "./redux/store"; |
|
|
|
|
import ContactUs from "./view/contact"; |
|
|
|
|
import ENTER_EXAM from "./view/Exam/EnterExam/index"; |
|
|
|
|
import EXAM from "./view/Exam"; |
|
|
|
|
import CallBack from "./view/CallBack"; |
|
|
|
|
import AdminPanel from "./view/admin"; |
|
|
|
|
import AddProduct from "./view/addProduct"; |
|
|
|
|
import AddExam from "./view/addExam"; |
|
|
|
|
import ChatPage from "./view/chatPage"; |
|
|
|
|
import ShoppingCart from "./components/ShoppingCart"; |
|
|
|
|
import MyServices from "./view/my-services/MyServices"; |
|
|
|
|
|
|
|
|
|
let data = [ |
|
|
|
|
{ |
|
|
|
@ -619,39 +625,36 @@ let data = [ |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
function App() { |
|
|
|
|
|
|
|
|
|
let location = window.location.pathname; |
|
|
|
|
// const {id} = useParams();
|
|
|
|
|
console.log(location); |
|
|
|
|
let buyPackagesData=null; |
|
|
|
|
if(location.includes("buy-packages")){ |
|
|
|
|
let buyPackagesData = null; |
|
|
|
|
if (location.includes("buy-packages")) { |
|
|
|
|
let pathList = location.split("/"); |
|
|
|
|
let id = pathList[pathList.length-1]; |
|
|
|
|
for(let i=0;i<data.length;i++){ |
|
|
|
|
if(data[i].id===Number(id)){ |
|
|
|
|
buyPackagesData=data[i]; |
|
|
|
|
let id = pathList[pathList.length - 1]; |
|
|
|
|
for (let i = 0; i < data.length; i++) { |
|
|
|
|
if (data[i].id === Number(id)) { |
|
|
|
|
buyPackagesData = data[i]; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
let loginStorage = localStorage.getItem('userData'); |
|
|
|
|
let loginStorage = localStorage.getItem("userData"); |
|
|
|
|
let userData = JSON.parse(loginStorage); |
|
|
|
|
console.log(loginStorage == null); |
|
|
|
|
console.log(userData) |
|
|
|
|
const [LOGIN,setLOGIN]=useState(loginStorage == undefined ? false : true); |
|
|
|
|
const activeLogin=()=>{ |
|
|
|
|
setLOGIN(true) |
|
|
|
|
localStorage.setItem('login', true) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
console.log(userData); |
|
|
|
|
const [LOGIN, setLOGIN] = useState(loginStorage == undefined ? false : true); |
|
|
|
|
const activeLogin = () => { |
|
|
|
|
setLOGIN(true); |
|
|
|
|
localStorage.setItem("login", true); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const logOut = () => { |
|
|
|
|
setLOGIN(false) |
|
|
|
|
localStorage.setItem('login', false) |
|
|
|
|
setLOGIN(false); |
|
|
|
|
localStorage.setItem("login", false); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if(location==="/"){ |
|
|
|
|
if (location === "/") { |
|
|
|
|
window.location.replace("/services"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -673,72 +676,100 @@ function App() { |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<Provider store={store}> |
|
|
|
|
<div> |
|
|
|
|
<Router> |
|
|
|
|
<div className="App"> |
|
|
|
|
{LOGIN && <Header logOut={logOut} />} |
|
|
|
|
{LOGIN && <Nav />} |
|
|
|
|
<Routes> |
|
|
|
|
<Route path='/' element={LOGIN ? ( |
|
|
|
|
window.innerWidth <= 1024 && <Dashboard |
|
|
|
|
ActiveUserFullInfo={ActiveUserFullInfo} |
|
|
|
|
UserFullInfoData={UserFullInfoData} |
|
|
|
|
showUserFullInfo={showUserFullInfo} |
|
|
|
|
hideUserFullInfo={hideUserFullInfo} |
|
|
|
|
/>) |
|
|
|
|
: <LoginSignUp activeLogin={activeLogin}/> |
|
|
|
|
} /> |
|
|
|
|
<Route path="/myServices" element={LOGIN ?
|
|
|
|
|
<Dashboard |
|
|
|
|
ActiveUserFullInfo={ActiveUserFullInfo} |
|
|
|
|
UserFullInfoData={UserFullInfoData} |
|
|
|
|
showUserFullInfo={showUserFullInfo} |
|
|
|
|
hideUserFullInfo={hideUserFullInfo} |
|
|
|
|
<div> |
|
|
|
|
<Router> |
|
|
|
|
<div className="App"> |
|
|
|
|
{LOGIN && <Header logOut={logOut} />} |
|
|
|
|
{LOGIN && <Nav />} |
|
|
|
|
<Routes> |
|
|
|
|
<Route |
|
|
|
|
path="/" |
|
|
|
|
element={ |
|
|
|
|
LOGIN ? ( |
|
|
|
|
window.innerWidth <= 1024 && ( |
|
|
|
|
<Dashboard |
|
|
|
|
ActiveUserFullInfo={ActiveUserFullInfo} |
|
|
|
|
UserFullInfoData={UserFullInfoData} |
|
|
|
|
showUserFullInfo={showUserFullInfo} |
|
|
|
|
hideUserFullInfo={hideUserFullInfo} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
) : ( |
|
|
|
|
<LoginSignUp activeLogin={activeLogin} /> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
/> |
|
|
|
|
: <LoginSignUp activeLogin={activeLogin}/>} /> |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
LOGIN ? <> |
|
|
|
|
<Route |
|
|
|
|
path="/buy-packages/:id" |
|
|
|
|
element={ |
|
|
|
|
<Dashboard2 |
|
|
|
|
ActiveUserFullInfo={ActiveUserFullInfo} |
|
|
|
|
UserFullInfoData={UserFullInfoData} |
|
|
|
|
showUserFullInfo={showUserFullInfo} |
|
|
|
|
hideUserFullInfo={hideUserFullInfo} |
|
|
|
|
<Route |
|
|
|
|
path="/myServices" |
|
|
|
|
element={ |
|
|
|
|
LOGIN ? ( |
|
|
|
|
<MyServices /> |
|
|
|
|
) : ( |
|
|
|
|
<LoginSignUp activeLogin={activeLogin} /> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
/> |
|
|
|
|
} |
|
|
|
|
/> |
|
|
|
|
<Route path="/adminpanel" element={<AdminPanel />} /> |
|
|
|
|
<Route path="/adminpanel/add-product" element={<AddProduct />} /> |
|
|
|
|
<Route path="/adminpanel/add-exam" element={<AddExam />} /> |
|
|
|
|
|
|
|
|
|
<Route path="/register" element={<Register activeLogin={activeLogin}/>}/> |
|
|
|
|
<Route path="/accounting" element={<Accounting />} /> |
|
|
|
|
<Route path="/messages" element={<Messages />} /> |
|
|
|
|
<Route path="/messages/:id" element={<ChatPage />} /> |
|
|
|
|
<Route path="/services" element={<Services />} /> |
|
|
|
|
<Route path='shoppingCart' element={<ShoppingCart />} /> |
|
|
|
|
{/* <Route path="/dashboard" element={ <Dashboard |
|
|
|
|
{LOGIN ? ( |
|
|
|
|
<> |
|
|
|
|
<Route |
|
|
|
|
path="/buy-packages/:id" |
|
|
|
|
element={ |
|
|
|
|
<Dashboard2 |
|
|
|
|
ActiveUserFullInfo={ActiveUserFullInfo} |
|
|
|
|
UserFullInfoData={UserFullInfoData} |
|
|
|
|
showUserFullInfo={showUserFullInfo} |
|
|
|
|
hideUserFullInfo={hideUserFullInfo} |
|
|
|
|
/> |
|
|
|
|
} |
|
|
|
|
/> |
|
|
|
|
<Route path="/adminpanel" element={<AdminPanel />} /> |
|
|
|
|
<Route |
|
|
|
|
path="/adminpanel/add-product" |
|
|
|
|
element={<AddProduct />} |
|
|
|
|
/> |
|
|
|
|
<Route path="/adminpanel/add-exam" element={<AddExam />} /> |
|
|
|
|
|
|
|
|
|
<Route |
|
|
|
|
path="/register" |
|
|
|
|
element={<Register activeLogin={activeLogin} />} |
|
|
|
|
/> |
|
|
|
|
<Route path="/accounting" element={<Accounting />} /> |
|
|
|
|
<Route path="/messages" element={<Messages />} /> |
|
|
|
|
<Route path="/messages/:id" element={<ChatPage />} /> |
|
|
|
|
<Route path="/services" element={<Services />} /> |
|
|
|
|
<Route path="shoppingCart" element={<ShoppingCart />} /> |
|
|
|
|
{/* <Route path="/dashboard" element={ <Dashboard |
|
|
|
|
ActiveUserFullInfo={ActiveUserFullInfo} |
|
|
|
|
UserFullInfoData={UserFullInfoData} |
|
|
|
|
showUserFullInfo={showUserFullInfo} |
|
|
|
|
hideUserFullInfo={hideUserFullInfo} |
|
|
|
|
/>} /> */} |
|
|
|
|
|
|
|
|
|
<Route path='/callBack' element={<CallBack />} />
|
|
|
|
|
<Route path="/callBack" element={<CallBack />} /> |
|
|
|
|
|
|
|
|
|
<Route path='/contacts' element={<ContactUs />} /> |
|
|
|
|
<Route exact path="/azmoon_list/enter_exam/:id" element={<ENTER_EXAM />}/> |
|
|
|
|
<Route exact path="/dashboard/azmoon_list/exam/:id" element={<EXAM />} /> |
|
|
|
|
</> |
|
|
|
|
: <Route path='*' element={<LoginSignUp activeLogin={activeLogin}/>} /> |
|
|
|
|
} |
|
|
|
|
</Routes> |
|
|
|
|
</div> |
|
|
|
|
</Router> |
|
|
|
|
<ToastContainer |
|
|
|
|
<Route path="/contacts" element={<ContactUs />} /> |
|
|
|
|
<Route |
|
|
|
|
exact |
|
|
|
|
path="/azmoon_list/enter_exam/:id" |
|
|
|
|
element={<ENTER_EXAM />} |
|
|
|
|
/> |
|
|
|
|
<Route |
|
|
|
|
exact |
|
|
|
|
path="/dashboard/azmoon_list/exam/:id" |
|
|
|
|
element={<EXAM />} |
|
|
|
|
/> |
|
|
|
|
</> |
|
|
|
|
) : ( |
|
|
|
|
<Route |
|
|
|
|
path="*" |
|
|
|
|
element={<LoginSignUp activeLogin={activeLogin} />} |
|
|
|
|
/> |
|
|
|
|
)} |
|
|
|
|
</Routes> |
|
|
|
|
</div> |
|
|
|
|
</Router> |
|
|
|
|
<ToastContainer |
|
|
|
|
position="top-right" |
|
|
|
|
theme="colored" |
|
|
|
|
autoClose={5000} |
|
|
|
@ -750,7 +781,7 @@ function App() { |
|
|
|
|
draggable |
|
|
|
|
pauseOnHover |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</Provider> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|