mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-13 03:13:47 +00:00
0fea4064c3
* chore: upgrade relevant libraries * feat(skip): add skip styling to paginated items * chore: upgrade relevant libraries * Fix: issue with text colour (#214) * fix: adjust text colour from context * fix: issue with wrong proptype * fix issue with vite migration (#217) * hotfix: 1.8.2 issues vite migration * fix: file import options * feat(55): styling * refactor: remove onhover option for entry block * refactor: relocate logging provider * refactor: convert to typescript * feat(55): add event editor * refactor: extract event actions * fix: bad import * feat(55): redesign components * fix: issues with not awaiting async * refactor: replace socket with subscription * refactor: remove unused * style: small tweaks * refactor: extract event actions * refactor: cleanup debug * refactor: chakra imports * fix: optimistic mutations * refactor: handle promise rejections * refactor: validation * fix: rq optimistic mutations * feat: add playback feedback to block * refactor: no optimistic adding of events * refactor: simplify cursor state * styles: cleanup editor style * refactor: cleanup duration update * fix: revert package upgrade (issues with vitest) * fix: prevent cyclic imports * refactor: extract data fetcher * refactor: typescript migration * chore: update tests
89 lines
2.4 KiB
React
89 lines
2.4 KiB
React
import {
|
|
Divider,
|
|
IconButton,
|
|
Menu,
|
|
MenuButton,
|
|
MenuItem,
|
|
MenuList,
|
|
Tooltip,
|
|
} from '@chakra-ui/react';
|
|
import { FiMinusCircle } from '@react-icons/all-files/fi/FiMinusCircle';
|
|
import { FiPlus } from '@react-icons/all-files/fi/FiPlus';
|
|
import { FiTrash2 } from '@react-icons/all-files/fi/FiTrash2';
|
|
import { IoDuplicateOutline } from '@react-icons/all-files/io5/IoDuplicateOutline';
|
|
import { IoTimerOutline } from '@react-icons/all-files/io5/IoTimerOutline';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { tooltipDelayMid } from '../../../../ontimeConfig';
|
|
|
|
|
|
export default function EventBlockActionMenu(props) {
|
|
const { showAdd, showDelay, showBlock, showClone, actionHandler } = props;
|
|
|
|
const menuStyle = {
|
|
color: '#000000',
|
|
backgroundColor: 'rgba(255,255,255,1)',
|
|
};
|
|
|
|
const blockBtnStyle = {
|
|
size: 'sm',
|
|
colorScheme: 'blue',
|
|
variant: 'outline',
|
|
borderRadius: '3px',
|
|
};
|
|
|
|
return (
|
|
<Menu isLazy lazyBehavior='unmount'>
|
|
<Tooltip label='Add ...' delay={tooltipDelayMid}>
|
|
<MenuButton as={IconButton} aria-label='Options' icon={<FiPlus />}
|
|
tabIndex={-1} {...blockBtnStyle} />
|
|
</Tooltip>
|
|
<MenuList style={menuStyle}>
|
|
<MenuItem icon={<FiPlus />} onClick={() => actionHandler('event')} isDisabled={!showAdd}>
|
|
Add Event after
|
|
</MenuItem>
|
|
<MenuItem
|
|
icon={<IoTimerOutline />}
|
|
onClick={() => actionHandler('delay')}
|
|
isDisabled={!showDelay}
|
|
>
|
|
Add Delay after
|
|
</MenuItem>
|
|
<MenuItem
|
|
icon={<FiMinusCircle />}
|
|
onClick={() => actionHandler('block')}
|
|
isDisabled={!showBlock}
|
|
>
|
|
Add Block after
|
|
</MenuItem>
|
|
{showClone && (
|
|
<MenuItem
|
|
icon={<IoDuplicateOutline />}
|
|
onClick={() => actionHandler('clone')}
|
|
isDisabled={!showBlock}
|
|
>
|
|
Clone event
|
|
</MenuItem>
|
|
)}
|
|
<Divider />
|
|
<MenuItem
|
|
icon={<FiTrash2 />}
|
|
onClick={() => actionHandler('delete')}
|
|
isDisabled={!showBlock}
|
|
color='red.500'
|
|
>
|
|
Delete event
|
|
</MenuItem>
|
|
</MenuList>
|
|
</Menu>
|
|
);
|
|
}
|
|
|
|
EventBlockActionMenu.propTypes = {
|
|
showAdd: PropTypes.bool,
|
|
showDelay: PropTypes.bool,
|
|
showBlock: PropTypes.bool,
|
|
showClone: PropTypes.bool,
|
|
actionHandler: PropTypes.func,
|
|
};
|