Factor out post-login splash screen to a new component (#12103)

* Factor out post-login splash screen to a new component

* Move CSS classes to per-component file

* Rename CSS classes

... to reflect the component that uses them

* code review
This commit is contained in:
Richard van der Hoff 2024-01-04 18:12:08 +00:00 committed by GitHub
parent baaf8ad68b
commit fd64eccd4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 220 additions and 37 deletions

View file

@ -1,5 +1,5 @@
/*
Copyright 2015-2022 The Matrix.org Foundation C.I.C.
Copyright 2015-2024 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -60,7 +60,6 @@ import { _t, _td, getCurrentLanguage } from "../../languageHandler";
import SettingsStore from "../../settings/SettingsStore";
import ThemeController from "../../settings/controllers/ThemeController";
import { startAnyRegistrationFlow } from "../../Registration";
import { messageForSyncError } from "../../utils/ErrorUtils";
import ResizeNotifier from "../../utils/ResizeNotifier";
import AutoDiscoveryUtils from "../../utils/AutoDiscoveryUtils";
import DMRoomMap from "../../utils/DMRoomMap";
@ -113,7 +112,7 @@ import { PosthogAnalytics } from "../../PosthogAnalytics";
import { initSentry } from "../../sentry";
import LegacyCallHandler from "../../LegacyCallHandler";
import { showSpaceInvite } from "../../utils/space";
import AccessibleButton, { ButtonEvent } from "../views/elements/AccessibleButton";
import { ButtonEvent } from "../views/elements/AccessibleButton";
import { ActionPayload } from "../../dispatcher/payloads";
import { SummarizedNotificationState } from "../../stores/notifications/SummarizedNotificationState";
import Views from "../../Views";
@ -147,6 +146,7 @@ import { Filter } from "../views/dialogs/spotlight/Filter";
import { checkSessionLockFree, getSessionLock } from "../../utils/SessionLock";
import { SessionLockStolenView } from "./auth/SessionLockStolenView";
import { ConfirmSessionLockTheftView } from "./auth/ConfirmSessionLockTheftView";
import { LoginSplashView } from "./auth/LoginSplashView";
// legacy export
export { default as Views } from "../../Views";
@ -2119,22 +2119,12 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
);
} else {
// we think we are logged in, but are still waiting for the /sync to complete
let errorBox;
if (this.state.syncError && !isStoreError) {
errorBox = (
<div className="mx_MatrixChat_syncError">{messageForSyncError(this.state.syncError)}</div>
);
}
// Suppress `InvalidStoreError`s here, since they have their own error dialog.
view = (
<div className="mx_MatrixChat_splash">
{errorBox}
<Spinner />
<div className="mx_MatrixChat_splashButtons">
<AccessibleButton kind="link_inline" onClick={this.onLogoutClick}>
{_t("action|logout")}
</AccessibleButton>
</div>
</div>
<LoginSplashView
onLogoutClick={this.onLogoutClick}
syncError={isStoreError ? null : this.state.syncError}
/>
);
}
} else if (this.state.view === Views.WELCOME) {