|
|
import logo from './logo.svg'; |
|
|
import './App.css'; |
|
|
import { BrowserRouter, Routes, Route } 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 Login from './view/login/Login'; |
|
|
import { useState } from 'react'; |
|
|
// import {useParams} from 'react-router-dom'; |
|
|
|
|
|
import avatar1 from "./assets/img/avatar/080cd026ce8cd30f68acfa086ebde7fb.jpg"; |
|
|
import avatar2 from "./assets/img/avatar/alex-suprun-bYODySpLIhE-unsplash.jpg"; |
|
|
import avatar3 from "./assets/img/avatar/alex-suprun-ZHvM3XIOHoE-unsplash.jpg"; |
|
|
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' |
|
|
|
|
|
|
|
|
let data = [ |
|
|
{ |
|
|
id: 1, |
|
|
img: avatar6, |
|
|
firstName: "فرشید", |
|
|
lastName: "وکیلی", |
|
|
nationalId: "0010855770", |
|
|
age: "7", |
|
|
phoneNumber: "09101292134", |
|
|
credit: 200000, |
|
|
packages: [ |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی معمارک", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
], |
|
|
documents: "", |
|
|
situation: 0, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
img: avatar2, |
|
|
firstName: "سپند", |
|
|
lastName: "معروف", |
|
|
nationalId: "0040855880", |
|
|
age: "10", |
|
|
phoneNumber: "09101292134", |
|
|
credit: 100000, |
|
|
packages: [ |
|
|
{ |
|
|
id: 1, |
|
|
games: [ |
|
|
{ |
|
|
id: 101, |
|
|
title: "بازی معمارک", |
|
|
}, |
|
|
{ |
|
|
id: 102, |
|
|
title: "بازی آشپزباشی", |
|
|
}, |
|
|
], |
|
|
time: 2, |
|
|
remainderTime: "1:29:13", |
|
|
isActive: false, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
], |
|
|
documents: "", |
|
|
situation: 0, |
|
|
}, |
|
|
{ |
|
|
id: 11, |
|
|
img: avatar3, |
|
|
firstName: "مهرداد", |
|
|
lastName: "فانی", |
|
|
nationalId: "0040855880", |
|
|
age: "10", |
|
|
phoneNumber: "09101292134", |
|
|
credit: 100000, |
|
|
packages: [ |
|
|
{ |
|
|
id: 1, |
|
|
games: [ |
|
|
{ |
|
|
id: 101, |
|
|
title: "بازی معمارک", |
|
|
}, |
|
|
{ |
|
|
id: 102, |
|
|
title: "بازی آشپزباشی", |
|
|
}, |
|
|
], |
|
|
time: 2, |
|
|
remainderTime: "1:29:13", |
|
|
isActive: false, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
], |
|
|
documents: "", |
|
|
situation: 2, |
|
|
}, |
|
|
{ |
|
|
id: 3, |
|
|
img: avatar1, |
|
|
firstName: "فرزین", |
|
|
lastName: "همت", |
|
|
nationalId: "0050855880", |
|
|
age: "11", |
|
|
phoneNumber: "09101292134", |
|
|
credit: 111000, |
|
|
packages: [ |
|
|
{ |
|
|
id: 1, |
|
|
games: [ |
|
|
{ |
|
|
id: 101, |
|
|
title: "بازی معمارک", |
|
|
}, |
|
|
{ |
|
|
id: 102, |
|
|
title: "بازی آشپزباشی", |
|
|
}, |
|
|
], |
|
|
time: 2, |
|
|
remainderTime: "1:29:13", |
|
|
isActive: false, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
], |
|
|
documents: "", |
|
|
situation: 3, |
|
|
}, |
|
|
{ |
|
|
id: 4, |
|
|
img: avatar4, |
|
|
firstName: "مهتاب", |
|
|
lastName: "آیتی", |
|
|
nationalId: "0060855880", |
|
|
age: "11", |
|
|
phoneNumber: "09101292134", |
|
|
credit: 0, |
|
|
packages: [ |
|
|
{ |
|
|
id: 1, |
|
|
games: [ |
|
|
{ |
|
|
id: 101, |
|
|
title: "بازی معمارک", |
|
|
}, |
|
|
{ |
|
|
id: 102, |
|
|
title: "بازی آشپزباشی", |
|
|
}, |
|
|
], |
|
|
time: 2, |
|
|
remainderTime: "1:29:13", |
|
|
isActive: false, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
], |
|
|
documents: "", |
|
|
situation: 1, |
|
|
}, |
|
|
{ |
|
|
id: 5, |
|
|
img: avatar5, |
|
|
firstName: "محمدرضا", |
|
|
lastName: "شایع", |
|
|
nationalId: "0080855990", |
|
|
age: "12", |
|
|
phoneNumber: "09101292235", |
|
|
credit: 0, |
|
|
packages: [ |
|
|
{ |
|
|
id: 1, |
|
|
games: [ |
|
|
{ |
|
|
id: 101, |
|
|
title: "بازی معمارک", |
|
|
}, |
|
|
{ |
|
|
id: 102, |
|
|
title: "بازی آشپزباشی", |
|
|
}, |
|
|
], |
|
|
time: 2, |
|
|
remainderTime: "1:29:13", |
|
|
isActive: false, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
], |
|
|
documents: "", |
|
|
situation: 3, |
|
|
}, |
|
|
{ |
|
|
id: 6, |
|
|
img: avatar6, |
|
|
firstName: "فرزاد", |
|
|
lastName: "همت", |
|
|
nationalId: "0090855990", |
|
|
age: "13", |
|
|
phoneNumber: "09101292444", |
|
|
credit: 50000, |
|
|
packages: [ |
|
|
{ |
|
|
id: 1, |
|
|
games: [ |
|
|
{ |
|
|
id: 101, |
|
|
title: "بازی معمارک", |
|
|
}, |
|
|
{ |
|
|
id: 102, |
|
|
title: "بازی آشپزباشی", |
|
|
}, |
|
|
], |
|
|
time: 2, |
|
|
remainderTime: "1:29:13", |
|
|
isActive: false, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
], |
|
|
documents: "", |
|
|
situation: 3, |
|
|
}, |
|
|
{ |
|
|
id: 7, |
|
|
img: avatar7, |
|
|
firstName: "مهنگار", |
|
|
lastName: "همتی", |
|
|
nationalId: "0090855222", |
|
|
age: "9", |
|
|
phoneNumber: "09101292111", |
|
|
credit: 50000, |
|
|
packages: [ |
|
|
{ |
|
|
id: 1, |
|
|
games: [ |
|
|
{ |
|
|
id: 101, |
|
|
title: "بازی معمارک", |
|
|
}, |
|
|
{ |
|
|
id: 102, |
|
|
title: "بازی آشپزباشی", |
|
|
}, |
|
|
], |
|
|
time: 2, |
|
|
remainderTime: "1:29:13", |
|
|
isActive: false, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
], |
|
|
documents: "", |
|
|
situation: 1, |
|
|
}, |
|
|
{ |
|
|
id: 8, |
|
|
img: avatar7, |
|
|
firstName: "سها", |
|
|
lastName: "آسایش", |
|
|
nationalId: "0090855333", |
|
|
age: "10", |
|
|
phoneNumber: "09101292888", |
|
|
credit: 50000, |
|
|
packages: [ |
|
|
{ |
|
|
id: 1, |
|
|
games: [ |
|
|
{ |
|
|
id: 101, |
|
|
title: "بازی معمارک", |
|
|
}, |
|
|
{ |
|
|
id: 102, |
|
|
title: "بازی آشپزباشی", |
|
|
}, |
|
|
], |
|
|
time: 2, |
|
|
remainderTime: "1:29:13", |
|
|
isActive: false, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
{ |
|
|
id: 2, |
|
|
games: [ |
|
|
{ |
|
|
id: 201, |
|
|
title: "بازی کنجکاو", |
|
|
}, |
|
|
], |
|
|
time: 1, |
|
|
remainderTime: "0:30:11", |
|
|
isActive: true, |
|
|
}, |
|
|
], |
|
|
documents: "", |
|
|
situation: 1, |
|
|
}, |
|
|
]; |
|
|
|
|
|
function App() { |
|
|
let location = window.location.pathname; |
|
|
// const {id} = useParams(); |
|
|
console.log(location); |
|
|
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]; |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
const [LOGIN,setLOGIN]=useState(false); |
|
|
const activeLogin=()=>{ |
|
|
setLOGIN(true); |
|
|
} |
|
|
|
|
|
const logOut = () => { |
|
|
setLOGIN(false); |
|
|
}; |
|
|
|
|
|
//--UserFullInfo--------------------- |
|
|
const [ActiveUserFullInfo, setActiveUserFullInfo] = useState(false); |
|
|
const [UserFullInfoData, setUserFullInfoData] = useState(buyPackagesData); |
|
|
const showUserFullInfo = (data) => { |
|
|
console.log(data); |
|
|
setActiveUserFullInfo(true); |
|
|
setUserFullInfoData(data); |
|
|
}; |
|
|
const hideUserFullInfo = () => { |
|
|
setActiveUserFullInfo(false); |
|
|
}; |
|
|
|
|
|
return ( |
|
|
<BrowserRouter> |
|
|
<div className="App"> |
|
|
{LOGIN && <Header />} |
|
|
{LOGIN && <Nav logOut={logOut} />} |
|
|
<Routes> |
|
|
<Route path="/" element={<LoginSignUp activeLogin={activeLogin}/>} /> |
|
|
<Route |
|
|
path="/login" |
|
|
element={ |
|
|
|
|
|
<Login activeLogin={activeLogin} />} |
|
|
/> |
|
|
<Route |
|
|
path="/buy-packages/:id" |
|
|
element={ |
|
|
<Dashboard2 |
|
|
ActiveUserFullInfo={ActiveUserFullInfo} |
|
|
UserFullInfoData={UserFullInfoData} |
|
|
showUserFullInfo={showUserFullInfo} |
|
|
hideUserFullInfo={hideUserFullInfo} |
|
|
/> |
|
|
} |
|
|
/> |
|
|
<Route path="/register" element={<Register activeLogin={activeLogin}/>}/> |
|
|
<Route path="/accounting" element={<Accounting />} /> |
|
|
<Route path="/messages" element={<Messages />} /> |
|
|
<Route path="/dashboard" element={ <Dashboard |
|
|
ActiveUserFullInfo={ActiveUserFullInfo} |
|
|
UserFullInfoData={UserFullInfoData} |
|
|
showUserFullInfo={showUserFullInfo} |
|
|
hideUserFullInfo={hideUserFullInfo} |
|
|
/>} /> |
|
|
</Routes> |
|
|
</div> |
|
|
</BrowserRouter> |
|
|
); |
|
|
} |
|
|
|
|
|
export default App;
|
|
|
|