mirror of
https://gh.wpcy.net/https://github.com/elementor/one-click-accessibility.git
synced 2026-04-23 18:27:48 +08:00
* [APP-1108][APP-1109][APP-1110] Add analytics backend logic * [APP-1108][APP-1109][APP-1110] Add analytics backend logic * Add nonce to the widget settings * Update routes and DB table * Fix comments * Fix comments * Fix comments * Fix comments * Fix comments * Fix comments * [APP-1107] Add dashboard for analytics * [APP-1107] Add dashboard for analytics * [APP-1107] Add dashboard for analytics * [APP-1107] Add dashboard for analytics * [APP-1107] Add dashboard for analytics * [APP-1107] Add dashboard for analytics * [APP-1107] Add dashboard for analytics * [APP-1107] Add dashboard for analytics * [APP-1107] Add dashboard for analytics * [APP-1107] Add dashboard for analytics * [APP-1201] add accessibility rules * [APP-1107] fixed API endpoint * [APP-1107] fixed API endpoint * [APP-1107] fixed API endpoint * [APP-1107] add check for is_active * update to the latest * update to the latest * update to the latest * fix bugs, add changes * fix bugs, add changes * fix bugs, add changes * fix bugs, add changes
90 lines
2.4 KiB
JavaScript
90 lines
2.4 KiB
JavaScript
import '../css/style.css';
|
|
import Box from '@elementor/ui/Box';
|
|
import DirectionProvider from '@elementor/ui/DirectionProvider';
|
|
import Grid from '@elementor/ui/Grid';
|
|
import { styled, ThemeProvider } from '@elementor/ui/styles';
|
|
import {
|
|
ConnectModal,
|
|
Notifications,
|
|
MenuItems,
|
|
PostConnectModal,
|
|
UrlMismatchModal,
|
|
} from '@ea11y/components';
|
|
import {
|
|
useNotificationSettings,
|
|
useSettings,
|
|
useSavedSettings,
|
|
} from '@ea11y/hooks';
|
|
import { QuotaNotices, Sidebar } from '@ea11y/layouts';
|
|
import { eventNames, mixpanelService } from '@ea11y/services';
|
|
import { useEffect } from '@wordpress/element';
|
|
import { usePluginSettingsContext } from './contexts/plugin-settings';
|
|
import PageContent from './page-content';
|
|
|
|
const App = () => {
|
|
const { hasFinishedResolution, loading } = useSavedSettings();
|
|
|
|
const { isConnected, isRTL, closePostConnectModal, isUrlMismatch } =
|
|
usePluginSettingsContext();
|
|
const { notificationMessage, notificationType } = useNotificationSettings();
|
|
const { selectedMenu } = useSettings();
|
|
|
|
useEffect(() => {
|
|
if (window.ea11ySettingsData?.planData?.user?.id) {
|
|
mixpanelService.init().then(() => {
|
|
mixpanelService.sendEvent(eventNames.pageView, {
|
|
page: 'Button',
|
|
});
|
|
});
|
|
}
|
|
}, [window.ea11ySettingsData?.planData?.user?.id]);
|
|
|
|
const selectedParent = MenuItems[selectedMenu?.parent];
|
|
const selectedChild = selectedMenu?.child
|
|
? selectedParent?.children[selectedMenu?.child]
|
|
: null;
|
|
|
|
return (
|
|
<DirectionProvider rtl={isRTL}>
|
|
<ThemeProvider colorScheme="light">
|
|
{isConnected !== undefined && !isUrlMismatch && !isConnected && (
|
|
<ConnectModal />
|
|
)}
|
|
{isConnected && !closePostConnectModal && <PostConnectModal />}
|
|
{isUrlMismatch && !isConnected && <UrlMismatchModal />}
|
|
|
|
<StyledGrid>
|
|
<Sidebar />
|
|
|
|
<StyledContainer>
|
|
<QuotaNotices />
|
|
<PageContent
|
|
// Looks the best if we have both checks
|
|
isLoading={!hasFinishedResolution || loading}
|
|
page={selectedChild ? selectedChild?.page : selectedParent?.page}
|
|
/>
|
|
</StyledContainer>
|
|
</StyledGrid>
|
|
|
|
<Notifications message={notificationMessage} type={notificationType} />
|
|
</ThemeProvider>
|
|
</DirectionProvider>
|
|
);
|
|
};
|
|
|
|
export default App;
|
|
|
|
const StyledContainer = styled(Box)`
|
|
width: 100%;
|
|
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: start;
|
|
`;
|
|
|
|
const StyledGrid = styled(Grid)`
|
|
height: 100%;
|
|
|
|
display: flex;
|
|
flex-direction: row;
|
|
`;
|