|
1 | 1 | import type { FC } from 'react' |
2 | 2 | import { Header } from './Header' |
3 | 3 | import { Footer } from './Footer' |
4 | | -import { NavLink, Outlet, useLocation, useNavigate } from 'react-router-dom' |
| 4 | +import { NavLink, Outlet, useLocation } from 'react-router-dom' |
5 | 5 | import { |
6 | 6 | Sidebar, |
7 | 7 | SidebarContent, |
@@ -58,7 +58,6 @@ const breadcrumbConfigs = [ |
58 | 58 | ] |
59 | 59 |
|
60 | 60 | export const MainLayout: FC = () => { |
61 | | - const navigate = useNavigate() |
62 | 61 | const location = useLocation() |
63 | 62 |
|
64 | 63 | const getBreadcrumbConfig = () => { |
@@ -113,47 +112,51 @@ export const MainLayout: FC = () => { |
113 | 112 | <SidebarMenuItem> |
114 | 113 | <SidebarMenuButton asChild> |
115 | 114 | <Button |
116 | | - onClick={() => navigate('/dashboard')} |
117 | 115 | variant="ghost" |
118 | 116 | className="w-full justify-start p-2 h-8 rounded-md cursor-pointer" |
| 117 | + asChild |
119 | 118 | > |
120 | | - <LayoutDashboard className="h-4 w-4 text-sidebar-foreground" /> |
121 | | - Dashboard |
| 119 | + <NavLink to="/dashboard"> |
| 120 | + <LayoutDashboard className="h-4 w-4 text-sidebar-foreground" /> |
| 121 | + Dashboard |
| 122 | + </NavLink> |
122 | 123 | </Button> |
123 | 124 | </SidebarMenuButton> |
124 | 125 | </SidebarMenuItem> |
125 | 126 | <SidebarMenuSub> |
126 | 127 | <SidebarMenuSubItem> |
127 | 128 | <SidebarMenuSubButton asChild> |
128 | 129 | <Button |
129 | | - onClick={() => navigate('/dashboard/apps')} |
130 | 130 | variant="ghost" |
131 | 131 | className="w-full justify-start p-2 h-8 rounded-md cursor-pointer" |
| 132 | + asChild |
132 | 133 | > |
133 | | - Apps |
| 134 | + <NavLink to="/dashboard/apps">Apps</NavLink> |
134 | 135 | </Button> |
135 | 136 | </SidebarMenuSubButton> |
136 | 137 | </SidebarMenuSubItem> |
137 | 138 | <SidebarMenuSubItem> |
138 | 139 | <SidebarMenuSubButton asChild> |
139 | 140 | <Button |
140 | | - onClick={() => navigate('/dashboard/machines')} |
141 | 141 | variant="ghost" |
142 | 142 | className="w-full justify-start p-2 h-8 rounded-md cursor-pointer" |
| 143 | + asChild |
143 | 144 | > |
144 | | - Machines |
| 145 | + <NavLink to="/dashboard/machines">Machines</NavLink> |
145 | 146 | </Button> |
146 | 147 | </SidebarMenuSubButton> |
147 | 148 | </SidebarMenuSubItem> |
148 | 149 | </SidebarMenuSub> |
149 | 150 | <SidebarMenuButton asChild> |
150 | 151 | <Button |
151 | | - onClick={() => navigate('/explore')} |
152 | 152 | variant="ghost" |
153 | 153 | className="w-full justify-start p-2 h-8 rounded-md cursor-pointer" |
| 154 | + asChild |
154 | 155 | > |
155 | | - <Compass className="h-4 w-4 text-sidebar-foreground" /> |
156 | | - Explore |
| 156 | + <NavLink to="/explore"> |
| 157 | + <Compass className="h-4 w-4 text-sidebar-foreground" /> |
| 158 | + Explore |
| 159 | + </NavLink> |
157 | 160 | </Button> |
158 | 161 | </SidebarMenuButton> |
159 | 162 | </SidebarMenu> |
|
0 commit comments