-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
* js-3rdparty-shapeshift: call is not needed within closure define functions explicitly withing closure fix tests with new structure, proper naming es6-ify library & flatten GPL header initial import before tweaking starts
It looks like @jacogr signed our Contributor License Agreement. 👍 Many thanks, Ethcore CLA Bot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny remarks:
- the modal window is not scrollable on small screens
- at the 2. step, the code should ideally be easily copied to clipboard
- for the "fund account" button that opens the modal, i'd like to have a different icon, e.g. https://design.google.com/icons/#ic_attach_money
return ( | ||
<div className={ styles.center }> | ||
<div className={ styles.info }> | ||
<a href='https://shapeshift.io' target='_blank'>ShapeShift.io</a> is awaiting a { typeSymbol } deposit. Send the funds from you { typeSymbol } network client to - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo. it should be "fund from your … network".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ty, will address.
Valid, not going to be fixed in this PR, but logging them:
Valid, will fix:
[EDIT: just going to use their btn icon & name, self-explanatory] |
<Value amount={ incomingCoin } symbol={ incomingType } /> => <Value amount={ outgoingCoin } symbol={ outgoingType } /> | ||
</div> | ||
<div className={ styles.info }> | ||
The funds will reflect in your Parity account shortly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo? Should be "The change in funds will be reflected ..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do.
function call (method, options) { | ||
return fetch(`${ENDPOINT}/${method}`, options) | ||
.then((response) => { | ||
if (response.status !== 200) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think checking for 200 <= status && status < 300
is safer, as the HTTP RFC defines 2xx
as "client's request was successfully received, understood, and accepted.".
Edit: Check for response.ok
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
response.ok :)
return fetch(`${ENDPOINT}/${method}`, options) | ||
.then((response) => { | ||
if (response.status !== 200) { | ||
throw { code: response.status, message: response.statusText }; // eslint-disable-line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As people often check for err instanceof Error
, i'd consider using new Error(…)
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Actually needs to be done to align with the other APIs as well.
return; | ||
|
||
case 'failed': | ||
subscription.callback({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above – using new Error(…)
might be useful, because people tend to do err instanceof Error
or err.toString()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only issue here is that there are 2 types of errors - recoverable and non-recoverable. The fatal flag indicates that. So not 100% sure how to handle that.
} | ||
|
||
function _pollStatus () { | ||
subscriptions.map(_getSubscriptionStatus); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be .forEach
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, fixed.
</div> | ||
); | ||
} | ||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In AwaitingDepositStep
, AwaitingExchangeStep
, CompletedStep
, ErrorStep
and OptionsStep
, there's a lot of duplicate/boilerplatisch code. It's a lot of stuff to read through for not soo much complexity being handled; Maybe we can rduce that a little. :)
Also, but this is a matter of taste, having separate directories for these steps is bloat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each component in their own directory. We've been following that through the whole codebase.
|
||
return ( | ||
<div className={ styles.body }> | ||
<span>{ value }</span><small>{ symbol || 'ΞTH' }</small> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<span>
is an inline element. As of HTML5, <small>
has a semantical meaning and should not be used for stylistic purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should fix it in a fixes PR - I actually think I started adopting that after seeing it in the Signer. Agreed in principle though, but needs to be done properly. (May be worth it to pull in this component there then and whereever we do this type of thing)
} | ||
|
||
state = { | ||
stage: 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think strings as values of stage
would be both more robust & easier to reason about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in this case yes, since there is not a lot of jumping. Just keeping it consistent though.
return {}; | ||
} | ||
|
||
function mapDispatchToProps (dispatch) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using Redux just for this isn't worth it, given that Redux adds complexity and makes it harder to follow the flow of data. I'd either go all in and move this component's state
to Redux, or remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bringing this whole Shapeshift logic to Redux totally makes sense to me, as it is easily testable, (in doubt) more robust and modelled independently from the UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Redux state is just there for the newError action. There is no internal state in the Redux store.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly, I consider this as "not worth" the Redux complexity. I propose to pull the stuff that is in state
right now into Redux.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this was a component like a dapp, self-contained, yes. I honestly don't want to be coding for the next 2 days just to do that complexity and conversion where the state is only applicable to the single component.
So no, I'd rather get features out than coding for the sake of coding where in the end I won't be able to follow the actual code. I think Redux is great where I need global state, don't need it here. (newError is global)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this was a component like a dapp, self-contained, yes. I honestly don't want to be coding for the next 2 days just to do that complexity and conversion where the state is only applicable to the single component.
So no, I'd rather get features out than coding for the sake of coding where in the end I won't be able to follow the actual code. I think Redux is great where I need global state, don't need it here. (newError is global)
Fair enough.
Often state is more global than one immeadiatly thinks. There's more parts of the app that should pay attention to each other than we lazy developers like to think of.
const { iconsrc } = this.state; | ||
const size = inline ? '32px' : '56px'; | ||
const classes = `${styles.icon} ${center ? styles.center : styles.left} ${padded ? styles.padded : ''} ${inline ? styles.inline : ''} ${className}`; | ||
const classes = `${styles.icon} ${center ? styles.center : styles.left} ${padded ? styles.padded : ''} ${inline ? styles.inline : ''} ${button ? styles.button : ''} ${className}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use an array? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like that, should have done it from the start - but kept adding more and more cruft. Will fix.
@@ -23,3 +23,7 @@ | |||
margin: 0; | |||
text-transform: uppercase; | |||
} | |||
|
|||
.waiting { | |||
margin: 0 -1em 0 -1em; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is not very modular (;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not 100% with you here.
Sry for the requested & approved changes spam, i'm still figuring out how to use this. 😄 |
implements the outstanding Fund Account functionality. Demo of the functionality -
https://youtu.be/1i37yMa3NCc (EDIT: Updated the UI slightly so we don't need to come back to it immediately - https://youtu.be/BIS47mYRxlk)
Requires/includes https://github.com/ethcore/parity/pull/2088 which have been extended slightly to have event subscribe functionality as we have in the other APIs. (Contract, Core)
Future work: (EDIT: addressed in the last commit, updated video added above)
UI could be prettier & much more graphical and snazzy :(there is an initial delay on clicking shift which is not a perfect UX (some initial busy feedback would be good)