From bfa28781097657c1668941ee8b8b3d9a410663ff Mon Sep 17 00:00:00 2001 From: Boris Cherepanov Date: Fri, 3 Oct 2025 01:10:06 +0300 Subject: [PATCH] feat: added nav --- client/src/components/index.ts | 1 + client/src/components/nav-menu/index.ts | 1 + client/src/components/nav-menu/nav-menu.tsx | 31 +++ .../src/pages/certificates/certificates.tsx | 52 ++++ client/src/pages/certificates/index.ts | 1 + client/src/pages/dashboard/dashboard.tsx | 29 ++ client/src/pages/dashboard/index.ts | 1 + client/src/pages/home/home.tsx | 254 +----------------- client/src/pages/home/utils.ts | 26 ++ .../pages/inbound-binding/inbound-binding.tsx | 55 ++++ client/src/pages/inbound-binding/index.ts | 1 + .../inbound-templates/inboud-templates.tsx | 60 +++++ client/src/pages/inbound-templates/index.ts | 1 + client/src/pages/index.ts | 6 + client/src/pages/servers/index.ts | 1 + client/src/pages/servers/servers.tsx | 40 +++ client/src/pages/users/index.ts | 1 + client/src/pages/users/users.tsx | 40 +++ client/src/router/router.tsx | 18 +- 19 files changed, 369 insertions(+), 250 deletions(-) create mode 100644 client/src/components/index.ts create mode 100644 client/src/components/nav-menu/index.ts create mode 100644 client/src/components/nav-menu/nav-menu.tsx create mode 100644 client/src/pages/certificates/certificates.tsx create mode 100644 client/src/pages/certificates/index.ts create mode 100644 client/src/pages/dashboard/dashboard.tsx create mode 100644 client/src/pages/dashboard/index.ts create mode 100644 client/src/pages/home/utils.ts create mode 100644 client/src/pages/inbound-binding/inbound-binding.tsx create mode 100644 client/src/pages/inbound-binding/index.ts create mode 100644 client/src/pages/inbound-templates/inboud-templates.tsx create mode 100644 client/src/pages/inbound-templates/index.ts create mode 100644 client/src/pages/servers/index.ts create mode 100644 client/src/pages/servers/servers.tsx create mode 100644 client/src/pages/users/index.ts create mode 100644 client/src/pages/users/users.tsx diff --git a/client/src/components/index.ts b/client/src/components/index.ts new file mode 100644 index 0000000..09b18cd --- /dev/null +++ b/client/src/components/index.ts @@ -0,0 +1 @@ +export * from './nav-menu'; diff --git a/client/src/components/nav-menu/index.ts b/client/src/components/nav-menu/index.ts new file mode 100644 index 0000000..09b18cd --- /dev/null +++ b/client/src/components/nav-menu/index.ts @@ -0,0 +1 @@ +export * from './nav-menu'; diff --git a/client/src/components/nav-menu/nav-menu.tsx b/client/src/components/nav-menu/nav-menu.tsx new file mode 100644 index 0000000..6cf62de --- /dev/null +++ b/client/src/components/nav-menu/nav-menu.tsx @@ -0,0 +1,31 @@ +import { Link, useLocation } from 'react-router'; +import { clsx } from 'clsx'; + +interface NavMenuItems { + href: string; + label: string; +} + +interface NavMenuProps { + items: NavMenuItems[]; +} + +export const NavMenu = (props: NavMenuProps) => { + const { items } = props; + const { pathname } = useLocation(); + + return ( +
+ {items.map(({ href, label }) => ( + + {label} + + ))} +
+ ); +}; diff --git a/client/src/pages/certificates/certificates.tsx b/client/src/pages/certificates/certificates.tsx new file mode 100644 index 0000000..c0f9a21 --- /dev/null +++ b/client/src/pages/certificates/certificates.tsx @@ -0,0 +1,52 @@ +import type { RouteObject } from 'react-router'; + +export const Certificates = () => { + return ( +
+
+

Add Certificate

+
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ +
+
+ +
+

Certificates List

+
+ Loading... +
+
+
+ ); +}; + +export const CertificatesRoute: RouteObject = { + path: '/certificates', + Component: Certificates, +}; diff --git a/client/src/pages/certificates/index.ts b/client/src/pages/certificates/index.ts new file mode 100644 index 0000000..05d91dd --- /dev/null +++ b/client/src/pages/certificates/index.ts @@ -0,0 +1 @@ +export * from './certificates'; diff --git a/client/src/pages/dashboard/dashboard.tsx b/client/src/pages/dashboard/dashboard.tsx new file mode 100644 index 0000000..becfeb0 --- /dev/null +++ b/client/src/pages/dashboard/dashboard.tsx @@ -0,0 +1,29 @@ +import type { RouteObject } from 'react-router'; + +export const Dashboard = () => { + return ( +
+
+

Statistics

+

+ Servers: Loading... +

+

+ Templates: Loading... +

+

+ Certificates: Loading... +

+

+ Users: Loading... +

+
+
+ ); +}; + +export const DashboardRoute: RouteObject = { + index: true, + path: '/', + Component: Dashboard, +}; diff --git a/client/src/pages/dashboard/index.ts b/client/src/pages/dashboard/index.ts new file mode 100644 index 0000000..b58b6c9 --- /dev/null +++ b/client/src/pages/dashboard/index.ts @@ -0,0 +1 @@ +export * from './dashboard'; diff --git a/client/src/pages/home/home.tsx b/client/src/pages/home/home.tsx index 2c226a8..f7dd629 100644 --- a/client/src/pages/home/home.tsx +++ b/client/src/pages/home/home.tsx @@ -1,5 +1,7 @@ import { Outlet } from 'react-router'; import './home.css'; +import { NavMenu } from '../../components/nav-menu/nav-menu'; +import { navItems } from './utils'; export const Home = () => { return ( @@ -10,266 +12,21 @@ export const Home = () => { {/* */}
-
-
- Dashboard -
-
- Servers -
-
- Inbound Templates -
-
- Certificates -
-
- Inbound Binding -
-
- Users -
-
+ {/* */} -
-
-

Statistics

-

- Servers: Loading... -

-

- Templates: Loading... -

-

- Certificates: Loading... -

-

- Users: Loading... -

-
-
+ + {/* */} -
-
-

Add Server

-
-
- - -
-
- - -
-
- - -
- -
-
- -
-

Servers List

-
- Loading... -
-
-
{/* */} -
-
-

Add Template

-
-
- - -
-
- - -
-
- - -
-
- -
-
- - -
- -
-
- -
-

Templates List

-
- Loading... -
-
-
{/* */} -
-
-

Add Certificate

-
-
- - -
-
- - -
-
- - -
-
- -
- -
-
- -
-

Certificates List

-
- Loading... -
-
-
{/* */} -
-
-

Bind Template to Server

-
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
- -
-
- -
-

Server Inbounds

-
- Loading... -
-
-
{/* */} -
-
-

Add User

-
-
- - -
-
- - -
-
- - -
- -
-
- -
-

Users List

-
- Loading... -
-
-
{/* */} @@ -333,7 +90,6 @@ export const Home = () => { - ); }; diff --git a/client/src/pages/home/utils.ts b/client/src/pages/home/utils.ts new file mode 100644 index 0000000..394b3ad --- /dev/null +++ b/client/src/pages/home/utils.ts @@ -0,0 +1,26 @@ +export const navItems = [ + { + href: '/', + label: 'Dashboard', + }, + { + href: '/servers', + label: 'Servers', + }, + { + href: '/inbound-templates', + label: 'Inbound Templates', + }, + { + href: '/certificates', + label: 'Certificates', + }, + { + href: '/inbound-binding', + label: 'Inbound Binding', + }, + { + href: '/users', + label: 'Users', + }, +]; diff --git a/client/src/pages/inbound-binding/inbound-binding.tsx b/client/src/pages/inbound-binding/inbound-binding.tsx new file mode 100644 index 0000000..3459a80 --- /dev/null +++ b/client/src/pages/inbound-binding/inbound-binding.tsx @@ -0,0 +1,55 @@ +import type { RouteObject } from 'react-router'; + +export const InboundBinding = () => { + return ( +
+
+

Bind Template to Server

+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ +
+
+ +
+

Server Inbounds

+
+ Loading... +
+
+
+ ); +}; + +export const InboundBindingRoute: RouteObject = { + path: '/inbound-binding', + Component: InboundBinding, +}; diff --git a/client/src/pages/inbound-binding/index.ts b/client/src/pages/inbound-binding/index.ts new file mode 100644 index 0000000..8869d0b --- /dev/null +++ b/client/src/pages/inbound-binding/index.ts @@ -0,0 +1 @@ +export * from './inbound-binding'; diff --git a/client/src/pages/inbound-templates/inboud-templates.tsx b/client/src/pages/inbound-templates/inboud-templates.tsx new file mode 100644 index 0000000..160210f --- /dev/null +++ b/client/src/pages/inbound-templates/inboud-templates.tsx @@ -0,0 +1,60 @@ +import type { RouteObject } from 'react-router'; + +export const InboundTemplates = () => { + return ( +
+
+

Add Template

+
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+ +
+
+ +
+

Templates List

+
+ Loading... +
+
+
+ ); +}; + +export const InboundTemplatesRoute: RouteObject = { + path: '/inbound-templates', + Component: InboundTemplates, +}; diff --git a/client/src/pages/inbound-templates/index.ts b/client/src/pages/inbound-templates/index.ts new file mode 100644 index 0000000..26ae699 --- /dev/null +++ b/client/src/pages/inbound-templates/index.ts @@ -0,0 +1 @@ +export * from './inboud-templates'; diff --git a/client/src/pages/index.ts b/client/src/pages/index.ts index e20557b..326fd2c 100644 --- a/client/src/pages/index.ts +++ b/client/src/pages/index.ts @@ -1 +1,7 @@ export * from './home'; +export * from './certificates'; +export * from './dashboard'; +export * from './inbound-binding'; +export * from './inbound-templates'; +export * from './servers'; +export * from './users'; diff --git a/client/src/pages/servers/index.ts b/client/src/pages/servers/index.ts new file mode 100644 index 0000000..aeb0ea6 --- /dev/null +++ b/client/src/pages/servers/index.ts @@ -0,0 +1 @@ +export * from './servers'; diff --git a/client/src/pages/servers/servers.tsx b/client/src/pages/servers/servers.tsx new file mode 100644 index 0000000..4a9da10 --- /dev/null +++ b/client/src/pages/servers/servers.tsx @@ -0,0 +1,40 @@ +import type { RouteObject } from 'react-router'; + +export const Servers = () => { + return ( +
+
+

Add Server

+
+
+ + +
+
+ + +
+
+ + +
+ +
+
+ +
+

Servers List

+
+ Loading... +
+
+
+ ); +}; + +export const ServersRoute: RouteObject = { + path: '/servers', + Component: Servers, +}; diff --git a/client/src/pages/users/index.ts b/client/src/pages/users/index.ts new file mode 100644 index 0000000..b18bf4c --- /dev/null +++ b/client/src/pages/users/index.ts @@ -0,0 +1 @@ +export * from './users'; diff --git a/client/src/pages/users/users.tsx b/client/src/pages/users/users.tsx new file mode 100644 index 0000000..d135915 --- /dev/null +++ b/client/src/pages/users/users.tsx @@ -0,0 +1,40 @@ +import type { RouteObject } from 'react-router'; + +export const Users = () => { + return ( +
+
+

Add User

+
+
+ + +
+
+ + +
+
+ + +
+ +
+
+ +
+

Users List

+
+ Loading... +
+
+
+ ); +}; + +export const UsersRoute: RouteObject = { + path: '/users', + Component: Users, +}; diff --git a/client/src/router/router.tsx b/client/src/router/router.tsx index d503f5d..5b50144 100644 --- a/client/src/router/router.tsx +++ b/client/src/router/router.tsx @@ -1,9 +1,25 @@ import { createBrowserRouter } from 'react-router'; -import { Home } from '../pages'; +import { + Home, + DashboardRoute, + ServersRoute, + InboundTemplatesRoute, + CertificatesRoute, + InboundBindingRoute, + UsersRoute, +} from '../pages'; export const router = createBrowserRouter([ { path: '/', Component: Home, + children: [ + DashboardRoute, + ServersRoute, + InboundTemplatesRoute, + CertificatesRoute, + InboundBindingRoute, + UsersRoute, + ], }, ]);