diff --git a/package.json b/package.json
index ce48768..ac76b68 100644
--- a/package.json
+++ b/package.json
@@ -33,7 +33,6 @@
"@vitejs/plugin-react": "^4.1.1",
"@vitejs/plugin-react-swc": "^3.5.0",
"antd": "5.15.3",
- "antd-style": "3.6.2-beta.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^8.8.0",
"eslint-import-resolver-typescript": "^3.5.5",
diff --git a/src/components/App.tsx b/src/components/App.tsx
index 53f4510..676c7c5 100644
--- a/src/components/App.tsx
+++ b/src/components/App.tsx
@@ -16,7 +16,6 @@ function App() {
-
)
}
diff --git a/src/components/ErrorPage/error.scss b/src/components/ErrorPage/error.scss
new file mode 100644
index 0000000..e50083a
--- /dev/null
+++ b/src/components/ErrorPage/error.scss
@@ -0,0 +1,5 @@
+.error-page {
+ min-height: 100vh;
+ display: flex;
+ justify-content: center
+}
\ No newline at end of file
diff --git a/src/components/ErrorPage/index.tsx b/src/components/ErrorPage/index.tsx
new file mode 100644
index 0000000..e17d945
--- /dev/null
+++ b/src/components/ErrorPage/index.tsx
@@ -0,0 +1,9 @@
+const ErrorPage = () => {
+
+ return (
+
+ );
+};
+export default ErrorPage;
diff --git a/src/pages/Layout/index.tsx b/src/components/Layout/index.tsx
similarity index 98%
rename from src/pages/Layout/index.tsx
rename to src/components/Layout/index.tsx
index 6d27624..66f5e47 100644
--- a/src/pages/Layout/index.tsx
+++ b/src/components/Layout/index.tsx
@@ -1,7 +1,7 @@
import {useEffect, useState} from "react";
import {Navigate, Outlet, useNavigate} from 'react-router-dom';
import {Menu} from 'antd';
-import Header from "../../components/Header";
+import Header from "../Header";
import useRole from "../../hooks/useRole.tsx";
import {PermissionKeys} from "../../types/roles.type.ts";
import {MenuItemKeys, menuKeys} from "../../types/layout.type.ts";
diff --git a/src/pages/Layout/layout.scss b/src/components/Layout/layout.scss
similarity index 100%
rename from src/pages/Layout/layout.scss
rename to src/components/Layout/layout.scss
diff --git a/src/components/Main/index.tsx b/src/components/Main/index.tsx
index d28d1b2..2e65aa1 100644
--- a/src/components/Main/index.tsx
+++ b/src/components/Main/index.tsx
@@ -7,19 +7,20 @@ const Main = () => {
const {hasPermission} = useRole();
const { useToken } = theme;
const { token } = useToken();
+
const isPageAvailable = hasPermission(PermissionKeys.user_view);
return (
-
- {isPageAvailable &&
+ {isPageAvailable &&
Border
}
Проверка шрифтов
- Primary
+ Primary
);
};
+
export default Main;
diff --git a/src/components/PrivateRoute/index.tsx b/src/components/PrivateRoute/index.tsx
index f818da5..bb08819 100644
--- a/src/components/PrivateRoute/index.tsx
+++ b/src/components/PrivateRoute/index.tsx
@@ -5,14 +5,13 @@ import {routePaths} from "../../constants/routes.ts";
function PrivateRoute() {
const location = useLocation();
-
const userToken = LocalStorage.get(localStorageKeys.USER_TOKEN);
if (!userToken) {
- LocalStorage.set('prevUrl', location.pathname)
+ LocalStorage.set('redirectUrl', location.pathname)
return (
diff --git a/src/components/Routers/index.tsx b/src/components/Routers/index.tsx
index c6656c3..581c1a7 100644
--- a/src/components/Routers/index.tsx
+++ b/src/components/Routers/index.tsx
@@ -1,9 +1,10 @@
import {Route, Routes} from 'react-router-dom';
import {App} from 'antd';
-import Layout from "../../pages/Layout";
import HomePages from "../../pages/HomePage";
-import Test from "../Test/Test.tsx";
+import ErrorPage from "../ErrorPage";
import PrivateRoute from "../PrivateRoute";
+import LoginPage from "../../pages/LoginPage";
+import Layout from "../Layout";
function Routers() {
@@ -13,10 +14,10 @@ function Routers() {
}>
}>
}/>
- }/>
- }/>
+ }/>
+ }/>
)
diff --git a/src/components/Test/Test.tsx b/src/components/Test/Test.tsx
deleted file mode 100644
index 7f3076d..0000000
--- a/src/components/Test/Test.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-import {useTheme} from 'antd-style';
-import {useEffect} from "react";
-import {routePaths} from "../../constants/routes.ts";
-import useRole from "../../hooks/useRole.tsx";
-import {PermissionKeys} from "../../types/roles.type.ts";
-import {useNavigate} from "react-router-dom";
-
-
-const Test = () => {
- const theme = useTheme();
- const {role, hasPermission} = useRole();
- const navigate = useNavigate();
-
- const isPageAvailable = hasPermission(PermissionKeys.admin_view);
-
- useEffect(() => {
- if (!role) {
- navigate(routePaths.home);
- }
- }, [role]);
-
- useEffect(() => {
- if (!isPageAvailable) {
- navigate(routePaths.home);
- }
- }, [isPageAvailable]);
- return (
-
-
-
fgdegjhjflefkegjvhecdhejqhdkefke
-
- );
-};
-export default Test;
diff --git a/src/constants/routes.ts b/src/constants/routes.ts
index b94ebb8..afd5f99 100644
--- a/src/constants/routes.ts
+++ b/src/constants/routes.ts
@@ -2,9 +2,11 @@ type RoutePaths =
| 'home'
| 'notFound'
| 'error'
+ | 'login'
export const routePaths: Record = {
home: '/',
error: '/error',
notFound: '*',
+ login: '/login'
};
diff --git a/src/index.css b/src/index.css
index 6119ad9..cb5c9ef 100644
--- a/src/index.css
+++ b/src/index.css
@@ -49,10 +49,6 @@ button {
button:hover {
border-color: #646cff;
}
-button:focus,
-button:focus-visible {
- outline: 4px auto -webkit-focus-ring-color;
-}
@media (prefers-color-scheme: light) {
:root {
diff --git a/src/pages/LoginPage/index.tsx b/src/pages/LoginPage/index.tsx
new file mode 100644
index 0000000..6f03187
--- /dev/null
+++ b/src/pages/LoginPage/index.tsx
@@ -0,0 +1,20 @@
+import {useNavigate} from "react-router-dom";
+
+function LoginPage() {
+ const navigate = useNavigate();
+
+ return (
+
+ {
+ const url = localStorage.getItem('redirectUrl')
+ if (url) {
+ navigate(url)
+ localStorage.removeItem('redirectUrl')
+ }
+ }}>Зарегистрироваться
+
+
+ );
+}
+
+export default LoginPage;
\ No newline at end of file
diff --git a/src/pages/LoginPage/login.scss b/src/pages/LoginPage/login.scss
new file mode 100644
index 0000000..be452fd
--- /dev/null
+++ b/src/pages/LoginPage/login.scss
@@ -0,0 +1,4 @@
+.login-page {
+ display: flex;
+ justify-content: center
+}
\ No newline at end of file