signal-desktop/ts/state/smart/UpdateDialog.tsx

45 lines
1.4 KiB
TypeScript
Raw Normal View History

2023-01-03 19:55:46 +00:00
// Copyright 2020 Signal Messenger, LLC
2020-10-30 20:34:04 +00:00
// SPDX-License-Identifier: AGPL-3.0-only
import { useSelector } from 'react-redux';
import React, { memo } from 'react';
import { DialogUpdate } from '../../components/DialogUpdate';
import { getIntl } from '../selectors/user';
import type { WidthBreakpoint } from '../../components/_util';
import { useUpdatesActions } from '../ducks/updates';
import {
getUpdateDialogType,
getUpdateDownloadSize,
getUpdateDownloadedSize,
getUpdateVersion,
} from '../selectors/updates';
type SmartUpdateDialogProps = Readonly<{
containerWidthBreakpoint: WidthBreakpoint;
}>;
export const SmartUpdateDialog = memo(function SmartUpdateDialog({
containerWidthBreakpoint,
}: SmartUpdateDialogProps) {
const i18n = useSelector(getIntl);
const { dismissDialog, snoozeUpdate, startUpdate } = useUpdatesActions();
const dialogType = useSelector(getUpdateDialogType);
const downloadSize = useSelector(getUpdateDownloadSize);
const downloadedSize = useSelector(getUpdateDownloadedSize);
const version = useSelector(getUpdateVersion);
return (
<DialogUpdate
i18n={i18n}
containerWidthBreakpoint={containerWidthBreakpoint}
dialogType={dialogType}
downloadSize={downloadSize}
downloadedSize={downloadedSize}
version={version}
currentVersion={window.getVersion()}
dismissDialog={dismissDialog}
snoozeUpdate={snoozeUpdate}
startUpdate={startUpdate}
/>
);
});