File tree Expand file tree Collapse file tree 10 files changed +24605
-24720
lines changed Expand file tree Collapse file tree 10 files changed +24605
-24720
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { HomePage } from "./pages/Homepage";
44import { AppContextProvider } from "./context/AppContextProvider" ;
55import { Flags } from "./pages/Flags" ;
66import { Segments } from "./pages/Segments" ;
7- import { Dashboard } from "./pages/Dashboard" ;
7+ import Dashboard from "./pages/Dashboard" ;
88import PrivateRoute from "./components/shared/PrivateRoute" ;
99import { NotificationProvider } from "./components/shared/NotificationProvider" ;
1010import { ApiKeys } from "./components/settings/apiKeys/ApiKeys" ;
@@ -16,6 +16,7 @@ const App: React.FC = () => {
1616 < BrowserRouter >
1717 < Routes >
1818 < Route path = "/" element = { < HomePage /> } />
19+
1920 < Route
2021 path = "/dashboard"
2122 element = {
Original file line number Diff line number Diff line change 1+ import { Outlet } from "react-router-dom" ;
2+
3+ import Sidebar from "./Sidebar" ;
4+
5+ const AuthLayout = ( ) => {
6+ return (
7+ < div className = "flex w-screen bg-[#F9FAFB]" >
8+ < aside className = "pl-2 py-2 w-60 h-screen" >
9+ < div className = "pl-2 pt-10 rounded-2xl bg-white h-full" >
10+ < Sidebar />
11+ </ div >
12+ </ aside >
13+ < div className = "w-[calc(100vw_-_240px)] p-6 max-w-6xl mx-auto" >
14+ < Outlet />
15+ </ div >
16+ </ div >
17+ ) ;
18+ } ;
19+
20+ export default AuthLayout ;
Original file line number Diff line number Diff line change @@ -2,14 +2,15 @@ import { ReactElement } from "react";
22import React from "react" ;
33import { Navigate } from "react-router-dom" ;
44import { useAppContext } from "../../context/AppContextProvider" ;
5+ import DashboardLayout from "../../layout/DashboardLayout" ;
56
67const PrivateRoute : React . FC < { children : ReactElement } > = ( { children } ) => {
78 const { authContext } = useAppContext ( ) ;
89
910 return ! ( authContext . userData ?. authenticated as boolean ) ? (
1011 < Navigate replace to = { "/unauthorized" } />
1112 ) : (
12- children
13+ < DashboardLayout > { children } </ DashboardLayout >
1314 ) ;
1415} ;
1516
Original file line number Diff line number Diff line change 1+ import { Link , useLocation } from "react-router-dom" ;
2+ import {
3+ ArrowLeftOnRectangleIcon ,
4+ Cog6ToothIcon ,
5+ FlagIcon ,
6+ FolderIcon ,
7+ HomeIcon ,
8+ } from "@heroicons/react/24/outline" ;
9+
10+ const Sidebar = ( ) => {
11+ const location = useLocation ( ) ;
12+
13+ const routes = [
14+ {
15+ id : 1 ,
16+ link : "/dashboard" ,
17+ name : "Dashboard" ,
18+ icon : < HomeIcon className = "h-5 w-5 font-extrabold" /> ,
19+ } ,
20+ {
21+ id : 2 ,
22+ link : "/flags" ,
23+ name : "Flags" ,
24+ icon : < FlagIcon className = "h-5 w-5 font-extrabold" /> ,
25+ } ,
26+ {
27+ id : 3 ,
28+ link : "/segments" ,
29+ name : "Segments" ,
30+ icon : < FolderIcon className = "h-5 w-5 font-extrabold" /> ,
31+ } ,
32+ {
33+ id : 4 ,
34+ link : "/settings/apikeys" ,
35+ name : "Settings" ,
36+ icon : < Cog6ToothIcon className = "h-5 w-5 font-extrabold" /> ,
37+ } ,
38+ ] ;
39+
40+ return (
41+ < div className = "flex flex-col justify-between h-full" >
42+ < ul className = "flex flex-col gap-8" >
43+ { routes . map ( ( el ) => (
44+ < li key = { el . id } >
45+ < Link
46+ to = { el . link }
47+ className = { `flex items-center text-base gap-4 pl-8 ${
48+ el . link === location . pathname
49+ ? "text-black font-bold"
50+ : "text-[#2563EB]"
51+ } hover:text-black`}
52+ >
53+ { el . icon }
54+ < span > { el . name } </ span >
55+ </ Link >
56+ </ li >
57+ ) ) }
58+ </ ul >
59+ < div className = "bg-[#2563EB] hover:bg-blue-700 text-white py-3 rounded-b-2xl" >
60+ < Link
61+ to = "/"
62+ className = "flex items-center text-base gap-4 pl-8 text-white hover:"
63+ >
64+ < ArrowLeftOnRectangleIcon className = "h-5 w-5 font-extrabold" />
65+ < span > Logout</ span >
66+ </ Link >
67+ </ div >
68+ </ div >
69+ ) ;
70+ } ;
71+
72+ export default Sidebar ;
You can’t perform that action at this time.
0 commit comments