Skip to content

Commit 2d3f189

Browse files
authored
Dashboard design (#72)
* fix: import errors * notification provider * feat: removed style prop for notification * fix: package issue * fix: package issue * fix: package issue * fix: package issue * package.json changes * feat: dashboard route * feat: authlayout * feat: sidebar * feat: authlayout width * feat: dashboard design * fix: route fix * feat: Binded all routes with DashboardLayout * feat: removed unwanted routes * feat: dashboardlayout changes * feat: dashboard * feat: removed dashboardlayout wroking as wrapper * feat: dashboard card title changes * feat: moved to dashboard layout to privatelayout * feat: auth * feat: sidebar resposive
1 parent c2e19c2 commit 2d3f189

File tree

10 files changed

+24605
-24720
lines changed

10 files changed

+24605
-24720
lines changed

package-lock.json

Lines changed: 24352 additions & 24352 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ui/src/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { HomePage } from "./pages/Homepage";
44
import { AppContextProvider } from "./context/AppContextProvider";
55
import { Flags } from "./pages/Flags";
66
import { Segments } from "./pages/Segments";
7-
import { Dashboard } from "./pages/Dashboard";
7+
import Dashboard from "./pages/Dashboard";
88
import PrivateRoute from "./components/shared/PrivateRoute";
99
import { NotificationProvider } from "./components/shared/NotificationProvider";
1010
import { 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={
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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;

packages/ui/src/components/shared/PrivateRoute.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import { ReactElement } from "react";
22
import React from "react";
33
import { Navigate } from "react-router-dom";
44
import { useAppContext } from "../../context/AppContextProvider";
5+
import DashboardLayout from "../../layout/DashboardLayout";
56

67
const 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

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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;

0 commit comments

Comments
 (0)