mirror of
https://ghproxy.net/https://github.com/elementor/one-click-accessibility.git
synced 2026-07-22 12:27:13 +08:00
* [APP-1923] change remediation management (#411) * [APP-1988] Add tabs * [APP-1988][APP-1989] add tabs, remove menu item * [APP-1988][APP-1989] add tabs, remove menu item * [APP-1992] add empty state and tab navigation * [APP-1993][APP-1994] Change view for manage AI fixes, change delete confirmation modal * [APP-1996] add view for alt text fixes * [APP-1996] add edit for alt text fixes * [APP-1996] add edit for alt text fixes * [APP-1996] add edit for alt text fixes * [APP-1996] add edit for alt text fixes * [APP-1996] add edit for alt text fixes * [APP-1995] Color contrast form * [APP-2001] add global remediation logic (#415) * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2003] add disable across scans (#418) * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * add logs * add logs * add logs * remove logs * remove logs * remove logs * remove logs * remove logs * remove logs * remove logs * remove logs * remove logs * remove logs * change to theme value * change to theme value * change to theme value * change to theme value * add edit mode * add edit mode * add edit mode
97 lines
2.9 KiB
JavaScript
97 lines
2.9 KiB
JavaScript
import ChevronDownIcon from '@elementor/icons/ChevronDownIcon';
|
|
import ReloadIcon from '@elementor/icons/ReloadIcon';
|
|
import Box from '@elementor/ui/Box';
|
|
import Button from '@elementor/ui/Button';
|
|
import Menu from '@elementor/ui/Menu';
|
|
import MenuItem from '@elementor/ui/MenuItem';
|
|
import MenuItemText from '@elementor/ui/MenuItemText';
|
|
import DeleteGlobalItem from '@ea11y-apps/scanner/components/manage-footer-actions/global/delete-global-item';
|
|
import { useGlobalManageActions } from '@ea11y-apps/scanner/hooks/use-global-manage-actions';
|
|
import { StyledBanIcon } from '@ea11y-apps/scanner/styles/app.styles';
|
|
import { scannerItem } from '@ea11y-apps/scanner/types/scanner-item';
|
|
import { useRef, useState } from '@wordpress/element';
|
|
import { __ } from '@wordpress/i18n';
|
|
|
|
const ManageGlobalActions = ({ item }) => {
|
|
const [isOpened, setIsOpened] = useState(false);
|
|
const anchorEl = useRef(null);
|
|
|
|
const isDisabled = item.active !== '1';
|
|
const isExcluded = item.active_for_page !== '1';
|
|
|
|
const {
|
|
activeRequest,
|
|
updateGlobalRemediationForPage,
|
|
updateGlobalRemediationForAllPages,
|
|
} = useGlobalManageActions();
|
|
|
|
const handleOpen = () => {
|
|
setIsOpened(true);
|
|
};
|
|
const handleClose = () => setIsOpened(false);
|
|
|
|
const onUpdateForPage = () => {
|
|
handleClose();
|
|
void updateGlobalRemediationForPage(item.id, isExcluded, item.rule);
|
|
};
|
|
const onUpdateForAllPages = () => {
|
|
handleClose();
|
|
void updateGlobalRemediationForAllPages(item.id, isDisabled, item.rule);
|
|
};
|
|
|
|
return (
|
|
<Box display="flex" gap={1} justifyContent="flex-end">
|
|
{isDisabled && isExcluded && (
|
|
<DeleteGlobalItem id={item.id} rule={item.rule} />
|
|
)}
|
|
<Button
|
|
id="global-remediation-menu-button"
|
|
startIcon={isExcluded ? <ReloadIcon /> : <StyledBanIcon />}
|
|
endIcon={<ChevronDownIcon />}
|
|
size="small"
|
|
color={isExcluded ? 'info' : 'secondary'}
|
|
variant="outlined"
|
|
disabled={activeRequest}
|
|
onClick={handleOpen}
|
|
ref={anchorEl}
|
|
sx={{ ml: 1 }}
|
|
>
|
|
{isExcluded
|
|
? __('Enable fix', 'pojo-accessibility')
|
|
: __('Disable fix', 'pojo-accessibility')}
|
|
</Button>
|
|
<Menu
|
|
id="global-remediation-menu"
|
|
open={isOpened}
|
|
MenuListProps={{
|
|
'aria-labelledby': 'global-remediation-menu-button',
|
|
}}
|
|
anchorEl={anchorEl.current}
|
|
onClose={handleClose}
|
|
disablePortal
|
|
>
|
|
<MenuItem onClick={onUpdateForPage} disabled={activeRequest} dense>
|
|
<MenuItemText>
|
|
{isExcluded
|
|
? __('Enable on this page', 'pojo-accessibility')
|
|
: __('Disable on this page', 'pojo-accessibility')}
|
|
</MenuItemText>
|
|
</MenuItem>
|
|
|
|
<MenuItem onClick={onUpdateForAllPages} disabled={activeRequest} dense>
|
|
<MenuItemText>
|
|
{isDisabled
|
|
? __('Enable across scans', 'pojo-accessibility')
|
|
: __('Disable across scans', 'pojo-accessibility')}
|
|
</MenuItemText>
|
|
</MenuItem>
|
|
</Menu>
|
|
</Box>
|
|
);
|
|
};
|
|
|
|
ManageGlobalActions.propTypes = {
|
|
item: scannerItem,
|
|
};
|
|
|
|
export default ManageGlobalActions;
|