From 164b76fad806b078aad8c537ba9bdcfbfc757dca Mon Sep 17 00:00:00 2001 From: physcik Date: Tue, 5 May 2026 11:39:54 +0500 Subject: css changes + error handling --- front/src/App.tsx | 10 ++++++-- front/src/Authentication/ForbiddenPage.tsx | 15 ++++++++++++ front/src/Authentication/LoginPage.tsx | 18 ++++++++------- front/src/Authentication/RegisterPage.tsx | 17 ++++++++++---- front/src/Authentication/style.css | 32 ++++++++++++++++++++++++++ front/src/Emelents/Elements.css | 1 - front/src/ErrorHandler.tsx | 37 ++++++++++++++++++++++++++++++ front/src/Fonts.css | 5 ++++ front/src/Locales/en_US.ts | 5 ++++ front/src/Locales/ru_RU.ts | 9 +++++++- front/src/Pages/RangedWeapon.tsx | 15 ++++++++++-- 11 files changed, 145 insertions(+), 19 deletions(-) create mode 100644 front/src/Authentication/ForbiddenPage.tsx create mode 100644 front/src/Authentication/style.css create mode 100644 front/src/ErrorHandler.tsx diff --git a/front/src/App.tsx b/front/src/App.tsx index 7b68f3e..da9cbfd 100644 --- a/front/src/App.tsx +++ b/front/src/App.tsx @@ -10,17 +10,19 @@ import { useEffect, useState } from 'react'; import { ReadCurrentLocale, SaveCurrentLocale } from './Locales/Locales'; import LegalNote from './Emelents/LegalNote'; import WeaponsIndex from './Pages/Weapons'; -import RangedWeaponPage from './Pages/RangedWeapon'; -import { AuthContext, Authentication, GetUserInfo } from './Authentication/ContextProvider'; +import { AuthContext, GetUserInfo } from './Authentication/ContextProvider'; import { useCookies } from 'react-cookie'; import LoginPage from './Authentication/LoginPage'; import LogoutPage from './Authentication/LogoutPage'; import { User } from './Authentication/Models'; import RegisterPage from './Authentication/RegisterPage'; +import { EditRangedWeaponPage, RangedWeaponPage } from './Pages/RangedWeapon'; +import ErrorHandler from './ErrorHandler'; const router = createBrowserRouter([ { index: true, + errorElement: (), element: (), }, { @@ -35,6 +37,10 @@ const router = createBrowserRouter([ path: "/weapons/:id", element: (), }, + { + path: "/weapons/:id/edit", + element: (), + }, // auth { diff --git a/front/src/Authentication/ForbiddenPage.tsx b/front/src/Authentication/ForbiddenPage.tsx new file mode 100644 index 0000000..477940d --- /dev/null +++ b/front/src/Authentication/ForbiddenPage.tsx @@ -0,0 +1,15 @@ +import { useContext } from "react"; +import { LanguageContext } from "../Locales/Context"; +import { GetLocalizedString } from "../Locales/Locales"; + +function ForbidenPage() { + const lang = useContext(LanguageContext); + return ( +
+

{ GetLocalizedString("Forbidden", lang) }

+

{ GetLocalizedString("*forbidden*", lang) }

+
+ ); +} + +export default ForbidenPage; diff --git a/front/src/Authentication/LoginPage.tsx b/front/src/Authentication/LoginPage.tsx index e673418..7a555fe 100644 --- a/front/src/Authentication/LoginPage.tsx +++ b/front/src/Authentication/LoginPage.tsx @@ -28,20 +28,22 @@ function LoginPage() { return (
-

{ GetLocalizedString("Username", lang) }

- setUsername(ev.target.value)} /> -

{ GetLocalizedString("Password", lang) }

- setPassw(ev.target.value)} /> - - - -

Don't have an account? Click here.

); } diff --git a/front/src/Authentication/RegisterPage.tsx b/front/src/Authentication/RegisterPage.tsx index 5c818f6..10864cd 100644 --- a/front/src/Authentication/RegisterPage.tsx +++ b/front/src/Authentication/RegisterPage.tsx @@ -1,3 +1,4 @@ +import './style.css'; import axios, { AxiosError } from "axios"; import { useContext, useState } from "react"; import { useNavigate } from "react-router"; @@ -30,10 +31,15 @@ function RegisterPage() { return (
-

{ GetLocalizedString("Username", lang) }

- setUsername(ev.target.value)} /> -

{ GetLocalizedString("Password", lang) }

- setPassw(ev.target.value)} /> +
+

{ GetLocalizedString("Username", lang) }

+ setUsername(ev.target.value)} /> +
+

{ GetLocalizedString("*security-warning*", lang) }

+
+

{ GetLocalizedString("Password", lang) }

+ setPassw(ev.target.value)} /> +