Make backup import UI part of install

This commit is contained in:
Fedor Indutny 2024-09-03 19:56:13 -07:00 committed by GitHub
parent 6bd9502f5c
commit ee0090bb84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 829 additions and 596 deletions

View file

@ -5,26 +5,17 @@ import type { ComponentProps, ReactElement } from 'react';
import React from 'react';
import { missingCaseError } from '../util/missingCaseError';
import { InstallScreenStep } from '../types/InstallScreen';
import { InstallScreenErrorStep } from './installScreen/InstallScreenErrorStep';
import { InstallScreenChoosingDeviceNameStep } from './installScreen/InstallScreenChoosingDeviceNameStep';
import { InstallScreenLinkInProgressStep } from './installScreen/InstallScreenLinkInProgressStep';
import { InstallScreenQrCodeNotScannedStep } from './installScreen/InstallScreenQrCodeNotScannedStep';
export enum InstallScreenStep {
Error,
QrCodeNotScanned,
ChoosingDeviceName,
LinkInProgress,
}
import { InstallScreenBackupImportStep } from './installScreen/InstallScreenBackupImportStep';
// We can't always use destructuring assignment because of the complexity of this props
// type.
type PropsType =
| {
step: InstallScreenStep.Error;
screenSpecificProps: ComponentProps<typeof InstallScreenErrorStep>;
}
| {
step: InstallScreenStep.QrCodeNotScanned;
screenSpecificProps: ComponentProps<
@ -42,6 +33,14 @@ type PropsType =
screenSpecificProps: ComponentProps<
typeof InstallScreenLinkInProgressStep
>;
}
| {
step: InstallScreenStep.BackupImport;
screenSpecificProps: ComponentProps<typeof InstallScreenBackupImportStep>;
}
| {
step: InstallScreenStep.Error;
screenSpecificProps: ComponentProps<typeof InstallScreenErrorStep>;
};
export function InstallScreen(props: Readonly<PropsType>): ReactElement {
@ -58,6 +57,8 @@ export function InstallScreen(props: Readonly<PropsType>): ReactElement {
);
case InstallScreenStep.LinkInProgress:
return <InstallScreenLinkInProgressStep {...props.screenSpecificProps} />;
case InstallScreenStep.BackupImport:
return <InstallScreenBackupImportStep {...props.screenSpecificProps} />;
default:
throw missingCaseError(props);
}