Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

registration: redesign email verification page #8554

Merged
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions res/css/_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
@import "./structures/_ViewSource.scss";
@import "./structures/auth/_CompleteSecurity.scss";
@import "./structures/auth/_Login.scss";
@import "./structures/auth/_Registration.scss";
@import "./structures/auth/_SetupEncryptionBody.scss";
@import "./views/audio_messages/_AudioPlayer.scss";
@import "./views/audio_messages/_PlayPauseButton.scss";
Expand Down
53 changes: 53 additions & 0 deletions res/css/structures/auth/_Registration.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
Copyright 2022 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.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_Register_mainContent {
justjanne marked this conversation as resolved.
Show resolved Hide resolved
display: flex;
flex-direction: column;
flex-grow: 1;
min-height: 270px;

p {
font-size: $font-14px;
color: $authpage-primary-color;

&.secondary {
color: $authpage-secondary-color;
}
}

> img:first-child {
margin-bottom: 16px;
width: max-content;
}

.mx_Login_submit {
margin-bottom: 0;
}
}

.mx_Register_footerActions {
display: flex;
flex-direction: row;
justify-content: space-between;
padding-top: 16px;
margin-top: 16px;
border-top: 1px solid rgba(141, 151, 165, 0.2);

> * {
flex-basis: content;
}
}
6 changes: 5 additions & 1 deletion res/css/views/auth/_AuthBody.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ limitations under the License.
padding: 25px 60px;
box-sizing: border-box;

&.mx_AuthBody_flex {
display: flex;
flex-direction: column;
}

h2 {
font-size: $font-24px;
font-weight: 600;
Expand Down Expand Up @@ -139,7 +144,6 @@ limitations under the License.
.mx_AuthBody_changeFlow {
display: block;
text-align: center;
width: 100%;

> a {
font-weight: $font-semi-bold;
Expand Down
8 changes: 5 additions & 3 deletions res/css/views/auth/_AuthPage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ limitations under the License.
border-radius: 4px;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.33);
background-color: $authpage-modal-bg-color;
}

@media only screen and (max-width: 480px) {
.mx_AuthPage_modal {
@media only screen and (max-height: 768px) {
margin-top: 50px;
}

@media only screen and (max-width: 480px) {
margin-top: 0;
}
}
41 changes: 12 additions & 29 deletions res/css/views/auth/_InteractiveAuthEntryComponents.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_InteractiveAuthEntryComponents_emailWrapper {
padding-right: 100px;
position: relative;
margin-top: 32px;
margin-bottom: 32px;

&::before, &::after {
position: absolute;
width: 116px;
height: 116px;
content: "";
right: -10px;
}

&::before {
background-color: rgba(244, 246, 250, 0.91);
border-radius: 50%;
top: -20px;
}

&::after {
background-image: url('$(res)/img/element-icons/email-prompt.svg');
background-repeat: no-repeat;
background-position: center;
background-size: contain;
top: -25px;
}
}

.mx_InteractiveAuthEntryComponents_msisdnWrapper {
text-align: center;
}
Expand Down Expand Up @@ -103,3 +74,15 @@ limitations under the License.
margin-left: 5px;
}
}

.mx_InteractiveAuthEntryComponents_emailWrapper {
.mx_AccessibleButton_kind_link_inline {
display: inline-block !important;

.mx_Spinner {
display: inline-flex !important;
width: auto !important;
vertical-align: middle !important;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we get comments on why we need all these overrides?

}
5 changes: 5 additions & 0 deletions res/css/views/elements/_Tooltip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ limitations under the License.
border: 0;
text-align: center;

&:not(.mx_Tooltip_noMargin) {
margin-left: 6px;
margin-right: 6px;
}

.mx_Tooltip_chevron {
display: none;
}
Expand Down
17 changes: 5 additions & 12 deletions res/img/element-icons/email-prompt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/components/structures/InteractiveAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ export default class InteractiveAuthComponent extends React.Component<IProps, IS
setEmailSid={this.setEmailSid}
showContinue={!this.props.continueIsManaged}
onPhaseChange={this.onPhaseChange}
requestEmailToken={this.authLogic.requestEmailToken}
continueText={this.props.continueText}
continueKind={this.props.continueKind}
onCancel={this.onStageCancel}
Expand Down
47 changes: 29 additions & 18 deletions src/components/structures/auth/Registration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

import { createClient } from 'matrix-js-sdk/src/matrix';
import React, { ReactNode } from 'react';
import React, { Fragment, ReactNode } from 'react';
import { MatrixClient } from "matrix-js-sdk/src/client";
import classNames from "classnames";
import { logger } from "matrix-js-sdk/src/logger";
Expand All @@ -36,6 +36,8 @@ import AuthBody from "../../views/auth/AuthBody";
import AuthHeader from "../../views/auth/AuthHeader";
import InteractiveAuth from "../InteractiveAuth";
import Spinner from "../../views/elements/Spinner";
import { AuthHeaderDisplay } from './header/AuthHeaderDisplay';
import { AuthHeaderProvider } from './header/AuthHeaderProvider';

interface IProps {
serverConfig: ValidatedServerConfig;
Expand Down Expand Up @@ -619,28 +621,37 @@ export default class Registration extends React.Component<IProps, IState> {
{ regDoneText }
</div>;
} else {
body = <div>
<h2>{ _t('Create account') }</h2>
{ errorText }
{ serverDeadSection }
<ServerPicker
title={_t("Host account on")}
dialogTitle={_t("Decide where your account is hosted")}
serverConfig={this.props.serverConfig}
onServerConfigChange={this.state.doingUIAuth ? undefined : this.props.onServerConfigChange}
/>
{ this.renderRegisterComponent() }
{ goBack }
{ signIn }
</div>;
body = <Fragment>
<div className="mx_Register_mainContent">
<AuthHeaderDisplay
title={_t('Create account')}
serverPicker={<ServerPicker
title={_t("Host account on")}
dialogTitle={_t("Decide where your account is hosted")}
serverConfig={this.props.serverConfig}
onServerConfigChange={this.state.doingUIAuth ? undefined : this.props.onServerConfigChange}
/>}
>
{ errorText }
{ serverDeadSection }
</AuthHeaderDisplay>
{ this.renderRegisterComponent() }
</div>
<div className="mx_Register_footerActions">
{ goBack }
{ signIn }
</div>
</Fragment>;
}

return (
<AuthPage>
<AuthHeader />
<AuthBody>
{ body }
</AuthBody>
<AuthHeaderProvider>
<AuthBody flex>
{ body }
</AuthBody>
</AuthHeaderProvider>
</AuthPage>
);
}
Expand Down
26 changes: 26 additions & 0 deletions src/components/structures/auth/header/AuthHeaderContext.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Copyright 2022 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.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import { createContext, Dispatch, ReducerAction, ReducerState } from "react";

import type { AuthHeaderReducer } from "./AuthHeaderProvider";

interface AuthHeaderContextType {
state: ReducerState<AuthHeaderReducer>;
dispatch: Dispatch<ReducerAction<AuthHeaderReducer>>;
}

export const AuthHeaderContext = createContext<AuthHeaderContextType>(undefined);
41 changes: 41 additions & 0 deletions src/components/structures/auth/header/AuthHeaderDisplay.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
Copyright 2022 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.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import React, { Fragment, PropsWithChildren, ReactNode, useContext } from "react";

import { AuthHeaderContext } from "./AuthHeaderContext";

interface Props {
title: ReactNode;
icon?: ReactNode;
serverPicker: ReactNode;
}

export function AuthHeaderDisplay({ title, icon, serverPicker, children }: PropsWithChildren<Props>) {
const context = useContext(AuthHeaderContext);
if (!context) {
return null;
}
const current = context.state.length ? context.state[0] : null;
return (
<Fragment>
{ current?.icon ?? icon }
<h2>{ current?.title ?? title }</h2>
{ children }
{ current?.hideServerPicker !== true && serverPicker }
</Fragment>
);
}
39 changes: 39 additions & 0 deletions src/components/structures/auth/header/AuthHeaderModifier.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
Copyright 2022 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.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import { ReactNode, useContext, useEffect } from "react";

import { AuthHeaderContext } from "./AuthHeaderContext";
import { AuthHeaderActionType } from "./AuthHeaderProvider";

interface Props {
title: ReactNode;
icon?: ReactNode;
hideServerPicker?: boolean;
}
t3chguy marked this conversation as resolved.
Show resolved Hide resolved

export function AuthHeaderModifier(props: Props) {
const context = useContext(AuthHeaderContext);
const dispatch = context ? context.dispatch : null;
useEffect(() => {
if (!dispatch) {
return;
}
dispatch({ type: AuthHeaderActionType.Add, value: props });
return () => dispatch({ type: AuthHeaderActionType.Remove, value: props });
}, [props, dispatch]);
return null;
}
Loading