one-click-accessibility/modules/scanner/assets/js/app.js
VasylD fa2fd11e29
[APP-934] add submit logic (#259)
* [APP-934] add submit logic

* [APP-934] add submit logic

* [APP-934] add submit logic

* [APP-934] add submit logic

* Added replace remediation action

* Add submit logic

* Add submit alt text logic, generate AI alt text

* Add AI generate request, add convert from SVG to png base64, added manual fix block

* Add AI generate request, add convert from SVG to png base64, added manual fix block

* Add texts, add remediation submit, fix logic to store remediation

* Add texts, add remediation submit, fix logic to store remediation

* Add texts, add remediation submit, fix logic to store remediation

* Add texts, add remediation submit, fix logic to store remediation

* Add texts, add remediation submit, fix logic to store remediation

* Add texts, add remediation submit, fix logic to store remediation

---------

Co-authored-by: Raz Ohad <admin@bainternet.info>
2025-05-06 00:00:46 +03:00

61 lines
1.7 KiB
JavaScript

import ErrorBoundary from '@elementor/ui/ErrorBoundary';
import Paper from '@elementor/ui/Paper';
import { styled } from '@elementor/ui/styles';
import { Notifications } from '@ea11y/components';
import { useNotificationSettings } from '@ea11y-apps/global/hooks/use-notifications';
import { ErrorMessage } from '@ea11y-apps/scanner/components/error-message';
import { Header } from '@ea11y-apps/scanner/components/header';
import { Loader } from '@ea11y-apps/scanner/components/main-list/loader';
import { ResolvedMessage } from '@ea11y-apps/scanner/components/resolved-message';
import { BLOCKS } from '@ea11y-apps/scanner/constants';
import { useScannerWizardContext } from '@ea11y-apps/scanner/context/scanner-wizard-context';
import {
AltTextLayout,
MainLayout,
ManualLayout,
} from '@ea11y-apps/scanner/layouts';
const App = () => {
const { notificationMessage, notificationType } = useNotificationSettings();
const { violation, resolved, openedBlock, isError, loading } =
useScannerWizardContext();
const getBlock = () => {
if (isError) {
return <ErrorMessage />;
}
if (loading) {
return <Loader />;
}
switch (openedBlock) {
case BLOCKS.main:
return <MainLayout />;
case BLOCKS.altText:
return <AltTextLayout />;
default:
return <ManualLayout />;
}
};
return (
<StyledPaper>
<ErrorBoundary fallback={<ErrorMessage />}>
<Header />
{violation !== resolved ? getBlock() : <ResolvedMessage isMain />}
<Notifications message={notificationMessage} type={notificationType} />
</ErrorBoundary>
</StyledPaper>
);
};
const StyledPaper = styled(Paper)`
position: fixed;
top: 0;
/* @noflip */
right: 0;
width: 420px;
height: 100vh;
overflow-y: auto;
z-index: 99999;
`;
export default App;