[Registry] Clear input and working buttons (#3563)

* onClick to onTouchTap #3556

* onClick to onTouchTap 2 #3556

* Registry dApp clear input + check Signer #3557
This commit is contained in:
Nicolas Gotchac 2016-11-21 20:44:37 +01:00 committed by Jaco Greeff
parent 8a1b585da2
commit 5735d948f5
11 changed files with 50 additions and 17 deletions

View File

@ -77,7 +77,7 @@ export default class Lookup extends Component {
label='Lookup' label='Lookup'
primary primary
icon={ <SearchIcon /> } icon={ <SearchIcon /> }
onClick={ this.onLookupClick } onTouchTap={ this.onLookupClick }
/> />
</div> </div>
<CardText>{ output }</CardText> <CardText>{ output }</CardText>

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
import { sha3 } from '../parity.js'; import { sha3, api } from '../parity.js';
const alreadyQueued = (queue, action, name) => const alreadyQueued = (queue, action, name) =>
!!queue.find((entry) => entry.action === action && entry.name === name); !!queue.find((entry) => entry.action === action && entry.name === name);
@ -43,14 +43,23 @@ export const reserve = (name) => (dispatch, getState) => {
const values = [ sha3(name) ]; const values = [ sha3(name) ];
dispatch(reserveStart(name)); dispatch(reserveStart(name));
reserve.estimateGas(options, values) reserve.estimateGas(options, values)
.then((gas) => { .then((gas) => {
options.gas = gas.mul(1.2).toFixed(0); options.gas = gas.mul(1.2).toFixed(0);
return reserve.postTransaction(options, values); return reserve.postTransaction(options, values);
}) })
.then((data) => { .then((requestId) => {
return api.pollMethod('parity_checkRequest', requestId);
})
.then((txhash) => {
dispatch(reserveSuccess(name)); dispatch(reserveSuccess(name));
}).catch((err) => { })
.catch((err) => {
if (err && err.type === 'REQUEST_REJECTED') {
return dispatch(reserveFail(name));
}
console.error(`could not reserve ${name}`); console.error(`could not reserve ${name}`);
if (err) console.error(err.stack); if (err) console.error(err.stack);
dispatch(reserveFail(name)); dispatch(reserveFail(name));
@ -81,9 +90,17 @@ export const drop = (name) => (dispatch, getState) => {
options.gas = gas.mul(1.2).toFixed(0); options.gas = gas.mul(1.2).toFixed(0);
return drop.postTransaction(options, values); return drop.postTransaction(options, values);
}) })
.then((data) => { .then((requestId) => {
return api.pollMethod('parity_checkRequest', requestId);
})
.then((txhash) => {
dispatch(dropSuccess(name)); dispatch(dropSuccess(name));
}).catch((err) => { })
.catch((err) => {
if (err && err.type === 'REQUEST_REJECTED') {
dispatch(reserveFail(name));
}
console.error(`could not drop ${name}`); console.error(`could not drop ${name}`);
if (err) console.error(err.stack); if (err) console.error(err.stack);
dispatch(reserveFail(name)); dispatch(reserveFail(name));

View File

@ -86,6 +86,22 @@ export default class Names extends Component {
name: '' name: ''
}; };
componentWillReceiveProps (nextProps) {
const nextQueue = nextProps.queue;
const prevQueue = this.props.queue;
if (nextQueue.length > prevQueue.length) {
const newQueued = nextQueue[nextQueue.length - 1];
const newName = newQueued.name;
if (newName !== this.state.name) {
return;
}
this.setState({ name: '' });
}
}
render () { render () {
const { action, name } = this.state; const { action, name } = this.state;
const { fee, pending, queue } = this.props; const { fee, pending, queue } = this.props;
@ -120,7 +136,7 @@ export default class Names extends Component {
label={ action === 'reserve' ? 'Reserve' : 'Drop' } label={ action === 'reserve' ? 'Reserve' : 'Drop' }
primary primary
icon={ <CheckIcon /> } icon={ <CheckIcon /> }
onClick={ this.onSubmitClick } onTouchTap={ this.onSubmitClick }
/> />
{ queue.length > 0 { queue.length > 0
? (<div>{ useSignerText }{ renderQueue(queue) }</div>) ? (<div>{ useSignerText }{ renderQueue(queue) }</div>)

View File

@ -52,7 +52,7 @@ export default class Records extends Component {
label='Save' label='Save'
primary primary
icon={ <SaveIcon /> } icon={ <SaveIcon /> }
onClick={ this.onSaveClick } onTouchTap={ this.onSaveClick }
/> />
</CardText> </CardText>
</Card> </Card>

View File

@ -174,7 +174,7 @@ export default class LoadContract extends Component {
const secondaryText = description || `Saved ${moment(timestamp).fromNow()}`; const secondaryText = description || `Saved ${moment(timestamp).fromNow()}`;
const remove = removable const remove = removable
? ( ? (
<IconButton onClick={ onDelete }> <IconButton onTouchTap={ onDelete }>
<DeleteIcon /> <DeleteIcon />
</IconButton> </IconButton>
) )

View File

@ -96,7 +96,7 @@ export default class TypedInput extends Component {
<IconButton <IconButton
iconStyle={ iconStyle } iconStyle={ iconStyle }
style={ style } style={ style }
onClick={ this.onAddField } onTouchTap={ this.onAddField }
> >
<AddIcon /> <AddIcon />
</IconButton> </IconButton>
@ -104,7 +104,7 @@ export default class TypedInput extends Component {
<IconButton <IconButton
iconStyle={ iconStyle } iconStyle={ iconStyle }
style={ style } style={ style }
onClick={ this.onRemoveField } onTouchTap={ this.onRemoveField }
> >
<RemoveIcon /> <RemoveIcon />
</IconButton> </IconButton>

View File

@ -67,7 +67,7 @@ export default class Dapps extends Component {
label='edit' label='edit'
key='edit' key='edit'
icon={ <EyeIcon /> } icon={ <EyeIcon /> }
onClick={ this.store.openModal } onTouchTap={ this.store.openModal }
/> />
] } ] }
/> />

View File

@ -74,7 +74,7 @@ class TransactionPendingFormConfirm extends Component {
data-effect='solid' data-effect='solid'
> >
<RaisedButton <RaisedButton
onClick={ this.onConfirm } onTouchTap={ this.onConfirm }
className={ styles.confirmButton } className={ styles.confirmButton }
fullWidth fullWidth
primary primary

View File

@ -37,7 +37,7 @@ export default class TransactionPendingFormReject extends Component {
<strong>This cannot be undone</strong> <strong>This cannot be undone</strong>
</div> </div>
<RaisedButton <RaisedButton
onClick={ onReject } onTouchTap={ onReject }
className={ styles.rejectButton } className={ styles.rejectButton }
fullWidth fullWidth
label={ 'Reject Transaction' } label={ 'Reject Transaction' }

View File

@ -57,7 +57,7 @@ export default class CallsToolbar extends Component {
<div className={ styles.callActions } { ...this._test('button-container') }> <div className={ styles.callActions } { ...this._test('button-container') }>
<IconButton <IconButton
className={ styles.callAction } className={ styles.callAction }
onClick={ this.setCall } onTouchTap={ this.setCall }
tooltip='Set' tooltip='Set'
tooltipPosition='top-left' tooltipPosition='top-left'
{ ...this._test('button-setCall') } { ...this._test('button-setCall') }
@ -66,7 +66,7 @@ export default class CallsToolbar extends Component {
</IconButton> </IconButton>
<IconButton <IconButton
className={ styles.callAction } className={ styles.callAction }
onClick={ this.makeCall } onTouchTap={ this.makeCall }
tooltip='Fire again' tooltip='Fire again'
tooltipPosition='top-left' tooltipPosition='top-left'
{ ...this._test('button-makeCall') } { ...this._test('button-makeCall') }

View File

@ -45,7 +45,7 @@ export default class ScrollTopButton extends Component {
return ( return (
<IconButton <IconButton
className={ `${styles.scrollButton} ${hiddenClass}` } className={ `${styles.scrollButton} ${hiddenClass}` }
onClick={ this._scrollToTop }> onTouchTap={ this._scrollToTop }>
<ArrowUpwardIcon /> <ArrowUpwardIcon />
</IconButton> </IconButton>
); );