Decouple RelinkDialog from NetworkStatusDialog

This commit is contained in:
Josh Perez 2020-04-16 15:20:52 -04:00 committed by GitHub
parent 0970c73310
commit 4dc7631851
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 123 additions and 37 deletions

View file

@ -8,8 +8,6 @@ const FIVE_SECONDS = 5 * 1000;
export interface PropsType extends NetworkStateType {
hasNetworkDialog: boolean;
i18n: LocalizerType;
isRegistrationDone: boolean;
relinkDevice: () => void;
manualReconnect: () => void;
}
@ -39,9 +37,7 @@ export const NetworkStatus = ({
hasNetworkDialog,
i18n,
isOnline,
isRegistrationDone,
socketStatus,
relinkDevice,
manualReconnect,
}: PropsType): JSX.Element | null => {
if (!hasNetworkDialog) {
@ -76,17 +72,7 @@ export const NetworkStatus = ({
</div>
);
if (!isRegistrationDone) {
return renderDialog({
renderActionableButton: (): JSX.Element => (
<div className="module-left-pane-dialog__actions">
<button onClick={relinkDevice}>{i18n('relink')}</button>
</div>
),
subtext: i18n('unlinkedWarning'),
title: i18n('unlinked'),
});
} else if (isConnecting) {
if (isConnecting) {
return renderDialog({
subtext: i18n('connectingHangOn'),
title: i18n('connecting'),