diff --git a/rsconcept/frontend/src/App.tsx b/rsconcept/frontend/src/App.tsx index 9216037b..20b7c6ba 100644 --- a/rsconcept/frontend/src/App.tsx +++ b/rsconcept/frontend/src/App.tsx @@ -45,7 +45,7 @@ function Root() { overflowY: showScroll ? 'scroll': 'auto' }} > -
+
diff --git a/rsconcept/frontend/src/components/Common/Form.tsx b/rsconcept/frontend/src/components/Common/Form.tsx deleted file mode 100644 index b241968a..00000000 --- a/rsconcept/frontend/src/components/Common/Form.tsx +++ /dev/null @@ -1,24 +0,0 @@ -interface FormProps { - title?: string - className?: string - dimensions?: string - onSubmit: (event: React.FormEvent) => void - children: React.ReactNode -} - -function Form({ - title, className, onSubmit, - dimensions='max-w-xs', - children -}: FormProps) { - return ( -
- { title ?

{title}

: null } - {children} -
); -} - -export default Form; \ No newline at end of file diff --git a/rsconcept/frontend/src/components/Common/Overlay.tsx b/rsconcept/frontend/src/components/Common/Overlay.tsx index f1420172..7016f999 100644 --- a/rsconcept/frontend/src/components/Common/Overlay.tsx +++ b/rsconcept/frontend/src/components/Common/Overlay.tsx @@ -1,4 +1,5 @@ interface OverlayProps { + id?: string children: React.ReactNode position?: string className?: string @@ -6,13 +7,13 @@ interface OverlayProps { } function Overlay({ - children, className, + id, children, className, position='top-0 right-0', layer='z-pop' }: OverlayProps) { return (
-
+
{children}
); diff --git a/rsconcept/frontend/src/components/Common/PDFViewer.tsx b/rsconcept/frontend/src/components/Common/PDFViewer.tsx index 2b09d3a8..6ca4169f 100644 --- a/rsconcept/frontend/src/components/Common/PDFViewer.tsx +++ b/rsconcept/frontend/src/components/Common/PDFViewer.tsx @@ -36,7 +36,9 @@ function PDFViewer({ navigateTo('/login/')); + } + + return ( +
+

{`Вы вошли в систему как ${user?.username ?? ''}`}

+
+ + | + + | + + | + + Выйти + +
+
); +} + +export default ExpectedAnonymous; diff --git a/rsconcept/frontend/src/pages/CreateRSFormPage.tsx b/rsconcept/frontend/src/pages/CreateRSFormPage.tsx index a1cca443..f138afcd 100644 --- a/rsconcept/frontend/src/pages/CreateRSFormPage.tsx +++ b/rsconcept/frontend/src/pages/CreateRSFormPage.tsx @@ -5,7 +5,6 @@ import { toast } from 'react-toastify'; import BackendError from '../components/BackendError'; import Button from '../components/Common/Button'; import Checkbox from '../components/Common/Checkbox'; -import Form from '../components/Common/Form'; import Label from '../components/Common/Label'; import MiniButton from '../components/Common/MiniButton'; import Overlay from '../components/Common/Overlay'; @@ -79,11 +78,11 @@ function CreateRSFormPage() { return ( -
-
+

Создание концептуальной схемы

setCommon(value ?? false)} /> -
+
{error ? : null} - -
+ ); } diff --git a/rsconcept/frontend/src/pages/LoginPage.tsx b/rsconcept/frontend/src/pages/LoginPage.tsx index d1d96dac..17ca83fe 100644 --- a/rsconcept/frontend/src/pages/LoginPage.tsx +++ b/rsconcept/frontend/src/pages/LoginPage.tsx @@ -3,14 +3,14 @@ import { useEffect, useState } from 'react'; import { useLocation } from 'react-router-dom'; import BackendError, { ErrorInfo } from '../components/BackendError'; -import Form from '../components/Common/Form'; import SubmitButton from '../components/Common/SubmitButton'; import TextInput from '../components/Common/TextInput'; import TextURL from '../components/Common/TextURL'; +import ExpectedAnonymous from '../components/ExpectedAnonymous'; import { useAuth } from '../context/AuthContext'; import { useConceptNavigation } from '../context/NagivationContext'; -import { useConceptTheme } from '../context/ThemeContext'; import { IUserLoginData } from '../models/library'; +import { resources } from '../utils/constants'; function ProcessError({error}: {error: ErrorInfo}): React.ReactElement { if (axios.isAxiosError(error) && error.response && error.response.status === 400) { @@ -25,11 +25,10 @@ function ProcessError({error}: {error: ErrorInfo}): React.ReactElement { } function LoginPage() { - const {mainHeight} = useConceptTheme(); const location = useLocation(); const { navigateTo, navigateHistory } = useConceptNavigation(); const search = useLocation().search; - const { user, login, logout, loading, error, setError } = useAuth(); + const { user, login, loading, error, setError } = useAuth(); const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); @@ -61,41 +60,17 @@ function LoginPage() { } } - function logoutAndRedirect() { - logout(() => navigateTo('/login/')); + if (user) { + return (); } - return ( -
- {user ? -
-

{`Вы вошли в систему как ${user.username}`}

-

- - | - - | - - | - - Выйти - -

-
: null} - {!user ? -
Концепт Портал
@@ -120,8 +96,7 @@ function LoginPage() {
{error ? : null} - : null} -
); + ); } export default LoginPage; diff --git a/rsconcept/frontend/src/pages/ManualsPage/ViewTopic.tsx b/rsconcept/frontend/src/pages/ManualsPage/ViewTopic.tsx index f694773d..5a0e38ac 100644 --- a/rsconcept/frontend/src/pages/ManualsPage/ViewTopic.tsx +++ b/rsconcept/frontend/src/pages/ManualsPage/ViewTopic.tsx @@ -7,7 +7,7 @@ interface ViewTopicProps { function ViewTopic({ topic }: ViewTopicProps) { return ( -
+
); } diff --git a/rsconcept/frontend/src/pages/NotFoundPage.tsx b/rsconcept/frontend/src/pages/NotFoundPage.tsx index 4b4cabef..2fab2811 100644 --- a/rsconcept/frontend/src/pages/NotFoundPage.tsx +++ b/rsconcept/frontend/src/pages/NotFoundPage.tsx @@ -2,7 +2,7 @@ import TextURL from '../components/Common/TextURL'; export function NotFoundPage() { return ( -
+

Ошибка 404 - Страница не найдена

Данная страница не существует или запрашиваемый объект отсутствует в базе данных

diff --git a/rsconcept/frontend/src/pages/RegisterPage.tsx b/rsconcept/frontend/src/pages/RegisterPage.tsx index 8b02674e..e01ba75d 100644 --- a/rsconcept/frontend/src/pages/RegisterPage.tsx +++ b/rsconcept/frontend/src/pages/RegisterPage.tsx @@ -5,13 +5,17 @@ import { toast } from 'react-toastify'; import BackendError from '../components/BackendError'; import Button from '../components/Common/Button'; import Checkbox from '../components/Common/Checkbox'; -import Form from '../components/Common/Form'; +import ConceptTooltip from '../components/Common/ConceptTooltip'; +import Overlay from '../components/Common/Overlay'; import SubmitButton from '../components/Common/SubmitButton'; import TextInput from '../components/Common/TextInput'; import TextURL from '../components/Common/TextURL'; +import ExpectedAnonymous from '../components/ExpectedAnonymous'; +import { HelpIcon } from '../components/Icons'; import { useAuth } from '../context/AuthContext'; import { useConceptNavigation } from '../context/NagivationContext'; import { type IUserSignupData } from '../models/library'; +import { globalIDs } from '../utils/constants'; function RegisterPage() { const location = useLocation(); @@ -57,80 +61,99 @@ function RegisterPage() { } } + if (user) { + return (); + } return ( -
- {user ? {`Вы вошли в систему как ${user.username}`} : null} - {!user ? -
- setUsername(event.target.value)} - /> - setPassword(event.target.value)} - /> - setPassword2(event.target.value)} - /> -
-

- используйте уникальный пароль

-

- портал функционирует в тестовом режиме

- {/*

- минимум 8 символов

-

- большие, маленькие буквы, цифры

-

- минимум 1 спец. символ

*/} -
- setEmail(event.target.value)} - /> - setFirstName(event.target.value)} - /> - setLastName(event.target.value)} - /> -
- +

Новый пользователь

+
+
+
+ + + + +

- используйте уникальный пароль

+

- портал функционирует в тестовом режиме

+
+
+ + setUsername(event.target.value)} /> - setPassword(event.target.value)} + /> + setPassword2(event.target.value)} />
-
- + setEmail(event.target.value)} /> -
- {error ? : null} - : null} -
); +
+ +
+ + +
+ +
+ +
+ {error ? : null} + ); } export default RegisterPage; diff --git a/rsconcept/frontend/src/utils/constants.ts b/rsconcept/frontend/src/utils/constants.ts index b2fde810..b55de862 100644 --- a/rsconcept/frontend/src/utils/constants.ts +++ b/rsconcept/frontend/src/utils/constants.ts @@ -29,7 +29,8 @@ export const EXTEOR_TRS_FILE = '.trs'; */ export const resources = { graph_font: '/DejaVu.ttf', - privacy_policy: '/privacy.pdf' + privacy_policy: '/privacy.pdf', + logo: '/logo_full.svg' }; /** @@ -59,6 +60,7 @@ export const urls = { * Global unique IDs. */ export const globalIDs = { + password_tooltip: 'password-tooltip', main_scroll: 'main-scroll', library_item_editor: 'library-item-editor', constituenta_editor: 'constituenta-editor'