one-click-accessibility/modules/settings/assets/js/components/bottom-bar/index.js
Nirbhay Singh 1972e7c029
[APP-1561] New menu layout (#308)
* update: app menu and layout

* merge: latest changes from feature/remediation

* add: alert indicator to the closed sidebar

* fix: page layout for statement page

* update: menu display names

* fix: topbar menu layout

* update: sidebar menu width

* update: sidebar menu width

* fix: popup menu layout

* add: hover action to the toggle button

* update: my account menu

* fix: quota indicator for closed sidebar

* fix: icon alignments

* fix: scroll behaviour

* fix: page scroll behaviour

* fix: popup menu hover state

* update: quota bar and group layouts

* add: tooltips to the menu items

* update: make scans page fixed height and scrollable

* update: styles with theme references and added new styled components

* fix: make sidebar smoother

* update: accessibility page heading
2025-07-02 14:29:57 +05:30

80 lines
1.8 KiB
JavaScript

import Box from '@elementor/ui/Box';
import { styled } from '@elementor/ui/styles';
import Button from '@ea11y/components/button';
import { useSettings, useStorage } from '@ea11y/hooks';
import { useToastNotification } from '@ea11y-apps/global/hooks';
import { mixpanelEvents, mixpanelService } from '@ea11y-apps/global/services';
import { __ } from '@wordpress/i18n';
const BottomBar = () => {
const {
selectedMenu,
widgetMenuSettings,
skipToContentSettings,
iconDesign,
iconPosition,
hasChanges,
hasError,
setHasChanges,
} = useSettings();
const { save } = useStorage();
const { success, error } = useToastNotification();
const saveSettings = async () => {
let savedData = {};
if (selectedMenu.parent === 'capabilities') {
savedData = {
ea11y_widget_menu_settings: widgetMenuSettings,
ea11y_skip_to_content_settings: skipToContentSettings,
};
} else if (selectedMenu.parent === 'design') {
savedData = {
ea11y_widget_icon_settings: {
style: iconDesign,
position: iconPosition,
},
};
}
try {
await save(savedData);
success(__('Settings saved!', 'pojo-accessibility'));
setHasChanges(false);
mixpanelService.sendEvent(mixpanelEvents.saveButtonClicked, {
savedData,
});
} catch (e) {
error(__('Failed to save settings!', 'pojo-accessibility'));
}
};
return (
<StyledContainer>
<Button
variant="contained"
color="info"
onClick={saveSettings}
disabled={
!hasChanges || Object.keys(hasError).some((key) => hasError[key])
}
>
{__('Save changes', 'pojo-accessibility')}
</Button>
</StyledContainer>
);
};
export default BottomBar;
const StyledContainer = styled(Box)`
width: 100%;
display: flex;
justify-content: flex-end;
padding: ${({ theme }) => theme.spacing(2)};
border-top: 1px solid ${({ theme }) => theme.palette.divider};
`;