|
Last change
on this file since b3d5fed was 8c01a1f, checked in by Andrej <asumanovski@…>, 5 months ago |
|
Made investing tab and adding assets, starting training tracking and adding training sessions
|
-
Property mode
set to
100644
|
|
File size:
1.2 KB
|
| Rev | Line | |
|---|
| [8c01a1f] | 1 | import React, { useMemo } from "react";
|
|---|
| 2 | import { Outlet, useNavigate } from "react-router-dom";
|
|---|
| 3 |
|
|---|
| 4 | import { SidebarInset, SidebarProvider } from "@relume_io/relume-ui";
|
|---|
| 5 |
|
|---|
| 6 | import DashboardSidebar from "./components/DashboardSidebar.jsx";
|
|---|
| 7 | import DashboardTopbar from "./components/DashboardTopbar.jsx";
|
|---|
| 8 |
|
|---|
| 9 | const DashboardLayout = () => {
|
|---|
| 10 | const navigate = useNavigate();
|
|---|
| 11 |
|
|---|
| 12 | const user = useMemo(() => {
|
|---|
| 13 | try {
|
|---|
| 14 | const raw = localStorage.getItem("authUser");
|
|---|
| 15 | return raw ? JSON.parse(raw) : null;
|
|---|
| 16 | } catch {
|
|---|
| 17 | return null;
|
|---|
| 18 | }
|
|---|
| 19 | }, []);
|
|---|
| 20 |
|
|---|
| 21 | const username = user?.username ?? "";
|
|---|
| 22 |
|
|---|
| 23 | const onLogout = () => {
|
|---|
| 24 | localStorage.removeItem("authToken");
|
|---|
| 25 | localStorage.removeItem("authUser");
|
|---|
| 26 | navigate("/", { replace: true });
|
|---|
| 27 | };
|
|---|
| 28 |
|
|---|
| 29 | return (
|
|---|
| 30 | <SidebarProvider>
|
|---|
| 31 | <DashboardSidebar />
|
|---|
| 32 | <SidebarInset className="pt-16 lg:pt-0">
|
|---|
| 33 | <DashboardTopbar username={username} onLogout={onLogout} />
|
|---|
| 34 | <div className="h-[calc(100vh-4rem)] overflow-auto">
|
|---|
| 35 | <div className="container mx-auto px-6 py-8 md:px-8 md:py-10 lg:py-12">
|
|---|
| 36 | <Outlet />
|
|---|
| 37 | </div>
|
|---|
| 38 | </div>
|
|---|
| 39 | </SidebarInset>
|
|---|
| 40 | </SidebarProvider>
|
|---|
| 41 | );
|
|---|
| 42 | };
|
|---|
| 43 |
|
|---|
| 44 | export default DashboardLayout;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.