Enhance UserProfilePopover component by adding a Card wrapper for the user icon, improving visual presentation and layout. Refactor icon action filtering for better readability.
Some checks failed
farmcontrol/farmcontrol-ui/pipeline/head There was a failure building this commit
Some checks failed
farmcontrol/farmcontrol-ui/pipeline/head There was a failure building this commit
This commit is contained in:
parent
b5dd009d1a
commit
835db6e49f
@ -1,6 +1,6 @@
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { createElement } from 'react'
|
import { createElement } from 'react'
|
||||||
import { Flex, Typography, Button, Space, Dropdown, Divider } from 'antd'
|
import { Flex, Typography, Button, Space, Dropdown, Divider, Card } from 'antd'
|
||||||
import { UserOutlined } from '@ant-design/icons'
|
import { UserOutlined } from '@ant-design/icons'
|
||||||
import { useContext } from 'react'
|
import { useContext } from 'react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
@ -17,7 +17,9 @@ const UserProfilePopover = ({ onClose }) => {
|
|||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
|
||||||
const modelActions = User.actions || []
|
const modelActions = User.actions || []
|
||||||
const iconActions = modelActions.filter((a) => ICON_ACTION_NAMES.includes(a.name))
|
const iconActions = modelActions.filter((a) =>
|
||||||
|
ICON_ACTION_NAMES.includes(a.name)
|
||||||
|
)
|
||||||
const dropdownActions = modelActions.filter(
|
const dropdownActions = modelActions.filter(
|
||||||
(a) => !ICON_ACTION_NAMES.includes(a.name)
|
(a) => !ICON_ACTION_NAMES.includes(a.name)
|
||||||
)
|
)
|
||||||
@ -96,9 +98,20 @@ const UserProfilePopover = ({ onClose }) => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
|
<Card
|
||||||
|
style={{ borderRadius: '5px', width: 76, height: 76 }}
|
||||||
|
styles={{ body: { padding: 0, height: '100%' } }}
|
||||||
|
>
|
||||||
|
<Flex justify='center' align='center' style={{ height: '100%' }}>
|
||||||
<UserOutlined
|
<UserOutlined
|
||||||
style={{ fontSize: 48, color: 'var(--color-text-secondary)' }}
|
style={{
|
||||||
|
fontSize: 32,
|
||||||
|
color: 'var(--color-text-secondary)',
|
||||||
|
marginBottom: 2
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
|
</Flex>
|
||||||
|
</Card>
|
||||||
)}
|
)}
|
||||||
<Flex vertical style={{ minWidth: 0 }}>
|
<Flex vertical style={{ minWidth: 0 }}>
|
||||||
{fullName && (
|
{fullName && (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user