forked from ddrilling/asb_cloud_front
Исправлена кнопка входа/выхода с админки
This commit is contained in:
parent
58cc1dc714
commit
f17d39318c
@ -9,9 +9,9 @@ type LayoutPortalProps = {
|
|||||||
|
|
||||||
export const AdminLayoutPortal: React.FC<LayoutPortalProps> = ({title, ...props}) => (
|
export const AdminLayoutPortal: React.FC<LayoutPortalProps> = ({title, ...props}) => (
|
||||||
<Layout.Content>
|
<Layout.Content>
|
||||||
<PageHeader title={title}>
|
<PageHeader isAdmin title={title} style={{ backgroundColor: '#900' }}>
|
||||||
<Button size={'large'}>
|
<Button size={'large'}>
|
||||||
<Link to={'/'}>Вернуться на основной сайт</Link>
|
<Link to={'/'}>Вернуться на сайт</Link>
|
||||||
</Button>
|
</Button>
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
<Layout>
|
<Layout>
|
||||||
|
@ -5,19 +5,21 @@ import { UserMenu } from './UserMenu'
|
|||||||
import logo from '../images/logo_32.png'
|
import logo from '../images/logo_32.png'
|
||||||
|
|
||||||
type PageHeaderProps = {
|
type PageHeaderProps = {
|
||||||
children?: React.ReactNode
|
|
||||||
title?: string
|
title?: string
|
||||||
|
isAdmin?: boolean
|
||||||
|
children?: React.ReactNode
|
||||||
|
[other: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PageHeader: React.FC<PageHeaderProps> = ({ children, title = 'Мониторинг' }) => (
|
export const PageHeader: React.FC<PageHeaderProps> = ({ title = 'Мониторинг', isAdmin, children, ...other }) => (
|
||||||
<Layout>
|
<Layout>
|
||||||
<Layout.Header className={'header'}>
|
<Layout.Header className={'header'} {...other}>
|
||||||
<Link to={'/'} style={{ height: headerHeight }}>
|
<Link to={'/'} style={{ height: headerHeight }}>
|
||||||
<img src={logo} alt={'АСБ'} className={'logo'}/>
|
<img src={logo} alt={'АСБ'} className={'logo'}/>
|
||||||
</Link>
|
</Link>
|
||||||
{children}
|
{children}
|
||||||
<h1 className={'title'}>{title}</h1>
|
<h1 className={'title'}>{title}</h1>
|
||||||
<UserMenu />
|
<UserMenu isAdmin={isAdmin} />
|
||||||
</Layout.Header>
|
</Layout.Header>
|
||||||
</Layout>
|
</Layout>
|
||||||
)
|
)
|
||||||
|
@ -16,7 +16,11 @@ const handleLogout = () => {
|
|||||||
|
|
||||||
const formLayout: FormProps = { labelCol: { span: 11 }, wrapperCol: { span: 16 } }
|
const formLayout: FormProps = { labelCol: { span: 11 }, wrapperCol: { span: 16 } }
|
||||||
|
|
||||||
export const UserMenu: React.FC = () => {
|
type UserMenuProps = {
|
||||||
|
isAdmin?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export const UserMenu: React.FC<UserMenuProps> = ({ isAdmin }) => {
|
||||||
const [form] = useForm()
|
const [form] = useForm()
|
||||||
const [isModalVisible, setIsModalVisible] = useState<boolean>(false)
|
const [isModalVisible, setIsModalVisible] = useState<boolean>(false)
|
||||||
const [showLoader, setShowLoader] = useState<boolean>(false)
|
const [showLoader, setShowLoader] = useState<boolean>(false)
|
||||||
@ -50,7 +54,11 @@ export const UserMenu: React.FC = () => {
|
|||||||
overlay={(
|
overlay={(
|
||||||
<Menu style={{ textAlign: 'right' }}>
|
<Menu style={{ textAlign: 'right' }}>
|
||||||
<PrivateMenuItem roles={['admin']}>
|
<PrivateMenuItem roles={['admin']}>
|
||||||
<Link to={'/admin'} onClick={() => {}}>Панель администратора</Link>
|
{isAdmin ? (
|
||||||
|
<Link to={'/'}>Вернуться на сайт</Link>
|
||||||
|
) : (
|
||||||
|
<Link to={'/admin'}>Панель администратора</Link>
|
||||||
|
)}
|
||||||
</PrivateMenuItem>
|
</PrivateMenuItem>
|
||||||
<Menu.Item>
|
<Menu.Item>
|
||||||
<Link to={'/'} onClick={onChangePasswordClick}>Сменить пароль</Link>
|
<Link to={'/'} onClick={onChangePasswordClick}>Сменить пароль</Link>
|
||||||
|
Loading…
Reference in New Issue
Block a user