@elementor/editor-audits 4.4.0-1101 → 4.4.0-1102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +427 -411
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +425 -415
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -13
- package/src/components/audit-panel.tsx +7 -1
- package/src/components/audit-statuses-section.tsx +65 -0
- package/src/components/category-icons.ts +4 -10
- package/src/components/pages/issues-page.tsx +24 -7
- package/src/components/pages/overview-page.tsx +6 -94
- package/src/components/promotions.tsx +3 -2
- package/src/components/report-shell.tsx +43 -39
- package/src/components/severity-filter-chips.tsx +57 -0
- package/src/components/severity-icons.tsx +2 -2
- package/src/constants.ts +1 -1
- package/src/utils/severity-counts.ts +2 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-audits",
|
|
3
|
-
"version": "4.4.0-
|
|
3
|
+
"version": "4.4.0-1102",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,19 +39,19 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "4.4.0-
|
|
43
|
-
"@elementor/editor-mcp": "4.4.0-
|
|
44
|
-
"@elementor/editor-app-bar": "4.4.0-
|
|
45
|
-
"@elementor/editor-elements": "4.4.0-
|
|
46
|
-
"@elementor/editor-floating-panels": "4.4.0-
|
|
47
|
-
"@elementor/editor-notifications": "4.4.0-
|
|
48
|
-
"@elementor/editor-v1-adapters": "4.4.0-
|
|
49
|
-
"@elementor/events": "4.4.0-
|
|
50
|
-
"@elementor/http-client": "4.4.0-
|
|
42
|
+
"@elementor/editor": "4.4.0-1102",
|
|
43
|
+
"@elementor/editor-mcp": "4.4.0-1102",
|
|
44
|
+
"@elementor/editor-app-bar": "4.4.0-1102",
|
|
45
|
+
"@elementor/editor-elements": "4.4.0-1102",
|
|
46
|
+
"@elementor/editor-floating-panels": "4.4.0-1102",
|
|
47
|
+
"@elementor/editor-notifications": "4.4.0-1102",
|
|
48
|
+
"@elementor/editor-v1-adapters": "4.4.0-1102",
|
|
49
|
+
"@elementor/events": "4.4.0-1102",
|
|
50
|
+
"@elementor/http-client": "4.4.0-1102",
|
|
51
51
|
"@elementor/icons": "~1.77.0",
|
|
52
|
-
"@elementor/locations": "4.4.0-
|
|
53
|
-
"@elementor/session": "4.4.0-
|
|
54
|
-
"@elementor/store": "4.4.0-
|
|
52
|
+
"@elementor/locations": "4.4.0-1102",
|
|
53
|
+
"@elementor/session": "4.4.0-1102",
|
|
54
|
+
"@elementor/store": "4.4.0-1102",
|
|
55
55
|
"@elementor/ui": "1.37.5"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
@@ -26,7 +26,13 @@ export default function AuditPanel() {
|
|
|
26
26
|
badge={ __( 'Beta', 'elementor' ) }
|
|
27
27
|
titleVariant="subtitle2"
|
|
28
28
|
/>
|
|
29
|
-
<FloatingPanelBody
|
|
29
|
+
<FloatingPanelBody
|
|
30
|
+
sx={
|
|
31
|
+
status === 'ready'
|
|
32
|
+
? { display: 'flex', flexDirection: 'column', overflow: 'hidden', minHeight: 0 }
|
|
33
|
+
: undefined
|
|
34
|
+
}
|
|
35
|
+
>
|
|
30
36
|
{ status === 'idle' && <WelcomePage /> }
|
|
31
37
|
{ status === 'loading' && <LoadingPage /> }
|
|
32
38
|
{ status === 'error' && <ErrorPage message={ error ?? '' } onRetry={ onRun } /> }
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Box, Divider, Typography } from '@elementor/ui';
|
|
3
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
4
|
+
|
|
5
|
+
import { type PageAuditReport } from '../types';
|
|
6
|
+
import {
|
|
7
|
+
auditStatusColor,
|
|
8
|
+
auditStatusDisplayCounts,
|
|
9
|
+
type AuditStatusGroup,
|
|
10
|
+
auditStatusLabel,
|
|
11
|
+
} from '../utils/audit-status-summary';
|
|
12
|
+
import CountSummaryCircle from './count-summary-circle';
|
|
13
|
+
|
|
14
|
+
type Props = {
|
|
15
|
+
report: PageAuditReport;
|
|
16
|
+
onStatusClick: ( status: AuditStatusGroup ) => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const STATUS_ARIA_LABELS: Record< AuditStatusGroup, ( count: number ) => string > = {
|
|
20
|
+
pass: ( count ) =>
|
|
21
|
+
sprintf(
|
|
22
|
+
/* translators: %d: number of passed audits. */
|
|
23
|
+
__( '%d passed audits, view all', 'elementor' ),
|
|
24
|
+
count
|
|
25
|
+
),
|
|
26
|
+
fail: ( count ) =>
|
|
27
|
+
sprintf(
|
|
28
|
+
/* translators: %d: number of failed audit violations. */
|
|
29
|
+
__( '%d failed audits, view all', 'elementor' ),
|
|
30
|
+
count
|
|
31
|
+
),
|
|
32
|
+
skipped: ( count ) =>
|
|
33
|
+
sprintf(
|
|
34
|
+
/* translators: %d: number of skipped audits. */
|
|
35
|
+
__( '%d skipped audits, view all', 'elementor' ),
|
|
36
|
+
count
|
|
37
|
+
),
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const STATUS_GROUPS = [ 'fail', 'pass', 'skipped' ] as const;
|
|
41
|
+
|
|
42
|
+
export default function AuditStatusesSection( { report, onStatusClick }: Props ) {
|
|
43
|
+
const statusCounts = auditStatusDisplayCounts( report );
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
<Typography variant="subtitle1" fontWeight="bold">
|
|
48
|
+
{ __( 'Audit statuses', 'elementor' ) }
|
|
49
|
+
</Typography>
|
|
50
|
+
<Box sx={ { display: 'flex', justifyContent: 'space-around', gap: 2 } }>
|
|
51
|
+
{ STATUS_GROUPS.map( ( status ) => (
|
|
52
|
+
<CountSummaryCircle
|
|
53
|
+
key={ status }
|
|
54
|
+
ariaLabel={ STATUS_ARIA_LABELS[ status ]( statusCounts[ status ] ) }
|
|
55
|
+
color={ auditStatusColor( status ) }
|
|
56
|
+
count={ statusCounts[ status ] }
|
|
57
|
+
label={ auditStatusLabel( status ) }
|
|
58
|
+
onClick={ () => onStatusClick( status ) }
|
|
59
|
+
/>
|
|
60
|
+
) ) }
|
|
61
|
+
</Box>
|
|
62
|
+
<Divider />
|
|
63
|
+
</>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ElementorAccessibilityIcon,
|
|
3
|
-
FilterIcon,
|
|
4
|
-
HeartHandShakeIcon,
|
|
5
|
-
Settings2Icon,
|
|
6
|
-
ShieldHalfFilledIcon,
|
|
7
|
-
} from '@elementor/icons';
|
|
1
|
+
import { BoltIcon, ElementorAccessibilityIcon, FileSearchIcon, Settings2Icon, ShieldCheckIcon } from '@elementor/icons';
|
|
8
2
|
|
|
9
3
|
import type { AuditCategory } from '../types';
|
|
10
4
|
|
|
11
5
|
export const CATEGORY_ICONS: Record< AuditCategory, typeof Settings2Icon > = {
|
|
12
6
|
'best-practices': Settings2Icon,
|
|
13
|
-
seo:
|
|
7
|
+
seo: FileSearchIcon,
|
|
14
8
|
accessibility: ElementorAccessibilityIcon,
|
|
15
|
-
performance:
|
|
16
|
-
compliance:
|
|
9
|
+
performance: BoltIcon,
|
|
10
|
+
compliance: ShieldCheckIcon,
|
|
17
11
|
};
|
|
@@ -1,25 +1,42 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import { Box, Link, Typography } from '@elementor/ui';
|
|
3
4
|
import { __ } from '@wordpress/i18n';
|
|
4
5
|
|
|
5
6
|
import { ALL_CATEGORIES, CATEGORY_LABELS } from '../../constants';
|
|
6
7
|
import { type AuditCategory, type PageAuditReport } from '../../types';
|
|
7
|
-
import { getPopulatedCategories } from '../../utils/audit-status-summary';
|
|
8
|
-
import { countSeverities } from '../../utils/severity-counts';
|
|
8
|
+
import { type AuditStatusGroup, getPopulatedCategories } from '../../utils/audit-status-summary';
|
|
9
|
+
import { countSeverities, type SeverityCounts } from '../../utils/severity-counts';
|
|
10
|
+
import AuditStatusesSection from '../audit-statuses-section';
|
|
9
11
|
import IssuesCategoryRow from '../issues-category-row';
|
|
10
|
-
import
|
|
12
|
+
import SeverityFilterChips, { type SeverityFilter } from '../severity-filter-chips';
|
|
11
13
|
|
|
12
14
|
type Props = {
|
|
13
15
|
report: PageAuditReport;
|
|
14
16
|
onCategoryClick: ( category: AuditCategory ) => void;
|
|
15
17
|
onAllAuditsClick: () => void;
|
|
18
|
+
onStatusClick: ( status: AuditStatusGroup ) => void;
|
|
16
19
|
};
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
function filterCounts( counts: SeverityCounts, filter: SeverityFilter ): SeverityCounts {
|
|
22
|
+
if ( filter === 'all' ) {
|
|
23
|
+
return counts;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return { error: 0, warning: 0, info: 0, [ filter ]: counts[ filter ] };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default function IssuesPage( { report, onCategoryClick, onAllAuditsClick, onStatusClick }: Props ) {
|
|
30
|
+
const [ filter, setFilter ] = useState< SeverityFilter >( 'all' );
|
|
19
31
|
const populatedCategories = getPopulatedCategories( report.categories, ALL_CATEGORIES );
|
|
20
32
|
|
|
33
|
+
const categoryRows = populatedCategories
|
|
34
|
+
.map( ( category ) => ( { category, counts: filterCounts( countSeverities( report, category ), filter ) } ) )
|
|
35
|
+
.filter( ( { counts } ) => Object.values( counts ).some( ( count ) => count > 0 ) );
|
|
36
|
+
|
|
21
37
|
return (
|
|
22
38
|
<Box sx={ { display: 'flex', flexDirection: 'column', gap: 4, p: 2 } }>
|
|
39
|
+
<AuditStatusesSection report={ report } onStatusClick={ onStatusClick } />
|
|
23
40
|
<Link
|
|
24
41
|
component="button"
|
|
25
42
|
underline="none"
|
|
@@ -31,18 +48,18 @@ export default function IssuesPage( { report, onCategoryClick, onAllAuditsClick
|
|
|
31
48
|
{ __( 'All issues', 'elementor' ) }
|
|
32
49
|
</Typography>
|
|
33
50
|
</Link>
|
|
51
|
+
<SeverityFilterChips selected={ filter } onChange={ setFilter } />
|
|
34
52
|
<Box sx={ { display: 'flex', flexDirection: 'column', gap: 1 } }>
|
|
35
|
-
{
|
|
53
|
+
{ categoryRows.map( ( { category, counts } ) => (
|
|
36
54
|
<IssuesCategoryRow
|
|
37
55
|
key={ category }
|
|
38
56
|
category={ category }
|
|
39
57
|
label={ CATEGORY_LABELS[ category ] }
|
|
40
|
-
counts={
|
|
58
|
+
counts={ counts }
|
|
41
59
|
onClick={ () => onCategoryClick( category ) }
|
|
42
60
|
/>
|
|
43
61
|
) ) }
|
|
44
62
|
</Box>
|
|
45
|
-
<Promotions report={ report } />
|
|
46
63
|
</Box>
|
|
47
64
|
);
|
|
48
65
|
}
|
|
@@ -1,61 +1,22 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Box, Chip,
|
|
3
|
-
import { __
|
|
2
|
+
import { Box, Chip, Typography } from '@elementor/ui';
|
|
3
|
+
import { __ } from '@wordpress/i18n';
|
|
4
4
|
|
|
5
5
|
import { ALL_CATEGORIES, CATEGORY_LABELS } from '../../constants';
|
|
6
6
|
import { type AuditCategory, type PageAuditReport } from '../../types';
|
|
7
|
-
import {
|
|
8
|
-
auditStatusColor,
|
|
9
|
-
auditStatusDisplayCounts,
|
|
10
|
-
type AuditStatusGroup,
|
|
11
|
-
auditStatusLabel,
|
|
12
|
-
getPopulatedCategories,
|
|
13
|
-
} from '../../utils/audit-status-summary';
|
|
7
|
+
import { getPopulatedCategories } from '../../utils/audit-status-summary';
|
|
14
8
|
import { getScoreTier } from '../../utils/score-thresholds';
|
|
15
|
-
import
|
|
16
|
-
ALL_SEVERITIES,
|
|
17
|
-
countSeverities,
|
|
18
|
-
severityPluralLabel,
|
|
19
|
-
severityRemainingCountLabel,
|
|
20
|
-
} from '../../utils/severity-counts';
|
|
21
|
-
import CountSummaryCircle from '../count-summary-circle';
|
|
9
|
+
import Promotions from '../promotions';
|
|
22
10
|
import ScoreBar from '../score-bar';
|
|
23
11
|
import ScoreCircle from '../score-circle';
|
|
24
|
-
import SeverityIcon from '../severity-icons';
|
|
25
12
|
|
|
26
13
|
type Props = {
|
|
27
14
|
onCategoryClick: ( category: AuditCategory ) => void;
|
|
28
|
-
onStatusClick: ( status: AuditStatusGroup ) => void;
|
|
29
15
|
report: PageAuditReport;
|
|
30
16
|
};
|
|
31
17
|
|
|
32
|
-
|
|
33
|
-
pass: ( count ) =>
|
|
34
|
-
sprintf(
|
|
35
|
-
/* translators: %d: number of passed audits. */
|
|
36
|
-
__( '%d passed audits, view all', 'elementor' ),
|
|
37
|
-
count
|
|
38
|
-
),
|
|
39
|
-
fail: ( count ) =>
|
|
40
|
-
sprintf(
|
|
41
|
-
/* translators: %d: number of failed audit violations. */
|
|
42
|
-
__( '%d failed audits, view all', 'elementor' ),
|
|
43
|
-
count
|
|
44
|
-
),
|
|
45
|
-
skipped: ( count ) =>
|
|
46
|
-
sprintf(
|
|
47
|
-
/* translators: %d: number of skipped audits. */
|
|
48
|
-
__( '%d skipped audits, view all', 'elementor' ),
|
|
49
|
-
count
|
|
50
|
-
),
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const STATUS_GROUPS = [ 'fail', 'pass', 'skipped' ] as const;
|
|
54
|
-
|
|
55
|
-
export default function OverviewPage( { onCategoryClick, onStatusClick, report }: Props ) {
|
|
18
|
+
export default function OverviewPage( { onCategoryClick, report }: Props ) {
|
|
56
19
|
const populatedCategories = getPopulatedCategories( report.categories, ALL_CATEGORIES );
|
|
57
|
-
const severityCounts = countSeverities( report );
|
|
58
|
-
const statusCounts = auditStatusDisplayCounts( report );
|
|
59
20
|
const overallScore = getScoreTier( report.overall );
|
|
60
21
|
|
|
61
22
|
return (
|
|
@@ -85,56 +46,7 @@ export default function OverviewPage( { onCategoryClick, onStatusClick, report }
|
|
|
85
46
|
/>
|
|
86
47
|
) ) }
|
|
87
48
|
</Box>
|
|
88
|
-
<
|
|
89
|
-
<Typography variant="subtitle1" fontWeight="bold">
|
|
90
|
-
{ __( 'Audit statuses', 'elementor' ) }
|
|
91
|
-
</Typography>
|
|
92
|
-
<Box sx={ { display: 'flex', justifyContent: 'space-around', gap: 2 } }>
|
|
93
|
-
{ STATUS_GROUPS.map( ( status ) => (
|
|
94
|
-
<CountSummaryCircle
|
|
95
|
-
key={ status }
|
|
96
|
-
ariaLabel={ STATUS_ARIA_LABELS[ status ]( statusCounts[ status ] ) }
|
|
97
|
-
color={ auditStatusColor( status ) }
|
|
98
|
-
count={ statusCounts[ status ] }
|
|
99
|
-
label={ auditStatusLabel( status ) }
|
|
100
|
-
onClick={ () => onStatusClick( status ) }
|
|
101
|
-
/>
|
|
102
|
-
) ) }
|
|
103
|
-
</Box>
|
|
104
|
-
<Divider />
|
|
105
|
-
<Typography variant="subtitle1" fontWeight="bold">
|
|
106
|
-
{ __( 'Remaining issues', 'elementor' ) }
|
|
107
|
-
</Typography>
|
|
108
|
-
<Box
|
|
109
|
-
component="ul"
|
|
110
|
-
sx={ {
|
|
111
|
-
display: 'flex',
|
|
112
|
-
flexDirection: 'column',
|
|
113
|
-
gap: 1,
|
|
114
|
-
listStyle: 'none',
|
|
115
|
-
m: 0,
|
|
116
|
-
p: 0,
|
|
117
|
-
} }
|
|
118
|
-
>
|
|
119
|
-
{ ALL_SEVERITIES.map( ( severity ) => {
|
|
120
|
-
const count = severityCounts[ severity ];
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
<Box
|
|
124
|
-
aria-label={ severityRemainingCountLabel( severity, count ) }
|
|
125
|
-
component="li"
|
|
126
|
-
key={ severity }
|
|
127
|
-
sx={ { alignItems: 'center', display: 'flex', gap: 0.5 } }
|
|
128
|
-
>
|
|
129
|
-
<SeverityIcon severity={ severity } />
|
|
130
|
-
<Typography variant="body2" fontWeight="bold">
|
|
131
|
-
{ count }
|
|
132
|
-
</Typography>
|
|
133
|
-
<Typography variant="body2">{ severityPluralLabel( severity ) }</Typography>
|
|
134
|
-
</Box>
|
|
135
|
-
);
|
|
136
|
-
} ) }
|
|
137
|
-
</Box>
|
|
49
|
+
<Promotions report={ report } />
|
|
138
50
|
</Box>
|
|
139
51
|
);
|
|
140
52
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Box, Typography } from '@elementor/ui';
|
|
2
|
+
import { Box, Divider, Typography } from '@elementor/ui';
|
|
3
3
|
import { __ } from '@wordpress/i18n';
|
|
4
4
|
|
|
5
5
|
import { PROMOTIONS } from '../register-promotions';
|
|
@@ -44,8 +44,9 @@ export default function Promotions( { report }: Props ) {
|
|
|
44
44
|
|
|
45
45
|
return (
|
|
46
46
|
<>
|
|
47
|
+
<Divider />
|
|
47
48
|
<Typography variant="subtitle1" fontWeight="bold">
|
|
48
|
-
{ __( 'Quick
|
|
49
|
+
{ __( 'Quick actions', 'elementor' ) }
|
|
49
50
|
</Typography>
|
|
50
51
|
<Box sx={ { display: 'flex', flexDirection: 'column', gap: 1 } }>
|
|
51
52
|
{ cards.map( ( { config, ctaUrl, key, run, subtitle } ) => (
|
|
@@ -66,45 +66,49 @@ export default function ReportShell( { report }: Props ) {
|
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
return (
|
|
69
|
-
<Box>
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
69
|
+
<Box sx={ { display: 'flex', flexDirection: 'column', flex: 1, minHeight: 0 } }>
|
|
70
|
+
<Box sx={ { flexShrink: 0 } }>
|
|
71
|
+
<Tabs
|
|
72
|
+
aria-label={ __( 'Audit navigation', 'elementor' ) }
|
|
73
|
+
value={ currentTab }
|
|
74
|
+
onChange={ handleTabChange }
|
|
75
|
+
textColor="secondary"
|
|
76
|
+
indicatorColor="secondary"
|
|
77
|
+
size="small"
|
|
78
|
+
centered={ true }
|
|
79
|
+
variant="fullWidth"
|
|
80
|
+
>
|
|
81
|
+
<Tab value="overview" label={ __( 'Overview', 'elementor' ) } />
|
|
82
|
+
<Tab value="issues" label={ __( 'Issues', 'elementor' ) } />
|
|
83
|
+
</Tabs>
|
|
84
|
+
<Divider />
|
|
85
|
+
</Box>
|
|
86
|
+
<Box sx={ { flex: 1, minHeight: 0, overflowY: 'auto' } }>
|
|
87
|
+
{ activePage === 'overview' && (
|
|
88
|
+
<OverviewPage
|
|
89
|
+
report={ report }
|
|
90
|
+
onCategoryClick={ ( category ) => openCategory( category, 'overview' ) }
|
|
91
|
+
/>
|
|
92
|
+
) }
|
|
93
|
+
{ activePage === 'issues' && (
|
|
94
|
+
<IssuesPage
|
|
95
|
+
report={ report }
|
|
96
|
+
onCategoryClick={ ( category ) => openCategory( category, 'issues' ) }
|
|
97
|
+
onAllAuditsClick={ () => openAllAudits() }
|
|
98
|
+
onStatusClick={ ( status ) => openAllAudits( status ) }
|
|
99
|
+
/>
|
|
100
|
+
) }
|
|
101
|
+
{ isAllAuditsPage( activePage ) && (
|
|
102
|
+
<AllAuditsPage
|
|
103
|
+
report={ report }
|
|
104
|
+
initialExpandedStatus={ activePage.expand }
|
|
105
|
+
onBack={ backFromSubPage }
|
|
106
|
+
/>
|
|
107
|
+
) }
|
|
108
|
+
{ isCategoryPage( activePage ) && (
|
|
109
|
+
<CategoryPage category={ activePage.category } report={ report } onBack={ backFromSubPage } />
|
|
110
|
+
) }
|
|
111
|
+
</Box>
|
|
108
112
|
</Box>
|
|
109
113
|
);
|
|
110
114
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Box, Chip } from '@elementor/ui';
|
|
3
|
+
import { __ } from '@wordpress/i18n';
|
|
4
|
+
|
|
5
|
+
import { type AuditSeverity } from '../types';
|
|
6
|
+
import { ALL_SEVERITIES, severityPluralLabel } from '../utils/severity-counts';
|
|
7
|
+
import SeverityIcon from './severity-icons';
|
|
8
|
+
|
|
9
|
+
export type SeverityFilter = 'all' | AuditSeverity;
|
|
10
|
+
|
|
11
|
+
type Props = {
|
|
12
|
+
selected: SeverityFilter;
|
|
13
|
+
onChange: ( filter: SeverityFilter ) => void;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default function SeverityFilterChips( { selected, onChange }: Props ) {
|
|
17
|
+
return (
|
|
18
|
+
<Box sx={ { display: 'flex', alignItems: 'center', gap: 1 } }>
|
|
19
|
+
<FilterChip
|
|
20
|
+
label={ __( 'All', 'elementor' ) }
|
|
21
|
+
isSelected={ selected === 'all' }
|
|
22
|
+
onClick={ () => onChange( 'all' ) }
|
|
23
|
+
/>
|
|
24
|
+
{ ALL_SEVERITIES.map( ( severity ) => (
|
|
25
|
+
<FilterChip
|
|
26
|
+
key={ severity }
|
|
27
|
+
label={ severityPluralLabel( severity ) }
|
|
28
|
+
icon={ <SeverityIcon severity={ severity } /> }
|
|
29
|
+
isSelected={ selected === severity }
|
|
30
|
+
onClick={ () => onChange( severity ) }
|
|
31
|
+
/>
|
|
32
|
+
) ) }
|
|
33
|
+
</Box>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
type FilterChipProps = {
|
|
38
|
+
label: string;
|
|
39
|
+
icon?: React.ReactElement;
|
|
40
|
+
isSelected: boolean;
|
|
41
|
+
onClick: () => void;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
function FilterChip( { label, icon, isSelected, onClick }: FilterChipProps ) {
|
|
45
|
+
return (
|
|
46
|
+
<Chip
|
|
47
|
+
label={ label }
|
|
48
|
+
icon={ icon }
|
|
49
|
+
size="small"
|
|
50
|
+
variant="filled"
|
|
51
|
+
color="default"
|
|
52
|
+
onClick={ onClick }
|
|
53
|
+
aria-pressed={ isSelected }
|
|
54
|
+
sx={ { bgcolor: isSelected ? 'action.selected' : 'transparent' } }
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { AlertCircleIcon, AlertTriangleFilledIcon,
|
|
2
|
+
import { AlertCircleIcon, AlertTriangleFilledIcon, BulbIcon } from '@elementor/icons';
|
|
3
3
|
|
|
4
4
|
import { type AuditSeverity } from '../types';
|
|
5
5
|
|
|
@@ -13,7 +13,7 @@ type SeverityConfig = {
|
|
|
13
13
|
const SEVERITY_CONFIG: Record< AuditSeverity, SeverityConfig > = {
|
|
14
14
|
error: { Icon: AlertTriangleFilledIcon, color: 'error' },
|
|
15
15
|
warning: { Icon: AlertCircleIcon, color: 'warning' },
|
|
16
|
-
info: { Icon:
|
|
16
|
+
info: { Icon: BulbIcon, color: 'info' },
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
type Props = {
|
package/src/constants.ts
CHANGED
|
@@ -31,5 +31,5 @@ export const CATEGORY_LABELS: Record< AuditCategory, string > = {
|
|
|
31
31
|
seo: __( 'SEO', 'elementor' ),
|
|
32
32
|
accessibility: __( 'Accessibility', 'elementor' ),
|
|
33
33
|
performance: __( 'Performance', 'elementor' ),
|
|
34
|
-
compliance: __( '
|
|
34
|
+
compliance: __( 'Site compliance', 'elementor' ),
|
|
35
35
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
2
|
|
|
3
3
|
import { type AuditCategory, type AuditSeverity, type PageAuditReport } from '../types';
|
|
4
4
|
import { isScoredAudit } from './is-scored-audit';
|
|
@@ -36,29 +36,6 @@ export function severityPluralLabel( severity: AuditSeverity ): string {
|
|
|
36
36
|
case 'warning':
|
|
37
37
|
return __( 'Warnings', 'elementor' );
|
|
38
38
|
case 'info':
|
|
39
|
-
return __( '
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function severityRemainingCountLabel( severity: AuditSeverity, count: number ): string {
|
|
44
|
-
switch ( severity ) {
|
|
45
|
-
case 'error':
|
|
46
|
-
return sprintf(
|
|
47
|
-
/* translators: %d: number of remaining error violations. */
|
|
48
|
-
__( '%d errors', 'elementor' ),
|
|
49
|
-
count
|
|
50
|
-
);
|
|
51
|
-
case 'warning':
|
|
52
|
-
return sprintf(
|
|
53
|
-
/* translators: %d: number of remaining warning violations. */
|
|
54
|
-
__( '%d warnings', 'elementor' ),
|
|
55
|
-
count
|
|
56
|
-
);
|
|
57
|
-
case 'info':
|
|
58
|
-
return sprintf(
|
|
59
|
-
/* translators: %d: number of remaining info violations. */
|
|
60
|
-
__( '%d info', 'elementor' ),
|
|
61
|
-
count
|
|
62
|
-
);
|
|
39
|
+
return __( 'Suggestions', 'elementor' );
|
|
63
40
|
}
|
|
64
41
|
}
|