-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from Andres-Fernandez-Caballero/dev
Dev
- Loading branch information
Showing
18 changed files
with
235 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export const firebaseFolders = { | ||
CLASSES: 'classes', | ||
PROGRAMING_LEANGUAJES: 'programingLeanguajes', | ||
PROGRAMING_LANGUAGES: 'programingLanguages', | ||
STUDENTS: 'students', | ||
TICKETS: 'tickets', | ||
USERS_DATA: 'usersData', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import { IUserDataFirebaseEntity } from '@interfaces/FirebaseEntitys'; | ||
|
||
export interface IUserCredential { | ||
accessToken: string | null; | ||
displayName: string | null; | ||
email: string | null; | ||
phoneNumber: string | null; | ||
photoURL: string | null; | ||
uid: string; | ||
userData: IUserDataFirebaseEntity | null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { selectAuth } from '@slyces/auth.slyce'; | ||
import { useAppSelector } from '@store/hooks/hook'; | ||
|
||
export const Profile = () => { | ||
const { user } = useAppSelector(selectAuth); | ||
return ( | ||
<div> | ||
{user !== null && ( | ||
<> | ||
<h1>Profile</h1> | ||
|
||
<section> | ||
<h2>User Data</h2> | ||
<p>Username: {user.displayName}</p> | ||
|
||
<section> | ||
<h2>Pagos y factuacion</h2> | ||
<p>Valor de la clase: {user.userData?.pricePerHour}</p> | ||
</section> | ||
</section> | ||
</> | ||
)} | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { Profile } from './Profile'; | ||
|
||
export default Profile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,12 @@ | ||
import { Navigate, Outlet, Route, Routes } from 'react-router-dom'; | ||
import NavigableLayour from '@components/layers/NavigableLayout'; | ||
import { navBarLinks, PATH_NAME, URL } from '@constants/routes'; | ||
|
||
import ClassCreate from '@pages/class/ClassCreate'; | ||
import Home from '@pages/Home'; | ||
import StudentCreate from '@pages/student/StudentCreate'; | ||
import { useSelector } from 'react-redux'; | ||
import { selectAuth } from '@/store/slyces/auth.slyce'; | ||
import Login from '@/pages/Login'; | ||
import Tikets from '@/pages/Tikets'; | ||
import StudentList from '@pages/student/StudentList'; | ||
import PrivateRoutes from '@routes/private'; | ||
import PublicRoutes from '@routes/public'; | ||
|
||
const MainRouter = () => { | ||
const auth = useSelector(selectAuth); | ||
console.log(auth); | ||
|
||
return ( | ||
<Routes> | ||
<Route | ||
path={PATH_NAME.ROOT} | ||
element={ | ||
auth.isAuthenticate ? ( | ||
<NavigableLayour navBarLinks={navBarLinks} /> | ||
) : ( | ||
<Navigate to={URL.LOGIN} /> | ||
) | ||
} | ||
> | ||
<Route index element={<Home />} /> | ||
<Route path={PATH_NAME.ABOUT} element={<h1>About</h1>} /> | ||
<Route path={PATH_NAME.CLASS} element={<ClassCreate />}> | ||
<Route path={PATH_NAME.CREATE} element={<ClassCreate />} /> | ||
</Route> | ||
|
||
<Route path={PATH_NAME.TICKET} element={<Tikets />} /> | ||
<Route path={PATH_NAME.STUDENT}> | ||
<Route path={PATH_NAME.CREATE} element={<StudentCreate />} /> | ||
<Route index element={<StudentList />} /> | ||
</Route> | ||
</Route> | ||
|
||
<Route | ||
path={PATH_NAME.AUTH} | ||
element={auth.isAuthenticate ? <Navigate to={URL.HOME} /> : <Outlet />} | ||
> | ||
<Route path={PATH_NAME.LOGIN} index element={<Login />} /> | ||
</Route> | ||
|
||
<Route path='*' element={<div>404 NOT FOUND</div>} /> | ||
</Routes> | ||
); | ||
return <>{auth.isAuthenticate ? <PrivateRoutes /> : <PublicRoutes />}</>; | ||
}; | ||
|
||
export default MainRouter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Route, Routes } from 'react-router-dom'; | ||
import Home from '@pages/Home'; | ||
import { navBarLinks, PATH_NAME } from '@constants/routes'; | ||
import ClassCreate from '@pages/class/ClassCreate'; | ||
import StudentList from '@pages/student/StudentList'; | ||
import Tickets from '@pages/Tikets'; | ||
import StudentCreate from '@pages/student/StudentCreate'; | ||
import NavigableLayour from '@components/layers/NavigableLayout'; | ||
import Profile from '@pages/Profile'; | ||
|
||
const PrivateRoutes = () => { | ||
return ( | ||
<Routes> | ||
<Route | ||
path={PATH_NAME.ROOT} | ||
element={<NavigableLayour navBarLinks={navBarLinks} />} | ||
> | ||
<Route index element={<Home />} /> | ||
<Route path={PATH_NAME.PROFILE} element={<Profile />} /> | ||
<Route path={PATH_NAME.CLASS} element={<ClassCreate />}> | ||
<Route path={PATH_NAME.CREATE} element={<ClassCreate />} /> | ||
</Route> | ||
<Route path={PATH_NAME.STUDENT}> | ||
<Route path={PATH_NAME.CREATE} element={<StudentCreate />} /> | ||
<Route index element={<StudentList />} /> | ||
</Route> | ||
<Route path={PATH_NAME.TICKET} element={<Tickets />} /> | ||
<Route path='*' element={<div>404 NOT FOUND</div>} /> | ||
</Route> | ||
</Routes> | ||
); | ||
}; | ||
|
||
export default PrivateRoutes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { PATH_NAME } from '@constants/routes'; | ||
import { Route, Routes } from 'react-router-dom'; | ||
|
||
export const InstitutionalPages = () => ( | ||
<Routes> | ||
<Route path={PATH_NAME.ABOUT} element={<h1>About</h1>} /> | ||
</Routes> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Navigate, Route, Routes } from 'react-router-dom'; | ||
import { PATH_NAME } from '@constants/routes'; | ||
import Login from '@/pages/Login'; | ||
|
||
const PublicRoutes = () => ( | ||
<Routes> | ||
<Route path={PATH_NAME.LOGIN} index element={<Login />} /> | ||
<Route path={'/*'} element={<Navigate to={PATH_NAME.LOGIN} />} /> | ||
</Routes> | ||
); | ||
|
||
export default PublicRoutes; |
Oops, something went wrong.