Skip to content

Commit

Permalink
Merge branch 'master' into #29-open-orders
Browse files Browse the repository at this point in the history
Conflicts:
	build/components.jsx
  • Loading branch information
priecint committed Jul 17, 2016
2 parents 3c613ed + 0480412 commit b4f159d
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 198 deletions.
42 changes: 21 additions & 21 deletions build/components.jsx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "augur-ui-react-components",
"version": "3.0.12",
"version": "3.0.14",
"description": "Augur UI React Components",
"author": "Baz (@thinkloop)",
"license": "AAL",
Expand Down
118 changes: 9 additions & 109 deletions src/modules/account/components/account-page.jsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,29 @@
import React, { PropTypes, Component } from 'react';
import classnames from 'classnames';

import SiteHeader from '../../site/components/site-header';
import SiteFooter from '../../site/components/site-footer';
import Link from '../../link/components/link';
import Input from '../../common/components/input';

export default class AccountPage extends Component {
static propTypes = {
onChangePass: PropTypes.func,
account: PropTypes.object,
siteHeader: PropTypes.object
};

constructor(props) {
super(props);
this.handleSubmit = this.handleSubmit.bind(this);
this.state = {
name: this.props.account.name,
editName: false,
editPassword: false,
showFullID: false,
msg: ''
};
}

handleSubmit = (e) => {
e.preventDefault();
// save values so that they will be used in the timeout.
const password = this.refs.password && this.refs.password.value;
const newPassword = this.refs.newPassword && this.refs.newPassword.value;
const newPassword2 = this.refs.newPassword2 && this.refs.newPassword2.value;
setTimeout(() =>
this.props.onChangePass(
password, newPassword, newPassword2, this.setState.bind(this)
), 100);
}

render() {
const p = this.props;
const s = this.state;
// console.log(p);

return (
<main className="page account">
<SiteHeader {...p.siteHeader} />
Expand All @@ -57,7 +40,7 @@ export default class AccountPage extends Component {
<h2 className="heading">Credentials</h2>
<table className="account-info">
<tbody>
<tr className={classnames('account-info-item', { fade: s.editPassword })}>
<tr className="account-info-item">
<th className="title">Account Name:</th>
<td className="item">
{s.editName &&
Expand All @@ -75,7 +58,7 @@ export default class AccountPage extends Component {
}
{!s.editName &&
<button
className="link" onClick={() => { if (!s.editPassword) this.setState({ editName: true }); }}
className="link" onClick={() => this.setState({ editName: true })}
title="Click here to change your Account Name"
>
(change name)
Expand All @@ -84,7 +67,7 @@ export default class AccountPage extends Component {
{s.editName &&
<button
className="button"
onClick={() => { this.setState({ name: '', editName: false }); }}
onClick={() => this.setState({ name: '', editName: false })}
title="Cancel without saving new name"
>
cancel
Expand All @@ -94,10 +77,8 @@ export default class AccountPage extends Component {
<button
className="button make"
onClick={() => {
if (!s.editPassword) {
p.account.editName(s.name);
this.setState({ name: '', editName: false });
}
p.account.editName(s.name);
this.setState({ name: '', editName: false });
}}
title="Save new account name"
>
Expand All @@ -107,7 +88,7 @@ export default class AccountPage extends Component {
</td>
</tr>

<tr className={classnames('account-info-item', { fade: s.editPassword })}>
<tr className="account-info-item">
<th className="title">Secure Login ID:</th>
<td className="item">
{!s.showFullID &&
Expand All @@ -123,99 +104,18 @@ export default class AccountPage extends Component {
title={s.showFullID ? 'Hide full id' : 'Show full id'}
onClick={() => {
const showHide = !s.showFullID;
if (!s.editPassword) this.setState({ showFullID: showHide });
this.setState({ showFullID: showHide });
}}
>
{s.showFullID ? '(hide id)' : '(show full id)'}
</button>
</td>
</tr>

<tr className="account-info-item">
<th className="title">Password:</th>
{!s.editPassword &&
<td className="item">
<span>************</span>
<button
className="link"
onClick={() => this.setState({ editPassword: true })}
title="Click here to Change your Password."
>
(change password)
</button>
{s.msg !== '' &&
<div className="password-msg">
<span>
{s.msg}
</span>
<span
className="dismiss-message"
title="Click to dismiss message"
onClick={() => this.setState({ msg: '' })}
>
&#xf057;
</span>
</div>
}
</td>
}


{s.editPassword &&
<td className="item password-change-container">
<form onSubmit={this.handleSubmit}>
<input
className="input box"
ref="password"
type="password"
maxLength="256"
placeholder="current password"
title="enter your current password here"
/>
<br />
<input
className="input box"
ref="newPassword"
type="password"
maxLength="256"
placeholder="new password"
title="enter your desired new password here"
/>
<br />
<input
className="input box"
ref="newPassword2"
type="password"
maxLength="256"
placeholder="confirm new password"
title="re-enter your new password for confirmation"
/>
<br />
<button
type="button"
title="Cancel password change and keep your current Password."
className="button"
onClick={() => this.setState({ editPassword: false })}
>
cancel
</button>
<button
className="button make"
type="submit"
title="Click here to save your new Password."
>
confirm password change
</button>
</form>
</td>
}

</tr>
</tbody>
</table>
</div>
<div className="account-section">
<div className={s.editPassword ? 'account-info-item fade' : 'account-info-item'}>
<div className="account-info-item">
<h2 className="heading">Download Account</h2>
<p>
If you are running Augur using a local geth node, you can download your account data to login through the node.
Expand Down
22 changes: 19 additions & 3 deletions src/modules/auth/components/auth-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ import React, { Component, PropTypes } from 'react';
import classnames from 'classnames';
import Link from '../../link/components/link';
import Input from '../../common/components/input';
import Checkbox from '../../common/components/checkbox';

export default class AuthForm extends Component {
static propTypes = {
className: PropTypes.string,
title: PropTypes.string,
password: PropTypes.string,
secureLoginID: PropTypes.string,
rememberMe: PropTypes.bool,
passwordPlaceholder: PropTypes.string,
password2Placeholder: PropTypes.string,
isVisibleName: PropTypes.bool,
isVisiblePassword: PropTypes.bool,
isVisiblePassword2: PropTypes.bool,
isVisibleID: PropTypes.bool,
isVisibleRememberMe: PropTypes.bool,
clearName: PropTypes.bool,
clearPassword: PropTypes.bool,
clearCode: PropTypes.bool,
Expand All @@ -29,12 +32,17 @@ export default class AuthForm extends Component {
onSubmit: PropTypes.func
};

static defaultProps = {
rememberMe: false
};

constructor(props) {
super(props);
this.handleSubmit = this.handleSubmit.bind(this);
this.state = {
msg: this.props.msg,
secureLoginID: this.props.secureLoginID
secureLoginID: this.props.secureLoginID,
rememberMe: this.props.rememberMe
};
}

Expand All @@ -61,9 +69,10 @@ export default class AuthForm extends Component {
const secureLoginID = this.state.secureLoginID;
const password = this.refs.password.value;
const password2 = this.refs.password2.value;
const rememberMe = this.state.rememberMe;
this.setState({ msg: '' });
setTimeout(() =>
this.props.onSubmit(name, password, password2, secureLoginID), 100);
this.props.onSubmit(name, password, password2, secureLoginID, rememberMe), 100);
}

render() {
Expand Down Expand Up @@ -122,6 +131,13 @@ export default class AuthForm extends Component {
placeholder={p.password2Placeholder || 'confirm password'}
maxLength="256"
/>
<Checkbox
className={classnames({ displayNone: !p.isVisibleRememberMe })}
title="Click Here to remember your account information locally."
text="Remember Me"
isChecked={s.rememberMe}
onClick={() => this.setState({ rememberMe: !s.rememberMe })}
/>
{p.bottomLinkText &&
<Link
className="bottom-link"
Expand Down
16 changes: 8 additions & 8 deletions src/modules/create-market/components/create-market-form-3.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { PropTypes } from 'react';
import classnames from 'classnames';
import { EXPIRY_SOURCE_GENERIC, EXPIRY_SOURCE_SPECIFIC } from '../../create-market/constants/market-values-constraints';
import InputList from '../../common/components/input-list';
import FormButtons from '../../create-market/components/create-market-form-buttons';
import Input from '../../common/components/input';
Expand All @@ -12,23 +11,23 @@ const CreateMarketForm4 = (p) => (
<h4>What is the source of expiry information for your question?</h4>
<span className="expiry-source-option">
<input
value={EXPIRY_SOURCE_GENERIC}
value={p.expirySourceTypes.generic}
type="radio"
checked={p.expirySource === EXPIRY_SOURCE_GENERIC}
onChange={() => p.onValuesUpdated({ expirySource: EXPIRY_SOURCE_GENERIC })}
checked={p.expirySource === p.expirySourceTypes.generic}
onChange={() => p.onValuesUpdated({ expirySource: p.expirySourceTypes.generic })}
/>
<span>Outcome will be covered by local, national or international news media.</span>
</span>
<span className="expiry-source-option">
<input
value={EXPIRY_SOURCE_SPECIFIC}
value={p.expirySourceTypes.specific}
type="radio"
checked={p.expirySource === EXPIRY_SOURCE_SPECIFIC}
onChange={() => p.onValuesUpdated({ expirySource: EXPIRY_SOURCE_SPECIFIC })}
checked={p.expirySource === p.expirySourceTypes.specific}
onChange={() => p.onValuesUpdated({ expirySource: p.expirySourceTypes.specific })}
/>
<span>Outcome will be detailed on a specific publicly available website:</span>
</span>
<div className={classnames('expiry-source-url', { displayNone: p.expirySource !== EXPIRY_SOURCE_SPECIFIC })}>
<div className={classnames('expiry-source-url', { displayNone: p.expirySource !== p.expirySourceTypes.specific })}>
<Input
type="text"
value={p.expirySourceUrl}
Expand Down Expand Up @@ -80,6 +79,7 @@ const CreateMarketForm4 = (p) => (
CreateMarketForm4.propTypes = {
expirySource: PropTypes.string,
expirySourceUrl: PropTypes.string,
expirySourceTypes: PropTypes.object,
tags: PropTypes.array,
tagsMaxNum: PropTypes.number,
tagMaxLength: PropTypes.number,
Expand Down
39 changes: 0 additions & 39 deletions src/modules/create-market/constants/market-values-constraints.js

This file was deleted.

4 changes: 3 additions & 1 deletion src/selectors/auth-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const loginParts = {
isVisibleName: false,
isVisibleID: true,
isVisiblePassword2: false,
isVisibleRememberMe: true,
topLinkText: 'Sign Up',
};

Expand All @@ -25,6 +26,7 @@ const signUp = {
isVisibleName: true,
isVisibleID: false,
isVisiblePassword2: true,
isVisibleRememberMe: false,
topLinkText: 'login',
onSubmit: SignUpOnSubmit,
topLink: {
Expand Down Expand Up @@ -57,7 +59,7 @@ const logIn = {
require('../selectors').update({ authForm: { ...signUp, clearPassword: true, clearName: true } });
}
},
onSubmit: (secureLoginID, password) => {
onSubmit: (name, password, password2, secureLoginID, rememberMe) => {
require('../selectors').update({ authForm: { ...signUp, clearName: true,
clearPassword: true } });
loginAccount.signIn();
Expand Down

0 comments on commit b4f159d

Please sign in to comment.