diff --git a/stylesheets/_session.scss b/stylesheets/_session.scss
index bdc9d332d..8b2a07a70 100644
--- a/stylesheets/_session.scss
+++ b/stylesheets/_session.scss
@@ -58,11 +58,13 @@ $session-opaque-dark-2: rgba(0, 0, 0, 0.37);
$session-opaque-dark-3: rgba(0, 0, 0, 0.5);
$session-color-white: #fff;
+$session-color-dark-grey: #353535;
$session-color-black: #000;
$session-color-danger: #ff4538;
$session-color-primary: $session-shade-13;
$session-color-secondary: $session-shade-16;
$session-color-warning: $session-shade-17;
+$session-color-light-grey: #a0a0a0;
$session-shadow-opacity: 0.15;
$session-overlay-opacity: 0.3;
diff --git a/ts/components/session/RegistrationTabs.tsx b/ts/components/session/RegistrationTabs.tsx
new file mode 100644
index 000000000..338693fab
--- /dev/null
+++ b/ts/components/session/RegistrationTabs.tsx
@@ -0,0 +1,249 @@
+import React from 'react';
+import classNames from 'classnames';
+
+import { LocalizerType } from '../../types/Util';
+import { SessionInput } from './SessionInput';
+import { SessionButton, SessionButtonTypes } from './SessionButton';
+
+interface Props {
+ i18n: LocalizerType;
+ //onItemClick?: (event: ItemClickEvent) => void;
+}
+
+enum SignInMode {
+ Default = 'Default',
+ UsingSeed = 'UsingSeed',
+ LinkingDevice = 'LinkingDevice',
+}
+
+interface State {
+ selectedTab: 'create' | 'signin';
+ signInMode: SignInMode;
+ seed: string;
+ displayName: string;
+ password: string;
+ validatePassword: string;
+}
+
+interface TabSelectEvent {
+ type: 'create' | 'signin';
+}
+
+
+
+const Tab = ({
+ isSelected,
+ label,
+ onSelect,
+ type,
+}: {
+ isSelected: boolean;
+ label: string;
+ onSelect?: (event: TabSelectEvent) => void;
+ type: 'create' | 'signin';
+}) => {
+ const handleClick = onSelect
+ ? () => {
+ onSelect({ type });
+ }
+ : undefined;
+
+ return (
+
+ {label}
+
+ );
+};
+
+export class RegistrationTabs extends React.Component {
+ constructor(props: any) {
+ super(props);
+
+ this.onSeedChanged = this.onSeedChanged.bind(this);
+ this.onDisplayNameChanged = this.onDisplayNameChanged.bind(this);
+ this.onPasswordChanged = this.onPasswordChanged.bind(this);
+ this.onPasswordVerifyChanged = this.onPasswordVerifyChanged.bind(this);
+
+ this.state = {
+ selectedTab: 'create',
+ signInMode: SignInMode.Default,
+ seed: '',
+ displayName: '',
+ password: '',
+ validatePassword: '',
+ };
+ }
+
+
+
+ public render() {
+ return this.renderTabs();
+ }
+
+ private renderTabs() {
+ const { selectedTab } = this.state;
+
+ return (
+
+
+
+
+
+ {this.renderSections()}
+
+ );
+ }
+
+ private readonly handleTabSelect = (event: TabSelectEvent): void => {
+ this.setState({ selectedTab: event.type });
+ };
+
+ private onSeedChanged(val: string) {
+ this.setState({ seed: val });
+ }
+
+ private onDisplayNameChanged(val: string) {
+ this.setState({ displayName: val });
+ }
+
+ private onPasswordChanged(val: string) {
+ this.setState({ password: val });
+ }
+
+ private onPasswordVerifyChanged(val: string) {
+ this.setState({ validatePassword: val });
+ }
+
+ private renderSections() {
+ const { selectedTab } = this.state;
+ if (selectedTab === 'create') {
+ return TODO CREATE
;
+ }
+
+ return this.renderSignIn();
+ }
+
+ private renderSignIn() {
+ const { signInMode } = this.state;
+
+ return (
+
+
+
+ this.onSeedChanged(val)}
+ />
+ this.onDisplayNameChanged(val)}
+
+ />
+ this.onPasswordChanged(val)}
+
+ />
+ this.onPasswordVerifyChanged(val)}
+
+ />
+
+
+
+ {this.renderSignInButtons()}
+ {this.renderTermsConditionAgreement()}
+
+
);
+ }
+
+ private renderSignInButtons() {
+ const { signInMode } = this.state;
+
+ let greenButtonType: any;
+ let greenText: string;
+ let whiteButtonText: string;
+ if (signInMode !== SignInMode.Default) {
+ greenButtonType = SessionButtonTypes.FullGreen;
+ greenText = 'Continue Your Session';
+ }
+ else {
+ greenButtonType = SessionButtonTypes.Green;
+ greenText = 'Restore Using Seed';
+ }
+ if (signInMode === SignInMode.LinkingDevice) {
+ whiteButtonText = 'Restore Using Seed'
+ }
+ else {
+ whiteButtonText = 'Link Device To Existing Account'
+ }
+
+ return (
+
+
{
+ this.setState({
+ signInMode: SignInMode.UsingSeed
+ })
+ }}
+ buttonType={greenButtonType}
+ text={greenText}
+ />
+ or
+ {
+ this.setState({
+ signInMode: SignInMode.LinkingDevice
+ })
+ }}
+ buttonType={SessionButtonTypes.White}
+ text={whiteButtonText}
+ />
+ );
+ }
+
+ private renderTermsConditionAgreement() {
+ return (
+
+ )
+ // FIXME link to our Terms and Conditions and privacy statement
+ };
+}
diff --git a/ts/components/session/SessionInput.tsx b/ts/components/session/SessionInput.tsx
index 2a1d7d90e..d642e620b 100644
--- a/ts/components/session/SessionInput.tsx
+++ b/ts/components/session/SessionInput.tsx
@@ -7,8 +7,10 @@ interface Props {
i18n: LocalizerType;
label: string;
type: string;
+ value?: string;
placeholder: string;
enableShowHide?: boolean;
+ onValueChanged?: any;
}
interface State {
@@ -29,7 +31,7 @@ export class SessionInput extends React.PureComponent {
}
public render() {
- const { placeholder, type, label, enableShowHide } = this.props;
+ const { placeholder, type, label, value, enableShowHide } = this.props;
const { inputValue, forceShow } = this.state;
const correctType = forceShow ? 'text' : type;
@@ -50,10 +52,7 @@ export class SessionInput extends React.PureComponent {
id="floatField"
type={correctType}
placeholder={placeholder}
- value={inputValue}
- onBlur={e => {
- this.updateInputValue(e);
- }}
+ value={value}
onChange={e => {
this.updateInputValue(e);
}}
@@ -74,10 +73,13 @@ export class SessionInput extends React.PureComponent {
}
private updateInputValue(e: any) {
+ e.preventDefault();
this.setState({
inputValue: e.target.value,
});
- e.preventDefault();
+ if (this.props.onValueChanged) {
+ this.props.onValueChanged(e.target.value);
+ }
}
}
diff --git a/ts/components/session/SessionRegistrationView.tsx b/ts/components/session/SessionRegistrationView.tsx
index aa9b73b46..8d7a1470f 100644
--- a/ts/components/session/SessionRegistrationView.tsx
+++ b/ts/components/session/SessionRegistrationView.tsx
@@ -1,10 +1,9 @@
import React from 'react';
-import { SessionButton, SessionButtonTypes } from './SessionButton';
import { AccentText } from './AccentText';
-import { SessionInput } from './SessionInput';
//import classNames from 'classnames';
import { LocalizerType } from '../../types/Util';
+import { RegistrationTabs } from './RegistrationTabs';
declare global {
interface Window {
@@ -39,7 +38,7 @@ export class SessionRegistrationView extends React.Component {
//const i18n = this.props.i18n;
//const cancelText = i18n('cancel');
- const { showSubtitle } = this.props;
+ const { showSubtitle, i18n } = this.props;
return (
@@ -47,87 +46,23 @@ export class SessionRegistrationView extends React.Component
{
-
-
-
-
-
-
+
- {
- alert('TODO');
- }}
- buttonType={SessionButtonTypes.FullGreen}
- text="Continue Your Session"
- />
- or
- {
- alert('TODO');
- }}
- buttonType={SessionButtonTypes.White}
- text="Link Device To Existing Account"
- />
+
);
}
- /*private renderAvatar() {
- const avatarPath = this.props.avatarPath;
- const color = this.props.avatarColor;
-
- return (
-
- );
- }
-*/
private onKeyUp(event: any) {
switch (event.key) {
case 'Enter':
break;
case 'Esc':
case 'Escape':
- //this.closeDialog();
break;
default:
}
}
- /*rivate closeDialog() {
- window.removeEventListener('keyup', this.onKeyUp);
- this.props.onClose();
- }
-*/
}