diff --git a/src/components/Tab.tsx b/src/components/Tab.tsx
new file mode 100644
index 00000000..b40b41ba
--- /dev/null
+++ b/src/components/Tab.tsx
@@ -0,0 +1,36 @@
+import type React from 'react';
+
+import type { Link } from 'type-route';
+
+export interface TabProps {
+ link?: Link;
+ icon: React.ReactNode;
+ title: string;
+ active: boolean;
+}
+
+export const Tab = ({ link, icon, title, active }: TabProps): JSX.Element => {
+ return (
+
+ );
+};
diff --git a/src/components/generic/button/IconButton.tsx b/src/components/generic/button/IconButton.tsx
index a62f7416..1549acbb 100644
--- a/src/components/generic/button/IconButton.tsx
+++ b/src/components/generic/button/IconButton.tsx
@@ -19,6 +19,7 @@ export const IconButton = ({
nested,
active,
disabled,
+ className,
...props
}: IconButtonProps): JSX.Element => {
return (
@@ -39,7 +40,7 @@ export const IconButton = ({
disabled
? 'cursor-not-allowed text-gray-400 dark:text-gray-700'
: ''
- }`}
+ } ${className ?? ''}`}
{...props}
>
{icon}
diff --git a/src/components/layout/Sidebar/ButtonNav.tsx b/src/components/layout/Sidebar/ButtonNav.tsx
deleted file mode 100644
index 7d7cb3f2..00000000
--- a/src/components/layout/Sidebar/ButtonNav.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-import type React from 'react';
-
-import { FiMessageCircle, FiSettings } from 'react-icons/fi';
-import { RiMindMap, RiRoadMapLine } from 'react-icons/ri';
-import { VscExtensions } from 'react-icons/vsc';
-
-import { NavLinkButton } from '@components/layout/Sidebar/NavLinkButton';
-import { routes, useRoute } from '@core/router';
-import { toggleMobileNav } from '@core/slices/appSlice';
-import { useAppDispatch } from '@hooks/useAppDispatch';
-
-export interface ButtonNavProps {
- toggleSettingsOpen: () => void;
-}
-
-export const ButtonNav = ({
- toggleSettingsOpen,
-}: ButtonNavProps): JSX.Element => {
- const route = useRoute();
- const dispatch = useAppDispatch();
-
- return (
-
-
{
- dispatch(toggleMobileNav());
- }}
- >
-
-
-
-
-
{
- dispatch(toggleMobileNav());
- }}
- >
-
-
-
-
-
{
- dispatch(toggleMobileNav());
- }}
- >
-
-
-
-
-
{
- dispatch(toggleMobileNav());
- }}
- >
-
-
-
-
-
{
- toggleSettingsOpen();
- }}
- >
-
-
-
- );
-};
diff --git a/src/components/layout/Sidebar/NavLinkButton.tsx b/src/components/layout/Sidebar/NavLinkButton.tsx
deleted file mode 100644
index e4904d0c..00000000
--- a/src/components/layout/Sidebar/NavLinkButton.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-import type React from 'react';
-
-import { m } from 'framer-motion';
-import type { Link } from 'type-route';
-
-export interface NavLinkButtonProps {
- link?: Link;
- active?: boolean;
- action?: () => void;
- children: React.ReactNode;
-}
-
-export const NavLinkButton = ({
- link,
- active,
- action,
- children,
-}: NavLinkButtonProps): JSX.Element => {
- return (
- {
- action && action();
- }}
- {...(link && link)}
- >
- {children}
-
- );
-};
diff --git a/src/components/layout/Sidebar/index.tsx b/src/components/layout/Sidebar/index.tsx
index d318c42c..b9500cb4 100644
--- a/src/components/layout/Sidebar/index.tsx
+++ b/src/components/layout/Sidebar/index.tsx
@@ -1,17 +1,19 @@
import type React from 'react';
-import { useState } from 'react';
-import { ButtonNav } from '@components/layout/Sidebar/ButtonNav';
import { Settings } from '@components/layout/Sidebar/Settings/Index';
import { useAppSelector } from '@hooks/useAppSelector';
export interface SidebarProps {
children: React.ReactNode;
+ setSettingsOpen: (settingsOpen: boolean) => void;
+ settingsOpen: boolean;
}
-export const Sidebar = ({ children }: SidebarProps): JSX.Element => {
- const [settingsOpen, setSettingsOpen] = useState(false);
-
+export const Sidebar = ({
+ settingsOpen,
+ setSettingsOpen,
+ children,
+}: SidebarProps): JSX.Element => {
const appState = useAppSelector((state) => state.app);
return (
@@ -25,11 +27,6 @@ export const Sidebar = ({ children }: SidebarProps): JSX.Element => {
{children}
- {
- setSettingsOpen(!settingsOpen);
- }}
- />
);
diff --git a/src/components/layout/index.tsx b/src/components/layout/index.tsx
index 7964d364..dad9aae5 100644
--- a/src/components/layout/index.tsx
+++ b/src/components/layout/index.tsx
@@ -1,11 +1,17 @@
import type React from 'react';
+import { useState } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
+import { FiMessageCircle, FiSettings } from 'react-icons/fi';
+import { RiMindMap, RiRoadMapLine } from 'react-icons/ri';
+import { VscExtensions } from 'react-icons/vsc';
+import { routes, useRoute } from '@app/core/router';
import { IconButton } from '@components/generic/button/IconButton';
import { Sidebar } from '@components/layout/Sidebar';
import { ErrorFallback } from '../ErrorFallback';
+import { Tab } from '../Tab';
export interface LayoutProps {
title: string;
@@ -20,10 +26,14 @@ export const Layout = ({
sidebarContents,
children,
}: LayoutProps): JSX.Element => {
+ const [settingsOpen, setSettingsOpen] = useState(false);
+
+ const route = useRoute();
+
return (
-
+
@@ -34,8 +44,45 @@ export const Layout = ({
-
- {children}
+
+
+
+ {
+ setSettingsOpen(!settingsOpen);
+ }}
+ nested
+ active={settingsOpen}
+ icon={}
+ />
+
+
}
+ link={routes.messages().link}
+ active={route.name === 'messages'}
+ />
+
}
+ link={routes.nodes().link}
+ active={route.name === 'nodes'}
+ />
+
}
+ link={routes.map().link}
+ active={route.name === 'map'}
+ />
+
}
+ link={routes.extensions().link}
+ active={route.name === 'extensions'}
+ />
+
+
{children}