mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 13:00:39 +03:00
Remove redundant message component
This commit is contained in:
parent
a6afc08b2b
commit
3902ef189a
|
@ -1,11 +0,0 @@
|
||||||
interface InfoMessageProps {
|
|
||||||
message: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export function InfoMessage({ message }: InfoMessageProps) {
|
|
||||||
return (
|
|
||||||
<p className='font-bold'>{ message }</p>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default InfoMessage;
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { useAuth } from '../context/AuthContext';
|
import { useAuth } from '../context/AuthContext';
|
||||||
import TextURL from './Common/TextURL';
|
import TextURL from './Common/TextURL';
|
||||||
import InfoMessage from './InfoMessage';
|
|
||||||
|
|
||||||
interface RequireAuthProps {
|
interface RequireAuthProps {
|
||||||
children: React.ReactNode
|
children: React.ReactNode
|
||||||
|
@ -13,12 +12,12 @@ function RequireAuth({ children }: RequireAuthProps) {
|
||||||
<>
|
<>
|
||||||
{user && children}
|
{user && children}
|
||||||
{!user &&
|
{!user &&
|
||||||
<div className='flex flex-col items-center'>
|
<div className='flex flex-col items-center mt-2 gap-1'>
|
||||||
<InfoMessage message={'Данная функция доступна только зарегистрированным пользователям. Пожалуйста войдите в систему'} />
|
<p><b>Данная страница доступна только зарегистрированным пользователям</b></p>
|
||||||
<div className='flex flex-col items-start'>
|
<p className='mb-2'>Пожалуйста войдите в систему</p>
|
||||||
<TextURL text='Войти в систему...' href='/login' />
|
<TextURL text='Войти в систему' href='/login'/>
|
||||||
<TextURL text='Зарегистрироваться...' href='/signup' />
|
<TextURL text='Зарегистрироваться' href='/signup'/>
|
||||||
</div>
|
<TextURL text='Начальная страница' href='/'/>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -6,7 +6,6 @@ import Form from '../components/Common/Form';
|
||||||
import SubmitButton from '../components/Common/SubmitButton';
|
import SubmitButton from '../components/Common/SubmitButton';
|
||||||
import TextInput from '../components/Common/TextInput';
|
import TextInput from '../components/Common/TextInput';
|
||||||
import TextURL from '../components/Common/TextURL';
|
import TextURL from '../components/Common/TextURL';
|
||||||
import InfoMessage from '../components/InfoMessage';
|
|
||||||
import { useAuth } from '../context/AuthContext';
|
import { useAuth } from '../context/AuthContext';
|
||||||
import { IUserLoginData } from '../utils/models';
|
import { IUserLoginData } from '../utils/models';
|
||||||
|
|
||||||
|
@ -41,7 +40,7 @@ function LoginPage() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='w-full py-2'> { user
|
<div className='w-full py-2'> { user
|
||||||
? <InfoMessage message={`Вы вошли в систему как ${user.username}`} />
|
? <b>{`Вы вошли в систему как ${user.username}`}</b>
|
||||||
: <Form title='Ввод данных пользователя' onSubmit={handleSubmit} widthClass='w-[20rem]'>
|
: <Form title='Ввод данных пользователя' onSubmit={handleSubmit} widthClass='w-[20rem]'>
|
||||||
<TextInput id='username'
|
<TextInput id='username'
|
||||||
label='Имя пользователя'
|
label='Имя пользователя'
|
||||||
|
|
|
@ -6,7 +6,6 @@ import BackendError from '../components/BackendError';
|
||||||
import Form from '../components/Common/Form';
|
import Form from '../components/Common/Form';
|
||||||
import SubmitButton from '../components/Common/SubmitButton';
|
import SubmitButton from '../components/Common/SubmitButton';
|
||||||
import TextInput from '../components/Common/TextInput';
|
import TextInput from '../components/Common/TextInput';
|
||||||
import InfoMessage from '../components/InfoMessage';
|
|
||||||
import { useAuth } from '../context/AuthContext';
|
import { useAuth } from '../context/AuthContext';
|
||||||
import { type IUserSignupData } from '../utils/models';
|
import { type IUserSignupData } from '../utils/models';
|
||||||
|
|
||||||
|
@ -46,7 +45,7 @@ function RegisterPage() {
|
||||||
return (
|
return (
|
||||||
<div className='w-full py-2'>
|
<div className='w-full py-2'>
|
||||||
{ user &&
|
{ user &&
|
||||||
<InfoMessage message={`Вы вошли в систему как ${user.username}. Если хотите зарегистрировать нового пользователя, выйдите из системы (меню в правом верхнем углу экрана)`} /> }
|
<b>{`Вы вошли в систему как ${user.username}. Если хотите зарегистрировать нового пользователя, выйдите из системы (меню в правом верхнем углу экрана)`}</b>}
|
||||||
{ !user &&
|
{ !user &&
|
||||||
<Form title='Регистрация пользователя' onSubmit={handleSubmit}>
|
<Form title='Регистрация пользователя' onSubmit={handleSubmit}>
|
||||||
<TextInput id='username' label='Имя пользователя' type='text'
|
<TextInput id='username' label='Имя пользователя' type='text'
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import InfoMessage from '../components/InfoMessage';
|
|
||||||
|
|
||||||
function RestorePasswordPage() {
|
function RestorePasswordPage() {
|
||||||
return (
|
return (
|
||||||
<InfoMessage message='Функционал автоматического восстановления пароля не доступен. Обратитесь в адинистратору' />
|
<b>Функционал автоматического восстановления пароля не доступен. Обратитесь в адинистратору</b>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user