Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
[Registry] Clear input and working buttons (#3563)
Browse files Browse the repository at this point in the history
* onClick to onTouchTap #3556

* onClick to onTouchTap 2 #3556

* Registry dApp clear input + check Signer #3557
  • Loading branch information
ngotchac authored and jacogr committed Nov 21, 2016
1 parent 8a1b585 commit 5735d94
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 17 deletions.
2 changes: 1 addition & 1 deletion js/src/dapps/registry/Lookup/lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default class Lookup extends Component {
label='Lookup'
primary
icon={ <SearchIcon /> }
onClick={ this.onLookupClick }
onTouchTap={ this.onLookupClick }
/>
</div>
<CardText>{ output }</CardText>
Expand Down
27 changes: 22 additions & 5 deletions js/src/dapps/registry/Names/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// 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) =>
!!queue.find((entry) => entry.action === action && entry.name === name);
Expand Down Expand Up @@ -43,14 +43,23 @@ export const reserve = (name) => (dispatch, getState) => {
const values = [ sha3(name) ];

dispatch(reserveStart(name));

reserve.estimateGas(options, values)
.then((gas) => {
options.gas = gas.mul(1.2).toFixed(0);
return reserve.postTransaction(options, values);
})
.then((data) => {
.then((requestId) => {
return api.pollMethod('parity_checkRequest', requestId);
})
.then((txhash) => {
dispatch(reserveSuccess(name));
}).catch((err) => {
})
.catch((err) => {
if (err && err.type === 'REQUEST_REJECTED') {
return dispatch(reserveFail(name));
}

console.error(`could not reserve ${name}`);
if (err) console.error(err.stack);
dispatch(reserveFail(name));
Expand Down Expand Up @@ -81,9 +90,17 @@ export const drop = (name) => (dispatch, getState) => {
options.gas = gas.mul(1.2).toFixed(0);
return drop.postTransaction(options, values);
})
.then((data) => {
.then((requestId) => {
return api.pollMethod('parity_checkRequest', requestId);
})
.then((txhash) => {
dispatch(dropSuccess(name));
}).catch((err) => {
})
.catch((err) => {
if (err && err.type === 'REQUEST_REJECTED') {
dispatch(reserveFail(name));
}

console.error(`could not drop ${name}`);
if (err) console.error(err.stack);
dispatch(reserveFail(name));
Expand Down
18 changes: 17 additions & 1 deletion js/src/dapps/registry/Names/names.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,22 @@ export default class Names extends Component {
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 () {
const { action, name } = this.state;
const { fee, pending, queue } = this.props;
Expand Down Expand Up @@ -120,7 +136,7 @@ export default class Names extends Component {
label={ action === 'reserve' ? 'Reserve' : 'Drop' }
primary
icon={ <CheckIcon /> }
onClick={ this.onSubmitClick }
onTouchTap={ this.onSubmitClick }
/>
{ queue.length > 0
? (<div>{ useSignerText }{ renderQueue(queue) }</div>)
Expand Down
2 changes: 1 addition & 1 deletion js/src/dapps/registry/Records/records.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class Records extends Component {
label='Save'
primary
icon={ <SaveIcon /> }
onClick={ this.onSaveClick }
onTouchTap={ this.onSaveClick }
/>
</CardText>
</Card>
Expand Down
2 changes: 1 addition & 1 deletion js/src/modals/LoadContract/loadContract.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export default class LoadContract extends Component {
const secondaryText = description || `Saved ${moment(timestamp).fromNow()}`;
const remove = removable
? (
<IconButton onClick={ onDelete }>
<IconButton onTouchTap={ onDelete }>
<DeleteIcon />
</IconButton>
)
Expand Down
4 changes: 2 additions & 2 deletions js/src/ui/Form/TypedInput/typedInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ export default class TypedInput extends Component {
<IconButton
iconStyle={ iconStyle }
style={ style }
onClick={ this.onAddField }
onTouchTap={ this.onAddField }
>
<AddIcon />
</IconButton>

<IconButton
iconStyle={ iconStyle }
style={ style }
onClick={ this.onRemoveField }
onTouchTap={ this.onRemoveField }
>
<RemoveIcon />
</IconButton>
Expand Down
2 changes: 1 addition & 1 deletion js/src/views/Dapps/dapps.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default class Dapps extends Component {
label='edit'
key='edit'
icon={ <EyeIcon /> }
onClick={ this.store.openModal }
onTouchTap={ this.store.openModal }
/>
] }
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class TransactionPendingFormConfirm extends Component {
data-effect='solid'
>
<RaisedButton
onClick={ this.onConfirm }
onTouchTap={ this.onConfirm }
className={ styles.confirmButton }
fullWidth
primary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class TransactionPendingFormReject extends Component {
<strong>This cannot be undone</strong>
</div>
<RaisedButton
onClick={ onReject }
onTouchTap={ onReject }
className={ styles.rejectButton }
fullWidth
label={ 'Reject Transaction' }
Expand Down
4 changes: 2 additions & 2 deletions js/src/views/Status/components/CallsToolbar/CallsToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class CallsToolbar extends Component {
<div className={ styles.callActions } { ...this._test('button-container') }>
<IconButton
className={ styles.callAction }
onClick={ this.setCall }
onTouchTap={ this.setCall }
tooltip='Set'
tooltipPosition='top-left'
{ ...this._test('button-setCall') }
Expand All @@ -66,7 +66,7 @@ export default class CallsToolbar extends Component {
</IconButton>
<IconButton
className={ styles.callAction }
onClick={ this.makeCall }
onTouchTap={ this.makeCall }
tooltip='Fire again'
tooltipPosition='top-left'
{ ...this._test('button-makeCall') }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class ScrollTopButton extends Component {
return (
<IconButton
className={ `${styles.scrollButton} ${hiddenClass}` }
onClick={ this._scrollToTop }>
onTouchTap={ this._scrollToTop }>
<ArrowUpwardIcon />
</IconButton>
);
Expand Down

0 comments on commit 5735d94

Please sign in to comment.