Skip to content

Commit 4fbb354

Browse files
committed
Use tabler-react-typescript, updated frontend deps
1 parent 0f64986 commit 4fbb354

File tree

16 files changed

+419
-332
lines changed

16 files changed

+419
-332
lines changed

frontend/package.json

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,52 @@
33
"version": "1.0.0",
44
"private": true,
55
"dependencies": {
6-
"@testing-library/jest-dom": "5.12.0",
7-
"@testing-library/react": "11.2.7",
6+
"@testing-library/jest-dom": "5.14.1",
7+
"@testing-library/react": "12.0.0",
88
"@types/humps": "^2.0.0",
99
"@types/jest": "26.0.23",
10-
"@types/lodash": "4.14.169",
11-
"@types/node": "15.3.0",
12-
"@types/react": "17.0.5",
13-
"@types/react-dom": "17.0.5",
10+
"@types/lodash": "4.14.170",
11+
"@types/node": "16.0.0",
12+
"@types/react": "17.0.13",
13+
"@types/react-dom": "17.0.8",
1414
"@types/react-router-dom": "5.1.7",
15-
"@types/styled-components": "5.1.9",
16-
"@typescript-eslint/eslint-plugin": "^4.23.0",
17-
"@typescript-eslint/parser": "^4.23.0",
15+
"@types/styled-components": "5.1.11",
16+
"@typescript-eslint/eslint-plugin": "^4.28.1",
17+
"@typescript-eslint/parser": "^4.28.1",
1818
"babel-eslint": "^10.1.0",
19-
"date-fns": "2.21.3",
20-
"eslint": "^7.26.0",
19+
"date-fns": "2.22.1",
20+
"eslint": "^7.30.0",
2121
"eslint-config-prettier": "^8.3.0",
2222
"eslint-config-react-app": "^6.0.0",
2323
"eslint-loader": "^4.0.2",
24-
"eslint-plugin-flowtype": "^5.7.2",
25-
"eslint-plugin-import": "^2.23.2",
24+
"eslint-plugin-flowtype": "^5.8.0",
25+
"eslint-plugin-import": "^2.23.4",
2626
"eslint-plugin-jsx-a11y": "^6.4.1",
2727
"eslint-plugin-prettier": "^3.4.0",
28-
"eslint-plugin-react": "^7.23.2",
28+
"eslint-plugin-react": "^7.24.0",
2929
"eslint-plugin-react-hooks": "^4.2.0",
3030
"humps": "^2.0.1",
3131
"jest-date-mock": "1.0.8",
3232
"jest-fetch-mock": "3.0.3",
33-
"jest-junit": "^12.0.0",
34-
"jest-localstorage-mock": "2.4.12",
35-
"jest-runner-eslint": "0.10.0",
33+
"jest-junit": "^12.2.0",
34+
"jest-localstorage-mock": "2.4.14",
35+
"jest-runner-eslint": "0.10.1",
3636
"lodash": "4.17.21",
3737
"moment": "2.29.1",
3838
"node-sass": "^5.0.0",
39-
"prettier": "2.3.0",
40-
"query-string": "7.0.0",
39+
"prettier": "2.3.2",
40+
"query-string": "7.0.1",
4141
"react": "17.0.2",
4242
"react-async": "10.0.1",
4343
"react-dom": "17.0.2",
4444
"react-router-dom": "^5.2.0",
4545
"react-scripts": "4.0.3",
4646
"rooks": "5.0.2",
4747
"styled-components": "5.3.0",
48+
"tabler-icons-react": "^1.35.0",
4849
"tabler-react": "^2.0.0-alpha.1",
49-
"typescript": "^4.2.4"
50+
"tabler-react-typescript": "^0.0.4",
51+
"typescript": "^4.3.5"
5052
},
5153
"scripts": {
5254
"start": "react-scripts start",

frontend/public/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
rel="stylesheet"
5252
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,400,400i,500,500i,600,600i,700,700i&subset=latin-ext"
5353
/>
54+
<link
55+
rel="stylesheet"
56+
href="https://unpkg.com/@tabler/[email protected]/dist/css/tabler.min.css"
57+
/>
5458
</head>
5559
<body>
5660
<noscript>You need to enable JavaScript to run this app.</noscript>

frontend/src/components/Router.tsx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@ import { Loading, SiteWrapper, SinglePage } from "components";
44
import { useAuthState, useHealthState, UserProvider } from "context";
55
import { BrowserRouter, Switch, Route } from "react-router-dom";
66

7-
const Setup = lazy(() => import("pages/Setup"));
7+
const AccessLists = lazy(() => import("pages/AccessLists"));
8+
const AuditLog = lazy(() => import("pages/AuditLog"));
9+
const Certificates = lazy(() => import("pages/Certificates"));
810
const Dashboard = lazy(() => import("pages/Dashboard"));
11+
const Hosts = lazy(() => import("pages/Hosts"));
912
const Login = lazy(() => import("pages/Login"));
13+
const Settings = lazy(() => import("pages/Settings"));
14+
const Setup = lazy(() => import("pages/Setup"));
15+
const Users = lazy(() => import("pages/Users"));
1016

1117
function Router() {
1218
const { health } = useHealthState();
@@ -43,6 +49,24 @@ function Router() {
4349
<SiteWrapper>
4450
<Suspense fallback={Spinner}>
4551
<Switch>
52+
<Route path="/hosts">
53+
<Hosts />
54+
</Route>
55+
<Route path="/certificates">
56+
<Certificates />
57+
</Route>
58+
<Route path="/audit-log">
59+
<AuditLog />
60+
</Route>
61+
<Route path="/access-lists">
62+
<AccessLists />
63+
</Route>
64+
<Route path="/users">
65+
<Users />
66+
</Route>
67+
<Route path="/settings">
68+
<Settings />
69+
</Route>
4670
<Route path="/">
4771
<Dashboard />
4872
</Route>

frontend/src/components/SiteWrapper.tsx

Lines changed: 82 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@ import React, { ReactNode } from "react";
33
import { Footer } from "components";
44
import { useAuthState, useUserState } from "context";
55
import styled from "styled-components";
6-
import { Site, Container, Button, Grid, List } from "tabler-react";
6+
import {
7+
Book,
8+
DeviceDesktop,
9+
Home,
10+
Lock,
11+
Settings,
12+
Shield,
13+
Users,
14+
} from "tabler-icons-react";
15+
import { Avatar, Dropdown, Navigation } from "tabler-react-typescript";
716

8-
const StyledContainer = styled(Container)`
17+
const StyledContainer = styled.div`
918
padding-bottom: 30px;
1019
`;
1120

@@ -16,177 +25,79 @@ function SiteWrapper({ children }: Props) {
1625
const user = useUserState();
1726
const { logout } = useAuthState();
1827

19-
const accountDropdownProps = {
20-
avatarURL: user.gravatarUrl,
21-
name: user.nickname,
22-
description: user.roles.includes("admin")
23-
? "Administrator"
24-
: "Standard User",
25-
options: [
26-
{ icon: "user", value: "Profile" },
27-
{ icon: "settings", value: "Settings" },
28-
{ isDivider: true },
29-
{
30-
icon: "help-circle",
31-
value: "Need help?",
32-
href: "https://nginxproxymanager.com",
33-
target: "_blank",
34-
},
35-
{ icon: "log-out", value: "Log out", onClick: logout },
36-
],
37-
};
38-
39-
const navBarItems = [
40-
{
41-
value: "Home",
42-
to: "/",
43-
icon: "home",
44-
//LinkComponent: withRouter(NavLink),
45-
useExact: true,
46-
},
47-
{
48-
value: "Interface",
49-
icon: "box",
50-
subItems: [
51-
{
52-
value: "Cards Design",
53-
to: "/cards",
54-
//LinkComponent: withRouter(NavLink),
55-
},
56-
//{ value: "Charts", to: "/charts", LinkComponent: withRouter(NavLink) },
57-
{
58-
value: "Pricing Cards",
59-
to: "/pricing-cards",
60-
//LinkComponent: withRouter(NavLink),
61-
},
62-
],
63-
},
64-
{
65-
value: "Components",
66-
icon: "calendar",
67-
/*
68-
subItems: [
69-
{ value: "Maps", to: "/maps", LinkComponent: withRouter(NavLink) },
70-
{ value: "Icons", to: "/icons", LinkComponent: withRouter(NavLink) },
71-
{ value: "Store", to: "/store", LinkComponent: withRouter(NavLink) },
72-
{ value: "Blog", to: "/blog", LinkComponent: withRouter(NavLink) },
73-
],
74-
*/
75-
},
76-
{
77-
value: "Pages",
78-
icon: "file",
79-
subItems: [
80-
{
81-
value: "Profile",
82-
to: "/profile",
83-
//LinkComponent: withRouter(NavLink),
84-
},
85-
//{ value: "Login", to: "/login", LinkComponent: withRouter(NavLink) },
86-
{
87-
value: "Register",
88-
to: "/register",
89-
//LinkComponent: withRouter(NavLink),
90-
},
91-
{
92-
value: "Forgot password",
93-
to: "/forgot-password",
94-
//LinkComponent: withRouter(NavLink),
95-
},
96-
{
97-
value: "Empty page",
98-
to: "/empty-page",
99-
//LinkComponent: withRouter(NavLink),
100-
},
101-
//{ value: "RTL", to: "/rtl", LinkComponent: withRouter(NavLink) },
102-
],
103-
},
104-
{
105-
value: "Forms",
106-
to: "/form-elements",
107-
icon: "check-square",
108-
//LinkComponent: withRouter(NavLink),
109-
},
110-
{
111-
value: "Gallery",
112-
to: "/gallery",
113-
icon: "image",
114-
//LinkComponent: withRouter(NavLink),
115-
},
116-
{
117-
icon: "file-text",
118-
value: "Documentation",
119-
to:
120-
process.env.NODE_ENV === "production"
121-
? "https://tabler.github.io/tabler-react/documentation"
122-
: "/documentation",
123-
},
124-
];
125-
12628
return (
127-
<Site.Wrapper
128-
headerProps={{
129-
href: "/",
130-
alt: "Nginx Proxy Manager",
131-
imageURL: "/images/logo-bold-horizontal-grey.svg",
132-
accountDropdown: accountDropdownProps,
133-
}}
134-
navProps={{ itemsObjects: navBarItems }}
135-
//routerContextComponentType={withRouter(RouterContextProvider)}
136-
footerProps={{
137-
links: [
138-
<a href="#asd">First Link</a>,
139-
<a href="#fg">Second Link</a>,
140-
<a href="#dsg">Third Link</a>,
141-
<a href="#egf">Fourth Link</a>,
142-
<a href="#dsf">Five Link</a>,
143-
<a href="#sdfg">Sixth Link</a>,
144-
<a href="#sdf">Seventh Link</a>,
145-
<a href="#sdf">Eigth Link</a>,
146-
],
147-
note: "Premium and Open Source dashboard template with responsive and high quality UI. For Free!",
148-
copyright: (
149-
<React.Fragment>
150-
Copyright © 2019
151-
<a href="."> Tabler-react</a>. Theme by
152-
<a
153-
href="https://codecalm.net"
154-
target="_blank"
155-
rel="noopener noreferrer">
156-
{" "}
157-
codecalm.net
158-
</a>{" "}
159-
All rights reserved.
160-
</React.Fragment>
161-
),
162-
nav: (
163-
<React.Fragment>
164-
<Grid.Col auto={true}>
165-
<List className="list-inline list-inline-dots mb-0">
166-
<List.Item className="list-inline-item">
167-
<a href="./docs/index.html">Documentation</a>
168-
</List.Item>
169-
<List.Item className="list-inline-item">
170-
<a href="./faq.html">FAQ</a>
171-
</List.Item>
172-
</List>
173-
</Grid.Col>
174-
<Grid.Col auto={true}>
175-
<Button
176-
href="https://github.com/tabler/tabler-react"
177-
size="sm"
178-
outline
179-
color="primary"
180-
RootComponent="a">
181-
Source code
182-
</Button>
183-
</Grid.Col>
184-
</React.Fragment>
185-
),
186-
}}>
187-
<StyledContainer>{children}</StyledContainer>
29+
<div className="wrapper">
30+
<Navigation.Header
31+
theme="light"
32+
brandContent={
33+
<a href=".">
34+
<img
35+
src="/images/logo-bold-horizontal-grey.svg"
36+
alt="Nginx Proxy Manager"
37+
className="navbar-brand-image"
38+
height="32"
39+
/>
40+
</a>
41+
}
42+
avatar={<Avatar size="sm" url={user.gravatarUrl} />}
43+
profileName={user.nickname}
44+
profileSubName={
45+
user.roles.includes("admin") ? "Administrator" : "Standard User"
46+
}
47+
profileItems={[
48+
<Dropdown.Item key="m1-1">Set status</Dropdown.Item>,
49+
<Dropdown.Item key="m1-2">Profile &amp; account</Dropdown.Item>,
50+
<Dropdown.Item key="m1-3">Feedback</Dropdown.Item>,
51+
<Dropdown.Item divider key="m1-4" />,
52+
<Dropdown.Item key="m1-5">Settings</Dropdown.Item>,
53+
<Dropdown.Item key="m1-6" onClick={logout}>
54+
Logout
55+
</Dropdown.Item>,
56+
]}
57+
/>
58+
<Navigation.Menu
59+
theme="light"
60+
className="mb-3"
61+
items={[
62+
{
63+
title: "Home",
64+
icon: <Home />,
65+
active: true,
66+
},
67+
{
68+
title: "Hosts",
69+
icon: <DeviceDesktop />,
70+
},
71+
{
72+
title: "Access Lists",
73+
icon: <Lock />,
74+
},
75+
{
76+
title: "Certificates",
77+
icon: <Shield />,
78+
},
79+
{
80+
title: "Users",
81+
icon: <Users />,
82+
},
83+
{
84+
title: "Audit Log",
85+
icon: <Book />,
86+
},
87+
{
88+
title: "Settings",
89+
icon: <Settings />,
90+
},
91+
]}
92+
/>
93+
94+
<div className="content">
95+
<div className="container-xl">
96+
<StyledContainer>{children}</StyledContainer>
97+
</div>
98+
</div>
18899
<Footer fixed />
189-
</Site.Wrapper>
100+
</div>
190101
);
191102
}
192103

0 commit comments

Comments
 (0)