Display differential download size in UI

This commit is contained in:
Fedor Indutny 2022-02-25 10:44:03 -08:00 committed by GitHub
parent 052a8e65e2
commit 29c2f77d40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 320 additions and 151 deletions

View file

@ -81,6 +81,18 @@ story.add('Knobs Playground', () => {
<DialogUpdate
{...defaultPropsForBreakpoint}
dialogType={DialogType.DownloadReady}
downloadSize={30123456}
currentVersion="5.24.0"
/>
</FakeLeftPaneContainer>
));
story.add(`Full Download Ready (${name} container)`, () => (
<FakeLeftPaneContainer containerWidthBreakpoint={containerWidthBreakpoint}>
<DialogUpdate
{...defaultPropsForBreakpoint}
dialogType={DialogType.FullDownloadReady}
downloadSize={300123456}
currentVersion="5.24.0"
/>
</FakeLeftPaneContainer>

View file

@ -137,6 +137,7 @@ export const DialogUpdate = ({
if (
downloadSize &&
(dialogType === DialogType.DownloadReady ||
dialogType === DialogType.FullDownloadReady ||
dialogType === DialogType.Downloading)
) {
title += ` (${formatFileSize(downloadSize, { round: 0 })})`;
@ -169,8 +170,12 @@ export const DialogUpdate = ({
}
let clickLabel: string;
let type: 'warning' | undefined;
if (dialogType === DialogType.DownloadReady) {
clickLabel = i18n('downloadNewVersionMessage');
} else if (dialogType === DialogType.FullDownloadReady) {
clickLabel = i18n('downloadFullNewVersionMessage');
type = 'warning';
} else {
clickLabel = i18n('autoUpdateNewVersionMessage');
}
@ -179,6 +184,7 @@ export const DialogUpdate = ({
<LeftPaneDialog
containerWidthBreakpoint={containerWidthBreakpoint}
icon="update"
type={type}
title={title}
hoverText={versionTitle}
hasAction