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
67 lines
1.8 KiB
JavaScript
67 lines
1.8 KiB
JavaScript
import Card from '@elementor/ui/Card';
|
|
import CardHeader from '@elementor/ui/CardHeader';
|
|
import Typography from '@elementor/ui/Typography';
|
|
import { useTheme } from '@elementor/ui/styles';
|
|
import { LineChart as MuiLineChart } from '@mui/x-charts/LineChart';
|
|
import { LineChartTitle } from '@ea11y/components/analytics/components/line-chart-title';
|
|
import { LineTooltip } from '@ea11y/components/analytics/components/line-tooltip';
|
|
import { NoData } from '@ea11y/components/analytics/components/no-data';
|
|
import { dateI18n } from '@wordpress/date';
|
|
import { useAnalyticsContext } from '../../../contexts/analytics-context';
|
|
|
|
export const LineChart = () => {
|
|
const theme = useTheme();
|
|
const { stats } = useAnalyticsContext();
|
|
const totalOpen = stats.dates.reduce(
|
|
(sum, item) => sum + Number(item.total),
|
|
0,
|
|
);
|
|
|
|
const showChart = stats.dates.length > 0;
|
|
|
|
return (
|
|
<Card variant="outlined" sx={{ height: '100%' }}>
|
|
<CardHeader
|
|
title={<LineChartTitle />}
|
|
subheader={
|
|
totalOpen > 0 ? (
|
|
<Typography variant="h3" sx={{ height: '50px' }}>
|
|
{totalOpen.toString()}
|
|
</Typography>
|
|
) : null
|
|
}
|
|
sx={{ pb: 0 }}
|
|
/>
|
|
{showChart && (
|
|
<MuiLineChart
|
|
series={[
|
|
{
|
|
type: 'line',
|
|
curve: 'linear',
|
|
data: stats.dates.map((item) => item.total),
|
|
color: theme.palette.info.main,
|
|
},
|
|
]}
|
|
xAxis={[
|
|
{
|
|
scaleType: 'point',
|
|
data: stats.dates.map((item) => item.date),
|
|
valueFormatter: (item, context) =>
|
|
context.location === 'tick'
|
|
? dateI18n('d.m', item, false)
|
|
: item,
|
|
},
|
|
]}
|
|
slots={{
|
|
axisContent: LineTooltip,
|
|
}}
|
|
tooltip={{
|
|
trigger: totalOpen ? 'axis' : 'none',
|
|
}}
|
|
height={250}
|
|
/>
|
|
)}
|
|
{stats.dates.length === 0 && <NoData />}
|
|
</Card>
|
|
);
|
|
};
|