[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'
primary
icon={ <SearchIcon /> }
onClick={ this.onLookupClick }
onTouchTap={ this.onLookupClick }
/>
</div>
<CardText>{ output }</CardText>

View File

@ -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);
@ -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));
@ -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));

View File

@ -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;
@ -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>)

View File

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

View File

@ -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>
)

View File

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

View File

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

View File

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

View File

@ -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' }

View File

@ -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') }
@ -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') }

View File

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