- Introduced DashboardOverviewPage and DashboardOverviewFlexColumns components to streamline the layout and management of dashboard sections, improving overall organization and usability. - Replaced individual collapsible sections in Finance, Inventory, Production, and Sales overviews with a unified structure, enhancing maintainability and consistency across the dashboard. - Added ActionsButton component for improved action handling and keyboard shortcuts, enhancing user interaction capabilities. - Updated styles in App.css to support new drag-and-drop functionality and layout features, ensuring a cohesive visual experience. - Refactored existing components to utilize the new structure, improving code clarity and reducing redundancy.
44 lines
966 B
JavaScript
44 lines
966 B
JavaScript
import { Dropdown, Button } from 'antd'
|
|
import PropTypes from 'prop-types'
|
|
import KeyboardShortcut from './KeyboardShortcut'
|
|
|
|
const ActionsButton = ({
|
|
menu = { items: [] },
|
|
onOpenModal,
|
|
disabled = false,
|
|
buttonProps = {},
|
|
...dropdownProps
|
|
}) => {
|
|
const handleOpenModal = () => {
|
|
if (disabled || !onOpenModal) return
|
|
onOpenModal()
|
|
}
|
|
|
|
return (
|
|
<KeyboardShortcut shortcut='alt+a' onTrigger={handleOpenModal}>
|
|
<Dropdown
|
|
menu={menu}
|
|
trigger={onOpenModal ? undefined : ['click']}
|
|
{...dropdownProps}
|
|
>
|
|
<Button
|
|
{...buttonProps}
|
|
disabled={disabled}
|
|
onClick={onOpenModal ? handleOpenModal : undefined}
|
|
>
|
|
Actions
|
|
</Button>
|
|
</Dropdown>
|
|
</KeyboardShortcut>
|
|
)
|
|
}
|
|
|
|
ActionsButton.propTypes = {
|
|
menu: PropTypes.object,
|
|
onOpenModal: PropTypes.func,
|
|
disabled: PropTypes.bool,
|
|
buttonProps: PropTypes.object
|
|
}
|
|
|
|
export default ActionsButton
|