2021-10-12 23:59:08 +00:00
|
|
|
// Copyright 2020-2021 Signal Messenger, LLC
|
2021-08-19 22:56:29 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import * as React from 'react';
|
|
|
|
import { boolean, select } from '@storybook/addon-knobs';
|
|
|
|
import { action } from '@storybook/addon-actions';
|
|
|
|
import { DialogUpdate } from './DialogUpdate';
|
|
|
|
import { DialogType } from '../types/Dialogs';
|
2021-10-12 23:59:08 +00:00
|
|
|
import { WidthBreakpoint } from './_util';
|
|
|
|
import { FakeLeftPaneContainer } from '../test-both/helpers/FakeLeftPaneContainer';
|
2021-08-19 22:56:29 +00:00
|
|
|
|
2021-09-18 00:30:08 +00:00
|
|
|
import { setupI18n } from '../util/setupI18n';
|
2021-08-19 22:56:29 +00:00
|
|
|
import enMessages from '../../_locales/en/messages.json';
|
|
|
|
|
|
|
|
const i18n = setupI18n('en', enMessages);
|
|
|
|
|
|
|
|
const defaultProps = {
|
2021-10-12 23:59:08 +00:00
|
|
|
containerWidthBreakpoint: WidthBreakpoint.Wide,
|
2021-08-19 22:56:29 +00:00
|
|
|
dismissDialog: action('dismiss-dialog'),
|
|
|
|
downloadSize: 116504357,
|
|
|
|
downloadedSize: 61003110,
|
|
|
|
hasNetworkDialog: false,
|
|
|
|
i18n,
|
|
|
|
didSnooze: false,
|
|
|
|
showEventsCount: 0,
|
|
|
|
snoozeUpdate: action('snooze-update'),
|
|
|
|
startUpdate: action('start-update'),
|
|
|
|
version: 'v7.7.7',
|
|
|
|
};
|
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
export default {
|
|
|
|
title: 'Components/DialogUpdate',
|
|
|
|
};
|
2021-08-19 22:56:29 +00:00
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
export const KnobsPlayground = (): JSX.Element => {
|
2021-10-12 23:59:08 +00:00
|
|
|
const containerWidthBreakpoint = select(
|
|
|
|
'containerWidthBreakpoint',
|
|
|
|
WidthBreakpoint,
|
|
|
|
WidthBreakpoint.Wide
|
|
|
|
);
|
2021-08-19 22:56:29 +00:00
|
|
|
const dialogType = select('dialogType', DialogType, DialogType.Update);
|
|
|
|
const hasNetworkDialog = boolean('hasNetworkDialog', false);
|
|
|
|
const didSnooze = boolean('didSnooze', false);
|
|
|
|
|
|
|
|
return (
|
2021-10-12 23:59:08 +00:00
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={containerWidthBreakpoint}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={containerWidthBreakpoint}
|
|
|
|
dialogType={dialogType}
|
|
|
|
didSnooze={didSnooze}
|
|
|
|
hasNetworkDialog={hasNetworkDialog}
|
2021-11-11 22:46:16 +00:00
|
|
|
currentVersion="5.24.0"
|
2021-10-12 23:59:08 +00:00
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
2021-08-19 22:56:29 +00:00
|
|
|
);
|
2022-06-07 00:48:02 +00:00
|
|
|
};
|
2021-08-19 22:56:29 +00:00
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
export const UpdateWide = (): JSX.Element => (
|
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Wide}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={WidthBreakpoint.Wide}
|
|
|
|
dialogType={DialogType.Update}
|
|
|
|
currentVersion="5.24.0"
|
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
|
|
|
);
|
2022-02-25 18:44:03 +00:00
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
UpdateWide.story = {
|
|
|
|
name: 'Update (Wide)',
|
|
|
|
};
|
2021-08-19 22:56:29 +00:00
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
export const DownloadReadyWide = (): JSX.Element => (
|
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Wide}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={WidthBreakpoint.Wide}
|
|
|
|
currentVersion="5.24.0"
|
|
|
|
dialogType={DialogType.DownloadReady}
|
|
|
|
downloadSize={30123456}
|
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
|
|
|
);
|
2021-08-19 22:56:29 +00:00
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
DownloadReadyWide.story = {
|
|
|
|
name: 'DownloadReady (Wide)',
|
|
|
|
};
|
2021-11-11 22:46:16 +00:00
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
export const FullDownloadReadyWide = (): JSX.Element => (
|
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Wide}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={WidthBreakpoint.Wide}
|
|
|
|
currentVersion="5.24.0"
|
|
|
|
dialogType={DialogType.FullDownloadReady}
|
|
|
|
downloadSize={300123456}
|
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
|
|
|
);
|
2021-08-19 22:56:29 +00:00
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
FullDownloadReadyWide.story = {
|
|
|
|
name: 'FullDownloadReady (Wide)',
|
|
|
|
};
|
2022-04-06 18:27:17 +00:00
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
export const DownloadingWide = (): JSX.Element => (
|
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Wide}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={WidthBreakpoint.Wide}
|
|
|
|
currentVersion="5.24.0"
|
|
|
|
dialogType={DialogType.Downloading}
|
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
|
|
|
);
|
2022-04-06 18:27:17 +00:00
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
DownloadingWide.story = {
|
|
|
|
name: 'Downloading (Wide)',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const CannotUpdateWide = (): JSX.Element => (
|
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Wide}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={WidthBreakpoint.Wide}
|
|
|
|
currentVersion="5.24.0"
|
|
|
|
dialogType={DialogType.Cannot_Update}
|
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
|
|
|
);
|
|
|
|
|
|
|
|
CannotUpdateWide.story = {
|
|
|
|
name: 'Cannot_Update (Wide)',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const CannotUpdateBetaWide = (): JSX.Element => (
|
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Wide}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={WidthBreakpoint.Wide}
|
|
|
|
currentVersion="5.24.0-beta.1"
|
|
|
|
dialogType={DialogType.Cannot_Update}
|
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
|
|
|
);
|
|
|
|
|
|
|
|
CannotUpdateBetaWide.story = {
|
|
|
|
name: 'Cannot_Update_Beta (Wide)',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const CannotUpdateRequireManualWide = (): JSX.Element => (
|
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Wide}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={WidthBreakpoint.Wide}
|
|
|
|
currentVersion="5.24.0"
|
|
|
|
dialogType={DialogType.Cannot_Update_Require_Manual}
|
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
|
|
|
);
|
|
|
|
|
|
|
|
CannotUpdateRequireManualWide.story = {
|
|
|
|
name: 'Cannot_Update_Require_Manual (Wide)',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const CannotUpdateRequireManualBetaWide = (): JSX.Element => (
|
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Wide}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={WidthBreakpoint.Wide}
|
|
|
|
currentVersion="5.24.0-beta.1"
|
|
|
|
dialogType={DialogType.Cannot_Update_Require_Manual}
|
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
|
|
|
);
|
|
|
|
|
|
|
|
CannotUpdateRequireManualBetaWide.story = {
|
|
|
|
name: 'Cannot_Update_Require_Manual_Beta (Wide)',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const MacOSReadOnlyWide = (): JSX.Element => (
|
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Wide}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={WidthBreakpoint.Wide}
|
|
|
|
currentVersion="5.24.0"
|
|
|
|
dialogType={DialogType.MacOS_Read_Only}
|
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
|
|
|
);
|
|
|
|
|
|
|
|
MacOSReadOnlyWide.story = {
|
|
|
|
name: 'MacOS_Read_Only (Wide)',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const UpdateNarrow = (): JSX.Element => (
|
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Narrow}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={WidthBreakpoint.Narrow}
|
|
|
|
dialogType={DialogType.Update}
|
|
|
|
currentVersion="5.24.0"
|
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
|
|
|
);
|
|
|
|
|
|
|
|
UpdateNarrow.story = {
|
|
|
|
name: 'Update (Narrow)',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const DownloadReadyNarrow = (): JSX.Element => (
|
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Narrow}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={WidthBreakpoint.Narrow}
|
|
|
|
currentVersion="5.24.0"
|
|
|
|
dialogType={DialogType.DownloadReady}
|
|
|
|
downloadSize={30123456}
|
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
|
|
|
);
|
|
|
|
|
|
|
|
DownloadReadyNarrow.story = {
|
|
|
|
name: 'DownloadReady (Narrow)',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const FullDownloadReadyNarrow = (): JSX.Element => (
|
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Narrow}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={WidthBreakpoint.Narrow}
|
|
|
|
currentVersion="5.24.0"
|
|
|
|
dialogType={DialogType.FullDownloadReady}
|
|
|
|
downloadSize={300123456}
|
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
|
|
|
);
|
|
|
|
|
|
|
|
FullDownloadReadyNarrow.story = {
|
|
|
|
name: 'FullDownloadReady (Narrow)',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const DownloadingNarrow = (): JSX.Element => (
|
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Narrow}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={WidthBreakpoint.Narrow}
|
|
|
|
currentVersion="5.24.0"
|
|
|
|
dialogType={DialogType.Downloading}
|
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
|
|
|
);
|
|
|
|
|
|
|
|
DownloadingNarrow.story = {
|
|
|
|
name: 'Downloading (Narrow)',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const CannotUpdateNarrow = (): JSX.Element => (
|
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Narrow}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={WidthBreakpoint.Narrow}
|
|
|
|
currentVersion="5.24.0"
|
|
|
|
dialogType={DialogType.Cannot_Update}
|
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
|
|
|
);
|
|
|
|
|
|
|
|
CannotUpdateNarrow.story = {
|
|
|
|
name: 'Cannot Update (Narrow)',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const CannotUpdateBetaNarrow = (): JSX.Element => (
|
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Narrow}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={WidthBreakpoint.Narrow}
|
|
|
|
currentVersion="5.24.0-beta.1"
|
|
|
|
dialogType={DialogType.Cannot_Update}
|
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
|
|
|
);
|
|
|
|
|
|
|
|
CannotUpdateBetaNarrow.story = {
|
|
|
|
name: 'Cannot Update Beta (Narrow)',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const CannotUpdateRequireManualNarrow = (): JSX.Element => (
|
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Narrow}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={WidthBreakpoint.Narrow}
|
|
|
|
currentVersion="5.24.0"
|
|
|
|
dialogType={DialogType.Cannot_Update_Require_Manual}
|
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
|
|
|
);
|
|
|
|
|
|
|
|
CannotUpdateRequireManualNarrow.story = {
|
|
|
|
name: 'Cannot_Update_Require_Manual (Narrow)',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const CannotUpdateRequireManualBetaNarrow = (): JSX.Element => (
|
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Narrow}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={WidthBreakpoint.Narrow}
|
|
|
|
currentVersion="5.24.0-beta.1"
|
|
|
|
dialogType={DialogType.Cannot_Update_Require_Manual}
|
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
|
|
|
);
|
|
|
|
|
|
|
|
CannotUpdateRequireManualBetaNarrow.story = {
|
|
|
|
name: 'Cannot_Update_Require_Manual_Beta (Narrow)',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const MacOSReadOnlyNarrow = (): JSX.Element => (
|
|
|
|
<FakeLeftPaneContainer containerWidthBreakpoint={WidthBreakpoint.Narrow}>
|
|
|
|
<DialogUpdate
|
|
|
|
{...defaultProps}
|
|
|
|
containerWidthBreakpoint={WidthBreakpoint.Narrow}
|
|
|
|
currentVersion="5.24.0"
|
|
|
|
dialogType={DialogType.MacOS_Read_Only}
|
|
|
|
/>
|
|
|
|
</FakeLeftPaneContainer>
|
|
|
|
);
|
|
|
|
|
|
|
|
MacOSReadOnlyNarrow.story = {
|
|
|
|
name: 'MacOS_Read_Only (Narrow)',
|
|
|
|
};
|