lighthouse 8.5.1 → 8.6.0-dev.20211016
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/changelog.md +5490 -0
- package/dist/report/flow.js +35 -12
- package/dist/report/standalone.js +20 -21
- package/flow-report/.eslintrc.cjs +49 -0
- package/flow-report/assets/styles.css +272 -9
- package/flow-report/jest.config.js +1 -1
- package/flow-report/package.json +4 -0
- package/flow-report/src/app.tsx +31 -9
- package/flow-report/src/common.tsx +86 -7
- package/flow-report/src/header.tsx +88 -0
- package/flow-report/src/help-dialog.tsx +120 -0
- package/flow-report/src/i18n/i18n.tsx +52 -0
- package/flow-report/src/i18n/localized-strings.js +11 -0
- package/flow-report/src/i18n/ui-strings.js +134 -0
- package/flow-report/src/icons.tsx +20 -3
- package/flow-report/src/sidebar/sidebar.tsx +11 -16
- package/flow-report/src/summary/category.tsx +39 -24
- package/flow-report/src/summary/summary.tsx +35 -32
- package/flow-report/src/topbar.tsx +54 -4
- package/flow-report/src/util.ts +26 -1
- package/flow-report/src/wrappers/report-renderer.tsx +1 -1
- package/flow-report/src/wrappers/report.tsx +6 -21
- package/flow-report/test/app-test.tsx +17 -13
- package/flow-report/test/common-test.tsx +89 -0
- package/flow-report/test/header-test.tsx +55 -0
- package/flow-report/test/sample-flow.ts +17 -0
- package/flow-report/test/setup/env-setup.ts +1 -0
- package/flow-report/test/sidebar/flow-test.tsx +6 -12
- package/flow-report/test/sidebar/sidebar-test.tsx +7 -13
- package/flow-report/test/summary/category-test.tsx +83 -34
- package/flow-report/test/summary/summary-test.tsx +12 -18
- package/flow-report/test/topbar-test.tsx +68 -0
- package/flow-report/test/util-test.tsx +1 -12
- package/flow-report/tsconfig.json +2 -0
- package/flow-report/types/flow-report.d.ts +2 -1
- package/jest.config.js +1 -15
- package/lighthouse-cli/bin.js +5 -0
- package/lighthouse-cli/cli-flags.js +10 -3
- package/lighthouse-cli/commands/commands.js +1 -0
- package/lighthouse-cli/commands/list-locales.js +16 -0
- package/lighthouse-cli/run.js +2 -2
- package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +0 -0
- package/lighthouse-cli/test/smokehouse/report-assert.js +20 -4
- package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +2 -1
- package/lighthouse-core/audits/byte-efficiency/unused-javascript.js +1 -1
- package/lighthouse-core/audits/seo/crawlable-anchors.js +10 -12
- package/lighthouse-core/computed/js-bundles.js +1 -2
- package/lighthouse-core/computed/unused-javascript-summary.js +3 -3
- package/lighthouse-core/config/config-helpers.js +1 -0
- package/lighthouse-core/config/config.js +2 -2
- package/lighthouse-core/config/default-config.js +5 -0
- package/lighthouse-core/fraggle-rock/api.js +10 -0
- package/lighthouse-core/fraggle-rock/config/filters.js +22 -3
- package/lighthouse-core/fraggle-rock/gather/driver.js +4 -0
- package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +2 -2
- package/lighthouse-core/fraggle-rock/user-flow.js +35 -6
- package/lighthouse-core/gather/driver/navigation.js +5 -0
- package/lighthouse-core/gather/driver/prepare.js +14 -0
- package/lighthouse-core/gather/driver/storage.js +5 -0
- package/lighthouse-core/gather/gather-runner.js +2 -2
- package/lighthouse-core/gather/gatherers/dobetterweb/response-compression.js +5 -1
- package/lighthouse-core/gather/gatherers/full-page-screenshot.js +30 -24
- package/lighthouse-core/lib/cdt/Platform.js +55 -0
- package/lighthouse-core/lib/cdt/SDK.js +3 -123
- package/lighthouse-core/lib/cdt/generated/SourceMap.js +148 -312
- package/lighthouse-core/lib/csp-evaluator.js +2 -1
- package/lighthouse-core/lib/i18n/README.md +6 -6
- package/lighthouse-core/lib/i18n/i18n.js +26 -348
- package/lighthouse-core/lib/page-functions.js +4 -4
- package/lighthouse-core/lib/stack-packs.js +1 -13
- package/lighthouse-core/runner.js +6 -6
- package/lighthouse-core/scripts/manual-chrome-launcher.js +4 -1
- package/lighthouse-core/scripts/package.json +4 -0
- package/lighthouse-core/util-commonjs.js +20 -4
- package/package.json +19 -16
- package/readme.md +1 -1
- package/report/assets/standalone-template.html +0 -1
- package/report/assets/styles.css +16 -41
- package/report/assets/templates.html +42 -4
- package/report/clients/psi.js +1 -0
- package/report/clients/standalone.js +1 -2
- package/report/generator/file-namer.js +17 -8
- package/report/generator/report-generator.js +0 -1
- package/report/renderer/category-renderer.js +4 -16
- package/report/renderer/components.js +107 -71
- package/report/renderer/dom.js +19 -0
- package/report/renderer/logger.js +35 -2
- package/report/renderer/performance-category-renderer.js +23 -21
- package/report/renderer/pwa-category-renderer.js +1 -2
- package/report/renderer/report-renderer.js +21 -0
- package/report/renderer/report-ui-features.js +7 -19
- package/report/renderer/swap-locale-feature.js +82 -0
- package/report/renderer/util.js +20 -4
- package/report/test/clients/psi-test.js +0 -4
- package/report/test/generator/file-namer-test.js +2 -2
- package/report/test/renderer/category-renderer-test.js +1 -1
- package/report/test/renderer/performance-category-renderer-test.js +12 -0
- package/report/test/renderer/report-renderer-axe-test.js +86 -0
- package/report/test/renderer/report-renderer-test.js +0 -55
- package/report/test/renderer/util-test.js +68 -8
- package/report/test-assets/faux-psi-template.html +0 -1
- package/report/tsconfig.json +2 -1
- package/report/types/html-renderer.d.ts +2 -1
- package/root.js +18 -0
- package/shared/localization/format.js +455 -0
- package/{lighthouse-core/lib/cdt/Common.js → shared/localization/i18n-module.js} +3 -8
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/ar-XB.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/ar.json +141 -6
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/bg.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/ca.json +140 -5
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/cs.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/da.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/de.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/el.json +141 -6
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-GB.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-US.json +129 -0
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-XA.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-XL.json +129 -0
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/es-419.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/es.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/fi.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/fil.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/fr.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/he.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/hi.json +142 -7
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/hr.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/hu.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/id.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/it.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/ja.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/ko.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/lt.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/lv.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/nl.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/no.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/pl.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/pt-PT.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/pt.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/ro.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/ru.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/sk.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/sl.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/sr-Latn.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/sr.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/sv.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/ta.json +146 -11
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/te.json +179 -44
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/th.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/tr.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/uk.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/vi.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/zh-HK.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/zh-TW.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/zh.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales.js +8 -1
- package/shared/localization/swap-flow-locale.js +20 -0
- package/{lighthouse-core/lib/i18n → shared/localization}/swap-locale.js +9 -7
- package/shared/test/localization/format-test.js +421 -0
- package/shared/test/localization/locales-test.js +47 -0
- package/shared/test/localization/swap-locale-test.js +140 -0
- package/shared/tsconfig.json +22 -0
- package/{lighthouse-core/lib → shared}/type-verifiers.js +0 -0
- package/shared/types/shared.d.ts +24 -0
- package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +5 -3
- package/third-party/chromium-synchronization/installability-errors-test.js +2 -1
- package/tsconfig-all.json +1 -0
- package/tsconfig-base.json +1 -1
- package/tsconfig.json +2 -3
- package/types/config.d.ts +1 -0
- package/types/es-main.d.ts +18 -0
- package/types/externs.d.ts +2 -0
- package/types/lhr/flow.d.ts +7 -0
- package/types/lhr/i18n.d.ts +0 -3
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {FunctionComponent} from 'preact';
|
|
8
|
+
|
|
9
|
+
import {Util} from '../../report/renderer/util';
|
|
10
|
+
import {FlowStepIcon, FlowStepThumbnail} from './common';
|
|
11
|
+
import {useUIStrings} from './i18n/i18n';
|
|
12
|
+
import {getModeDescription, useFlowResult} from './util';
|
|
13
|
+
|
|
14
|
+
const SIDE_THUMBNAIL_HEIGHT = 80;
|
|
15
|
+
const MAIN_THUMBNAIL_HEIGHT = 120;
|
|
16
|
+
|
|
17
|
+
const HeaderThumbnail: FunctionComponent<{
|
|
18
|
+
reportResult: LH.ReportResult,
|
|
19
|
+
position: 'prev'|'next'|'main'
|
|
20
|
+
}> =
|
|
21
|
+
({reportResult, position}) => {
|
|
22
|
+
const height = position === 'main' ? MAIN_THUMBNAIL_HEIGHT : SIDE_THUMBNAIL_HEIGHT;
|
|
23
|
+
return (
|
|
24
|
+
<div className={`HeaderThumbnail HeaderThumbnail--${position}`}>
|
|
25
|
+
<FlowStepThumbnail reportResult={reportResult} height={height}/>
|
|
26
|
+
<div className="HeaderThumbnail__icon">
|
|
27
|
+
<FlowStepIcon mode={reportResult.gatherMode}/>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const Header: FunctionComponent<{currentLhr: LH.FlowResult.LhrRef}> =
|
|
34
|
+
({currentLhr}) => {
|
|
35
|
+
const flowResult = useFlowResult();
|
|
36
|
+
const {index} = currentLhr;
|
|
37
|
+
|
|
38
|
+
const step = flowResult.steps[index];
|
|
39
|
+
const prevStep = flowResult.steps[index - 1];
|
|
40
|
+
const nextStep = flowResult.steps[index + 1];
|
|
41
|
+
|
|
42
|
+
const strings = useUIStrings();
|
|
43
|
+
const modeDescription = getModeDescription(step.lhr.gatherMode, strings);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div className="Header">
|
|
47
|
+
{
|
|
48
|
+
prevStep && <>
|
|
49
|
+
{
|
|
50
|
+
flowResult.steps[index - 2] && <div className="Header__segment"/>
|
|
51
|
+
}
|
|
52
|
+
<div className="Header__prev-thumbnail">
|
|
53
|
+
<HeaderThumbnail reportResult={Util.prepareReportResult(prevStep.lhr)} position="prev"/>
|
|
54
|
+
<div className="Header__segment"/>
|
|
55
|
+
</div>
|
|
56
|
+
<a
|
|
57
|
+
className="Header__prev-title"
|
|
58
|
+
href={`#index=${index - 1}`}
|
|
59
|
+
>{prevStep.name}</a>
|
|
60
|
+
</>
|
|
61
|
+
}
|
|
62
|
+
<div className="Header__current-thumbnail">
|
|
63
|
+
<HeaderThumbnail reportResult={Util.prepareReportResult(step.lhr)} position="main"/>
|
|
64
|
+
</div>
|
|
65
|
+
<div className="Header__current-title">
|
|
66
|
+
{step.name}
|
|
67
|
+
<div className="Header__current-description">
|
|
68
|
+
{modeDescription}
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
{
|
|
72
|
+
nextStep && <>
|
|
73
|
+
<div className="Header__next-thumbnail">
|
|
74
|
+
<div className="Header__segment"/>
|
|
75
|
+
<HeaderThumbnail reportResult={Util.prepareReportResult(nextStep.lhr)} position="next"/>
|
|
76
|
+
</div>
|
|
77
|
+
<a
|
|
78
|
+
className="Header__next-title"
|
|
79
|
+
href={`#index=${index + 1}`}
|
|
80
|
+
>{nextStep.name}</a>
|
|
81
|
+
{
|
|
82
|
+
flowResult.steps[index + 2] && <div className="Header__segment"/>
|
|
83
|
+
}
|
|
84
|
+
</>
|
|
85
|
+
}
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {FunctionComponent, JSX} from 'preact';
|
|
8
|
+
|
|
9
|
+
import {useUIStrings} from './i18n/i18n';
|
|
10
|
+
import {CloseIcon, NavigationIcon, SnapshotIcon, TimespanIcon} from './icons';
|
|
11
|
+
|
|
12
|
+
const HelpDialogColumn: FunctionComponent<{
|
|
13
|
+
icon: JSX.Element,
|
|
14
|
+
userFriendlyModeLabel: string;
|
|
15
|
+
lighthouseOfficialModeLabel: string;
|
|
16
|
+
modeDescription: string;
|
|
17
|
+
useCaseInstruction: string;
|
|
18
|
+
useCases: string[];
|
|
19
|
+
availableCategories: string[];
|
|
20
|
+
}> = (props) => {
|
|
21
|
+
const strings = useUIStrings();
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className="HelpDialogColumn">
|
|
25
|
+
<div className="HelpDialogColumn__legend">
|
|
26
|
+
<div className="HelpDialogColumnTimeline">
|
|
27
|
+
{props.icon}
|
|
28
|
+
<div className="HelpDialogColumnTimeline__line" />
|
|
29
|
+
</div>
|
|
30
|
+
<div className="HelpDialogColumn__legend-label">{props.userFriendlyModeLabel}</div>
|
|
31
|
+
</div>
|
|
32
|
+
<div className="HelpDialogColumn__header">
|
|
33
|
+
<div className="HelpDialogColumn__header-title">{props.lighthouseOfficialModeLabel}</div>
|
|
34
|
+
<p>{props.modeDescription}</p>
|
|
35
|
+
</div>
|
|
36
|
+
<div className="HelpDialogColumn__use-cases">
|
|
37
|
+
<p>{props.useCaseInstruction}</p>
|
|
38
|
+
<ul>
|
|
39
|
+
{props.useCases.map((useCase, i) => (
|
|
40
|
+
<li key={i}>{useCase}</li>
|
|
41
|
+
))}
|
|
42
|
+
</ul>
|
|
43
|
+
</div>
|
|
44
|
+
<div className="HelpDialogColumn__categories">
|
|
45
|
+
<p>{strings.categories}</p>
|
|
46
|
+
<ul>
|
|
47
|
+
{props.availableCategories.map((category, i) => (
|
|
48
|
+
<li key={i}>{category}</li>
|
|
49
|
+
))}
|
|
50
|
+
</ul>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const HelpDialog: FunctionComponent<{onClose: () => void}> = ({
|
|
57
|
+
onClose,
|
|
58
|
+
}) => {
|
|
59
|
+
const strings = useUIStrings();
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div className="HelpDialog">
|
|
63
|
+
<div className="HelpDialog__title">
|
|
64
|
+
<div>{strings.helpDialogTitle}</div>
|
|
65
|
+
<div style={{flexGrow: 1}} />
|
|
66
|
+
<button className="HelpDialog__close" onClick={onClose}>
|
|
67
|
+
<CloseIcon />
|
|
68
|
+
</button>
|
|
69
|
+
</div>
|
|
70
|
+
<div className="HelpDialog__columns">
|
|
71
|
+
<HelpDialogColumn
|
|
72
|
+
icon={<NavigationIcon />}
|
|
73
|
+
userFriendlyModeLabel={strings.navigationDescription}
|
|
74
|
+
lighthouseOfficialModeLabel={strings.navigationReport}
|
|
75
|
+
modeDescription={strings.navigationLongDescription}
|
|
76
|
+
useCaseInstruction={strings.helpUseCaseInstructionNavigation}
|
|
77
|
+
useCases={[
|
|
78
|
+
strings.helpUseCaseNavigation1,
|
|
79
|
+
strings.helpUseCaseNavigation2,
|
|
80
|
+
strings.helpUseCaseNavigation3,
|
|
81
|
+
]}
|
|
82
|
+
availableCategories={[
|
|
83
|
+
strings.categoryPerformance,
|
|
84
|
+
strings.categoryAccessibility,
|
|
85
|
+
strings.categoryBestPractices,
|
|
86
|
+
strings.categorySeo,
|
|
87
|
+
strings.categoryProgressiveWebApp,
|
|
88
|
+
]}
|
|
89
|
+
/>
|
|
90
|
+
<HelpDialogColumn
|
|
91
|
+
icon={<TimespanIcon />}
|
|
92
|
+
userFriendlyModeLabel={strings.timespanDescription}
|
|
93
|
+
lighthouseOfficialModeLabel={strings.timespanReport}
|
|
94
|
+
modeDescription={strings.timespanLongDescription}
|
|
95
|
+
useCaseInstruction={strings.helpUseCaseInstructionTimespan}
|
|
96
|
+
useCases={[strings.helpUseCaseTimespan1, strings.helpUseCaseTimespan2]}
|
|
97
|
+
availableCategories={[
|
|
98
|
+
strings.categoryPerformance,
|
|
99
|
+
strings.categoryBestPractices,
|
|
100
|
+
strings.categorySeo,
|
|
101
|
+
]}
|
|
102
|
+
/>
|
|
103
|
+
<HelpDialogColumn
|
|
104
|
+
icon={<SnapshotIcon />}
|
|
105
|
+
userFriendlyModeLabel={strings.snapshotDescription}
|
|
106
|
+
lighthouseOfficialModeLabel={strings.snapshotReport}
|
|
107
|
+
modeDescription={strings.snapshotLongDescription}
|
|
108
|
+
useCaseInstruction={strings.helpUseCaseInstructionSnapshot}
|
|
109
|
+
useCases={[strings.helpUseCaseSnapshot1, strings.helpUseCaseSnapshot2]}
|
|
110
|
+
availableCategories={[
|
|
111
|
+
strings.categoryPerformance,
|
|
112
|
+
strings.categoryAccessibility,
|
|
113
|
+
strings.categoryBestPractices,
|
|
114
|
+
strings.categorySeo,
|
|
115
|
+
]}
|
|
116
|
+
/>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
);
|
|
120
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {createContext, FunctionComponent} from 'preact';
|
|
8
|
+
import {useContext, useMemo} from 'preact/hooks';
|
|
9
|
+
|
|
10
|
+
import {formatMessage} from '../../../shared/localization/format';
|
|
11
|
+
import {I18n} from '../../../report/renderer/i18n';
|
|
12
|
+
import {UIStrings} from './ui-strings';
|
|
13
|
+
import {useLocale} from '../util';
|
|
14
|
+
import strings from './localized-strings';
|
|
15
|
+
|
|
16
|
+
const I18nContext = createContext<I18n<typeof UIStrings>|undefined>(undefined);
|
|
17
|
+
|
|
18
|
+
export function useI18n() {
|
|
19
|
+
const i18n = useContext(I18nContext);
|
|
20
|
+
if (!i18n) throw Error('i18n was not initialized');
|
|
21
|
+
return i18n;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function useUIStrings() {
|
|
25
|
+
const i18n = useI18n();
|
|
26
|
+
return i18n.strings;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function useStringFormatter() {
|
|
30
|
+
const locale = useLocale();
|
|
31
|
+
return (str: string, values?: Record<string, string|number>) => {
|
|
32
|
+
return formatMessage(str, values, locale);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const I18nProvider: FunctionComponent = ({children}) => {
|
|
37
|
+
const locale = useLocale();
|
|
38
|
+
const i18n = useMemo(() => new I18n(locale, {
|
|
39
|
+
// Set missing renderer strings to default (english) values.
|
|
40
|
+
...UIStrings,
|
|
41
|
+
// `strings` is generated in build/build-report.js
|
|
42
|
+
...strings[locale],
|
|
43
|
+
}), [locale]);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<I18nContext.Provider value={i18n}>
|
|
47
|
+
{children}
|
|
48
|
+
</I18nContext.Provider>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** @type {Record<LH.Locale, import('./ui-strings.js').UIStringsType>} */
|
|
8
|
+
// @ts-expect-error This will be replaced with the localized strings at build time.
|
|
9
|
+
const strings = {};
|
|
10
|
+
|
|
11
|
+
export default strings;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** @typedef {typeof UIStrings} UIStringsType */
|
|
8
|
+
|
|
9
|
+
/* eslint-disable max-len */
|
|
10
|
+
|
|
11
|
+
export const UIStrings = {
|
|
12
|
+
/** Description of a report that evaluates a web page as it loads, but before the user interacts with it. */
|
|
13
|
+
navigationDescription: 'Page load',
|
|
14
|
+
/** Description of a report that evaluates a web page over a period of time where a user could have interacted with the page. */
|
|
15
|
+
timespanDescription: 'User interactions',
|
|
16
|
+
/** Description of a report that evaluates the state of a web page at a single point in time. */
|
|
17
|
+
snapshotDescription: 'Captured state of page',
|
|
18
|
+
/** Long-form description of a report that evaluates a web page as it loads, but before the user interacts with it. */
|
|
19
|
+
navigationLongDescription: 'Navigation reports analyze a single page load, exactly like the original Lighthouse reports.',
|
|
20
|
+
/** Long-form description of a report that evaluates a web page over a period of time where a user could have interacted with the page. */
|
|
21
|
+
timespanLongDescription: 'Timespan reports analyze an arbitrary period of time, typically containing user interactions.',
|
|
22
|
+
/** Long-form description of a report that evaluates the state of a web page at a single point in time. */
|
|
23
|
+
snapshotLongDescription: 'Snapshot reports analyze the page in a particular state, typically after user interactions.',
|
|
24
|
+
/** Label for a report that evaluates a page navigation. */
|
|
25
|
+
navigationReport: 'Navigation report',
|
|
26
|
+
/** Label for a report that evaluates a period of time where a user could have interacted with the page. */
|
|
27
|
+
timespanReport: 'Timespan report',
|
|
28
|
+
/** Label for a report that evaluates the state of a web page at a single point in time. */
|
|
29
|
+
snapshotReport: 'Snapshot report',
|
|
30
|
+
/** Title of a home page that summarizes and links to the other pages. */
|
|
31
|
+
summary: 'Summary',
|
|
32
|
+
/** Title of a report section lists and links to multiple sub-reports. */
|
|
33
|
+
allReports: 'All Reports',
|
|
34
|
+
/** Default title of a Lighthouse report over a user flow. "User Flow" refers to a series of user interactions on a page that a site developer wants to test. "Lighthouse" is a product name https://developers.google.com/web/tools/lighthouse. */
|
|
35
|
+
title: 'Lighthouse User Flow Report',
|
|
36
|
+
/** Label for a list of Lighthouse categories. */
|
|
37
|
+
categories: 'Categories',
|
|
38
|
+
/** Title of the Performance category of audits. Equivalent to 'Web performance', this term is inclusive of all web page speed and loading optimization topics. Also used as a label of a score gauge; try to limit to 20 characters. */
|
|
39
|
+
categoryPerformance: 'Performance',
|
|
40
|
+
/** Title of the Accessibility category of audits. This section contains audits focused on making web content accessible to all users. Also used as a label of a score gauge; try to limit to 20 characters. */
|
|
41
|
+
categoryAccessibility: 'Accessibility',
|
|
42
|
+
/** Title of the Best Practices category of audits. This is displayed at the top of a list of audits focused on topics related to following web development best practices and accepted guidelines. Also used as a label of a score gauge; try to limit to 20 characters. */
|
|
43
|
+
categoryBestPractices: 'Best Practices',
|
|
44
|
+
/** Title of the Search Engine Optimization (SEO) category of audits. This is displayed at the top of a list of audits focused on topics related to optimizing a website for indexing by search engines. Also used as a label of a score gauge; try to limit to 20 characters. */
|
|
45
|
+
categorySeo: 'SEO',
|
|
46
|
+
/** Title of the Progressive Web Application (PWA) category of audits. This is displayed at the top of a list of audits focused on topics related to whether or not a site is a progressive web app, e.g. responds offline, uses a service worker, is on https, etc. Also used as a label of a score gauge. */
|
|
47
|
+
categoryProgressiveWebApp: 'Progressive Web App',
|
|
48
|
+
/** Label for a report evaluating a web page. Label indicates that the report refers to the desktop version of the site. */
|
|
49
|
+
desktop: 'Desktop',
|
|
50
|
+
/** Label for a report evaluating a web page. Label indicates that the report refers to the mobile version of the site. */
|
|
51
|
+
mobile: 'Mobile',
|
|
52
|
+
/** Rating indicating that a report category is good/passing. */
|
|
53
|
+
ratingPass: 'Good',
|
|
54
|
+
/** Rating indicating that a report category is average or needs improvement. */
|
|
55
|
+
ratingAverage: 'Average',
|
|
56
|
+
/** Rating indicating that a report category is poor/failing. */
|
|
57
|
+
ratingFail: 'Poor',
|
|
58
|
+
/** Rating indicating that a report category rating could not be calculated because of an error. */
|
|
59
|
+
ratingError: 'Error',
|
|
60
|
+
/**
|
|
61
|
+
* @description Label indicating the number of Lighthouse reports that evaluate a web page as it loads.
|
|
62
|
+
* @example {2} numNavigation
|
|
63
|
+
*/
|
|
64
|
+
navigationReportCount: `{numNavigation, plural,
|
|
65
|
+
=1 {{numNavigation} navigation report}
|
|
66
|
+
other {{numNavigation} navigation reports}
|
|
67
|
+
}`,
|
|
68
|
+
/**
|
|
69
|
+
* @description Label indicating the number of Lighthouse reports that evaluate a web page over a period of time.
|
|
70
|
+
* @example {2} numTimespan
|
|
71
|
+
*/
|
|
72
|
+
timespanReportCount: `{numTimespan, plural,
|
|
73
|
+
=1 {{numTimespan} timespan report}
|
|
74
|
+
other {{numTimespan} timespan reports}
|
|
75
|
+
}`,
|
|
76
|
+
/**
|
|
77
|
+
* @description Label indicating the number of Lighthouse reports that evaluate a web page at a single point in time.
|
|
78
|
+
* @example {2} numSnapshot
|
|
79
|
+
*/
|
|
80
|
+
snapshotReportCount: `{numSnapshot, plural,
|
|
81
|
+
=1 {{numSnapshot} snapshot report}
|
|
82
|
+
other {{numSnapshot} snapshot reports}
|
|
83
|
+
}`,
|
|
84
|
+
/** Label for a button that saves a Lighthouse report to disk. */
|
|
85
|
+
save: 'Save',
|
|
86
|
+
/** Label for a button that toggles the help modal with explanations on how to interpret the Lighthouse flow report. */
|
|
87
|
+
helpLabel: 'Understanding Flows',
|
|
88
|
+
/** Title for a dialog that contains explanations on how to interpret the Lighthouse flow report. */
|
|
89
|
+
helpDialogTitle: 'Understanding the Lighthouse Flow Report',
|
|
90
|
+
/** Label for a list of example use cases for a mode in lighthouse that evaluates a web page as it loads, but before the user interacts with it. */
|
|
91
|
+
helpUseCaseInstructionNavigation: 'Use Navigation reports to...',
|
|
92
|
+
/** Label for a list of example use cases for a mode in lighthouse that evaluates a web page over a period of time where a user could have interacted with the page. */
|
|
93
|
+
helpUseCaseInstructionTimespan: 'Use Timespan reports to...',
|
|
94
|
+
/** Label for a list of example use cases for a mode in lighthouse that evaluates the state of a web page at a single point in time. */
|
|
95
|
+
helpUseCaseInstructionSnapshot: 'Use Snapshot reports to...',
|
|
96
|
+
/** Example use case for how Lighthouse can be applied in practice. Appears in a list with other examples. */
|
|
97
|
+
helpUseCaseNavigation1: 'Obtain a Lighthouse Performance score.',
|
|
98
|
+
/** Example use case for how Lighthouse can be applied in practice. Appears in a list with other examples. */
|
|
99
|
+
helpUseCaseNavigation2: 'Measure page load Performance metrics such as Largest Contentful Paint and Speed Index.',
|
|
100
|
+
/** Example use case for how Lighthouse can be applied in practice. Appears in a list with other examples. */
|
|
101
|
+
helpUseCaseNavigation3: 'Assess Progressive Web App capabilities.',
|
|
102
|
+
/** Example use case for how Lighthouse can be applied in practice. Appears in a list with other examples. */
|
|
103
|
+
helpUseCaseTimespan1: 'Measure layout shifts and JavaScript execution time on a series of interactions.',
|
|
104
|
+
/** Example use case for how Lighthouse can be applied in practice. Appears in a list with other examples. */
|
|
105
|
+
helpUseCaseTimespan2: 'Discover performance opportunities to improve the experience for long-lived pages and single-page applications.',
|
|
106
|
+
/** Example use case for how Lighthouse can be applied in practice. Appears in a list with other examples. */
|
|
107
|
+
helpUseCaseSnapshot1: 'Find accessibility issues in single page applications or complex forms.',
|
|
108
|
+
/** Example use case for how Lighthouse can be applied in practice. Appears in a list with other examples. */
|
|
109
|
+
helpUseCaseSnapshot2: 'Evaluate best practices of menus and UI elements hidden behind interaction.',
|
|
110
|
+
/**
|
|
111
|
+
* @description Label indicating the number of Lighthouse audits that passed.
|
|
112
|
+
* @example {2} numPassed
|
|
113
|
+
*/
|
|
114
|
+
passedAuditCount: `{numPassed, plural,
|
|
115
|
+
=1 {{numPassed} audit passed}
|
|
116
|
+
other {{numPassed} audits passed}
|
|
117
|
+
}`,
|
|
118
|
+
/**
|
|
119
|
+
* @description Label indicating the number of Lighthouse audits that are possible to pass for a page.
|
|
120
|
+
* @example {2} numPassableAudits
|
|
121
|
+
*/
|
|
122
|
+
passableAuditCount: `{numPassableAudits, plural,
|
|
123
|
+
=1 {{numPassableAudits} passable audit}
|
|
124
|
+
other {{numPassableAudits} passable audits}
|
|
125
|
+
}`,
|
|
126
|
+
/**
|
|
127
|
+
* @description Label indicating the number of Lighthouse audits that are informative.
|
|
128
|
+
* @example {2} numInformative
|
|
129
|
+
*/
|
|
130
|
+
informativeAuditCount: `{numInformative, plural,
|
|
131
|
+
=1 {{numInformative} informative audit}
|
|
132
|
+
other {{numInformative} informative audits}
|
|
133
|
+
}`,
|
|
134
|
+
};
|
|
@@ -79,6 +79,23 @@ export const SnapshotIcon: FunctionComponent = () => {
|
|
|
79
79
|
);
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
+
export const CloseIcon: FunctionComponent = () => {
|
|
83
|
+
return (
|
|
84
|
+
<svg
|
|
85
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
86
|
+
height="24px"
|
|
87
|
+
viewBox="0 0 24 24"
|
|
88
|
+
width="24px"
|
|
89
|
+
fill="currentColor"
|
|
90
|
+
role="img"
|
|
91
|
+
aria-label="Icon representing a close action"
|
|
92
|
+
>
|
|
93
|
+
<path d="M0 0h24v24H0V0z" fill="none" />
|
|
94
|
+
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" />
|
|
95
|
+
</svg>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
82
99
|
export const EnvIcon: FunctionComponent = () => {
|
|
83
100
|
return (
|
|
84
101
|
<svg width="15" height="12" viewBox="0 0 15 12" fill="none" role="img">
|
|
@@ -98,9 +115,9 @@ export const CpuIcon: FunctionComponent = () => {
|
|
|
98
115
|
export const HamburgerIcon: FunctionComponent = () => {
|
|
99
116
|
return (
|
|
100
117
|
<svg viewBox="0 0 18 12" width="18" height="12" role="img">
|
|
101
|
-
<rect width="18" height="2"></rect>
|
|
102
|
-
<rect y="5" width="18" height="2"></rect>
|
|
103
|
-
<rect y="10" width="18" height="2"></rect>
|
|
118
|
+
<rect width="18" height="2" fill="currentColor"></rect>
|
|
119
|
+
<rect y="5" width="18" height="2" fill="currentColor"></rect>
|
|
120
|
+
<rect y="10" width="18" height="2" fill="currentColor"></rect>
|
|
104
121
|
</svg>
|
|
105
122
|
);
|
|
106
123
|
};
|
|
@@ -5,15 +5,17 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {FunctionComponent} from 'preact';
|
|
8
|
-
import {useMemo} from 'preact/hooks';
|
|
9
8
|
|
|
10
9
|
import {Separator} from '../common';
|
|
10
|
+
import {useI18n, useUIStrings} from '../i18n/i18n';
|
|
11
11
|
import {CpuIcon, EnvIcon, SummaryIcon} from '../icons';
|
|
12
|
-
import {classNames, useCurrentLhr, useFlowResult
|
|
12
|
+
import {classNames, useCurrentLhr, useFlowResult} from '../util';
|
|
13
13
|
import {SidebarFlow} from './flow';
|
|
14
14
|
|
|
15
15
|
export const SidebarSummary: FunctionComponent = () => {
|
|
16
16
|
const currentLhr = useCurrentLhr();
|
|
17
|
+
const strings = useUIStrings();
|
|
18
|
+
|
|
17
19
|
const url = new URL(location.href);
|
|
18
20
|
url.hash = '#';
|
|
19
21
|
return (
|
|
@@ -25,12 +27,14 @@ export const SidebarSummary: FunctionComponent = () => {
|
|
|
25
27
|
<div className="SidebarSummary__icon">
|
|
26
28
|
<SummaryIcon/>
|
|
27
29
|
</div>
|
|
28
|
-
<div className="SidebarSummary__label">
|
|
30
|
+
<div className="SidebarSummary__label">{strings.summary}</div>
|
|
29
31
|
</a>
|
|
30
32
|
);
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
const SidebarRuntimeSettings: FunctionComponent<{settings: LH.ConfigSettings}> = ({settings}) => {
|
|
36
|
+
const strings = useUIStrings();
|
|
37
|
+
|
|
34
38
|
return (
|
|
35
39
|
<div className="SidebarRuntimeSettings">
|
|
36
40
|
<div className="SidebarRuntimeSettings__item">
|
|
@@ -38,8 +42,7 @@ const SidebarRuntimeSettings: FunctionComponent<{settings: LH.ConfigSettings}> =
|
|
|
38
42
|
<EnvIcon/>
|
|
39
43
|
</div>
|
|
40
44
|
{
|
|
41
|
-
|
|
42
|
-
`${settings.screenEmulation.height}x${settings.screenEmulation.width}px`
|
|
45
|
+
settings.formFactor === 'desktop' ? strings.desktop : strings.mobile
|
|
43
46
|
}
|
|
44
47
|
</div>
|
|
45
48
|
<div className="SidebarRuntimeSettings__item">
|
|
@@ -55,19 +58,11 @@ const SidebarRuntimeSettings: FunctionComponent<{settings: LH.ConfigSettings}> =
|
|
|
55
58
|
};
|
|
56
59
|
|
|
57
60
|
export const SidebarHeader: FunctionComponent<{title: string, date: string}> = ({title, date}) => {
|
|
58
|
-
const
|
|
59
|
-
const formatter = useMemo(() => {
|
|
60
|
-
const options: Intl.DateTimeFormatOptions = {
|
|
61
|
-
month: 'short', day: 'numeric', year: 'numeric',
|
|
62
|
-
hour: 'numeric', minute: 'numeric', timeZoneName: 'short',
|
|
63
|
-
};
|
|
64
|
-
return new Intl.DateTimeFormat(locale, options);
|
|
65
|
-
}, [locale]);
|
|
66
|
-
const dateString = useMemo(() => formatter.format(new Date(date)), [date, formatter]);
|
|
61
|
+
const i18n = useI18n();
|
|
67
62
|
return (
|
|
68
63
|
<div className="SidebarHeader">
|
|
69
64
|
<div className="SidebarHeader__title">{title}</div>
|
|
70
|
-
<div className="SidebarHeader__date">{
|
|
65
|
+
<div className="SidebarHeader__date">{i18n.formatDateTime(date)}</div>
|
|
71
66
|
</div>
|
|
72
67
|
);
|
|
73
68
|
};
|
|
@@ -77,7 +72,7 @@ export const Sidebar: FunctionComponent = () => {
|
|
|
77
72
|
const firstLhr = flowResult.steps[0].lhr;
|
|
78
73
|
return (
|
|
79
74
|
<div className="Sidebar">
|
|
80
|
-
<SidebarHeader title=
|
|
75
|
+
<SidebarHeader title={flowResult.name} date={firstLhr.fetchTime}/>
|
|
81
76
|
<Separator/>
|
|
82
77
|
<SidebarSummary/>
|
|
83
78
|
<Separator/>
|
|
@@ -9,34 +9,48 @@ import {FunctionComponent} from 'preact';
|
|
|
9
9
|
import {Util} from '../../../report/renderer/util';
|
|
10
10
|
import {Separator} from '../common';
|
|
11
11
|
import {CategoryScore} from '../wrappers/category-score';
|
|
12
|
+
import {useStringFormatter, useUIStrings} from '../i18n/i18n';
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
'navigation': 'Navigation report',
|
|
15
|
-
'timespan': 'Timespan report',
|
|
16
|
-
'snapshot': 'Snapshot report',
|
|
17
|
-
};
|
|
14
|
+
import type {UIStringsType} from '../i18n/ui-strings';
|
|
18
15
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
16
|
+
function getGatherModeLabel(gatherMode: LH.Result.GatherMode, strings: UIStringsType) {
|
|
17
|
+
switch (gatherMode) {
|
|
18
|
+
case 'navigation': return strings.navigationReport;
|
|
19
|
+
case 'timespan': return strings.timespanReport;
|
|
20
|
+
case 'snapshot': return strings.snapshotReport;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getCategoryRating(rating: string, strings: UIStringsType) {
|
|
25
|
+
switch (rating) {
|
|
26
|
+
case 'pass': return strings.ratingPass;
|
|
27
|
+
case 'average': return strings.ratingAverage;
|
|
28
|
+
case 'fail': return strings.ratingFail;
|
|
29
|
+
case 'error': return strings.ratingError;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
25
32
|
|
|
26
33
|
export const SummaryTooltip: FunctionComponent<{
|
|
27
34
|
category: LH.ReportResult.Category,
|
|
28
35
|
gatherMode: LH.Result.GatherMode
|
|
29
36
|
}> = ({category, gatherMode}) => {
|
|
30
|
-
const
|
|
37
|
+
const strings = useUIStrings();
|
|
38
|
+
const str_ = useStringFormatter();
|
|
39
|
+
const {
|
|
40
|
+
numPassed,
|
|
41
|
+
numPassableAudits,
|
|
42
|
+
numInformative,
|
|
43
|
+
totalWeight,
|
|
44
|
+
} = Util.calculateCategoryFraction(category);
|
|
31
45
|
|
|
32
46
|
const displayAsFraction = Util.shouldDisplayAsFraction(gatherMode);
|
|
33
47
|
const rating = displayAsFraction ?
|
|
34
|
-
Util.calculateRating(numPassed /
|
|
48
|
+
Util.calculateRating(numPassed / numPassableAudits) :
|
|
35
49
|
Util.calculateRating(category.score);
|
|
36
50
|
|
|
37
51
|
return (
|
|
38
52
|
<div className="SummaryTooltip">
|
|
39
|
-
<div className="SummaryTooltip__title">{
|
|
53
|
+
<div className="SummaryTooltip__title">{getGatherModeLabel(gatherMode, strings)}</div>
|
|
40
54
|
<Separator/>
|
|
41
55
|
<div className="SummaryTooltip__category">
|
|
42
56
|
<div className="SummaryTooltip__category-title">
|
|
@@ -44,11 +58,8 @@ export const SummaryTooltip: FunctionComponent<{
|
|
|
44
58
|
</div>
|
|
45
59
|
{
|
|
46
60
|
totalWeight !== 0 &&
|
|
47
|
-
<div
|
|
48
|
-
|
|
49
|
-
data-testid="SummaryTooltip__rating"
|
|
50
|
-
>
|
|
51
|
-
<span>{RATING_LABELS[rating]}</span>
|
|
61
|
+
<div className={`SummaryTooltip__rating SummaryTooltip__rating--${rating}`}>
|
|
62
|
+
<span>{getCategoryRating(rating, strings)}</span>
|
|
52
63
|
{
|
|
53
64
|
!displayAsFraction && category.score && <>
|
|
54
65
|
<span> · </span>
|
|
@@ -59,8 +70,15 @@ export const SummaryTooltip: FunctionComponent<{
|
|
|
59
70
|
}
|
|
60
71
|
</div>
|
|
61
72
|
<div className="SummaryTooltip__fraction">
|
|
62
|
-
{
|
|
73
|
+
<span>{str_(strings.passedAuditCount, {numPassed})}</span>
|
|
74
|
+
<span> / </span>
|
|
75
|
+
<span>{str_(strings.passableAuditCount, {numPassableAudits})}</span>
|
|
63
76
|
</div>
|
|
77
|
+
{numInformative !== 0 &&
|
|
78
|
+
<div className="SummaryTooltip__informative">
|
|
79
|
+
{str_(strings.informativeAuditCount, {numInformative})}
|
|
80
|
+
</div>
|
|
81
|
+
}
|
|
64
82
|
</div>
|
|
65
83
|
);
|
|
66
84
|
};
|
|
@@ -82,10 +100,7 @@ export const SummaryCategory: FunctionComponent<{
|
|
|
82
100
|
/>
|
|
83
101
|
<SummaryTooltip category={category} gatherMode={gatherMode}/>
|
|
84
102
|
</div> :
|
|
85
|
-
<div
|
|
86
|
-
className="SummaryCategory__null"
|
|
87
|
-
data-testid="SummaryCategory__null"
|
|
88
|
-
/>
|
|
103
|
+
<div className="SummaryCategory__null" data-testid="SummaryCategory__null"/>
|
|
89
104
|
}
|
|
90
105
|
</div>
|
|
91
106
|
);
|