one-click-accessibility/modules/scanner/assets/js/components/header/stats/management-stats.js
VasylD f0dce2793e
[APP-1923][APP-1924] manage remediations, global remediations (#424)
* [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
2025-11-10 16:25:45 +07:00

46 lines
1.4 KiB
JavaScript

import Box from '@elementor/ui/Box';
import Typography from '@elementor/ui/Typography';
import { useScannerWizardContext } from '@ea11y-apps/scanner/context/scanner-wizard-context';
import { StyledSkeleton } from '@ea11y-apps/scanner/styles/app.styles';
import { __, sprintf } from '@wordpress/i18n';
export const ManagementStats = () => {
const { loading, remediations, globalRemediations } =
useScannerWizardContext();
const pageRemediationsActive = remediations?.filter((remediation) =>
Number(remediation.active),
).length;
const globalRemediationsActive = globalRemediations.filter(
({ active, active_for_page: activeForPage }) =>
Number(active) && (!activeForPage || Number(activeForPage)),
).length;
const active = pageRemediationsActive + globalRemediationsActive;
const total = remediations?.length + globalRemediations.length;
const getStats = () =>
active > 0 ? (
<Typography variant="body2" color="text.secondary">
{sprintf(
// Translators: %1$s - active, %2$s - total
__('%1$s/%2$s fixes are currently active', 'pojo-accessibility'),
active,
total,
)}
</Typography>
) : (
<Typography variant="body2" color="text.disabled">
{__('0 fixes are currently active', 'pojo-accessibility')}
</Typography>
);
return loading ? (
<Box flexGrow={1} sx={{ py: 1 }}>
<StyledSkeleton width="100%" height={14} />
</Box>
) : (
getStats()
);
};