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

Several Fixes to the UI #3799

Merged
merged 21 commits into from
Dec 11, 2016
Merged

Several Fixes to the UI #3799

merged 21 commits into from
Dec 11, 2016

Conversation

ngotchac
Copy link
Contributor

This PR includes these fixes:

  • Fix dapps separation: the margin between different kind of dapps was wrong/inexistant
  • Use React Router Link component for App Tabs: this enables the user to Ctrl+Click on a tab to open the page in a new tab (which wasn't the case previously). The tab active state is also handled by React Router, so no more map of URL path to Tab ; all is in the Router definition
  • New routes : use /addresses/:address instead of /address/:address. This enables React Router to properly manage the tabs active state. The old routes are still working, only a warning log is printed in the console
  • Fix flash of unsorted/unnamed accounts in address book while the app is loading
  • Prevent creating new Contracts instances, which was created by SMS Verification store (thus, contract lookups were occurring at each loading of an account page)
  • Enable loading of an external account page : going to /addresses/:unknownAddress shows informations about the :unknownAddress instead of a blank page. The user can then add it to his address book
  • Add balances to the accounts in account selection component in modals where an account needs to be selected to send a transaction (wallet transfer, contracts). This should prevent selecting an account with insufficient funds
  • Use the new onClose prop of the Autocomplete instead of a onBlur hack => better closing of autocomplete
  • Add dividers to Autocomplete : see the transfer modal, selecting a to address

@ngotchac ngotchac added A0-pleasereview 🤓 Pull request needs code review. M7-ui labels Dec 10, 2016
@@ -62,6 +62,10 @@ export default class Contracts {
}

static create (api) {
if (instance) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still don't seem to assign the new instance to the instance variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done in the Contracts constructor


<Route path='contracts'>
<IndexRoute component={ Contracts } />
<Route path='write' component={ WriteContract } />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we are renaming and fixing up - the "write contract" is very confusing. Had 2 people asking me now where the find the editor.

"Develop Contract" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (renamed the button)

return null;
}

const ethToken = balance.tokens.find((t) => t.token.tag.toLowerCase() === 'eth');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Naming is different from the tok.token in balancesReducer.
  2. No nulls here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix

@@ -139,6 +187,8 @@ export default class AddressSelect extends Component {
<IdentityName
className={ styles.name }
address={ address } />

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for the extra space?

import { PopoverAnimationVertical } from 'material-ui/Popover';

import { isEqual } from 'lodash';

// Hack to prevent "Unknown prop `disableFocusRipple` on <hr> tag" error
class Divider extends Component {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split components into their own files. Started doing that as cleanups where I've found them, the 100's of lines in a file just makes it very difficult to maintain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. However this is just a Hack because there is a bug in Material UI (using directly <Divider /> spits out Unknown prop disableFocusRipple on <hr> tag error logs). This will be deleted when a fix is out

@@ -28,6 +28,7 @@ export default class AddAddress extends Component {

static propTypes = {
contacts: PropTypes.object.isRequired,
address: PropTypes.string,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General comment. When changing these (or adding, removing), it would make sense to start putting them in alphabetical order since you are in there already. (It goes for everywhere - low overhead). This one should have been on-top as an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So here we separate the isRequired props to those optional. I think it's better to be able to see which props should absolutely be passed to a Component easily. Within those two categories, I agree they could be sorted from a-z

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we don't conform to that at all currently. With the Redux issues and not being able to pass required props this whole methodology falls apart. (e.g. see isTest which is absolutely required and just currently needs to be moved to non-required since it just errors all-over)

So there are 3 categories, Required, non-required & Redux. It just becomes an absolute mess and mental overhead to manage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it should be split into 3 categories. In the meanwhile, I prefer splitting in at least 2.

@@ -37,6 +37,7 @@ export default class DetailsStep extends Component {
onParamsChange: PropTypes.func.isRequired,
onInputsChange: PropTypes.func.isRequired,

balances: PropTypes.object,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here as above (last time, I promise) - rather than trying arbitrary spacings between props, just sort and condense. Easy to find without understanding what the developer had in mind as a category system.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above ;)

@@ -97,6 +99,7 @@ export default class DetailsStep extends Component {
value={ fromAddress }
error={ fromAddressError }
accounts={ accounts }
balances={ balances }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same sorting goes for passed props where touched.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed

onValueChange: PropTypes.func.isRequired,
values: PropTypes.array.isRequired,
valuesError: PropTypes.array.isRequired,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra blank line for sorting, remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@@ -26,7 +26,7 @@ import VerifyIcon from 'material-ui/svg-icons/action/verified-user';
import { EditMeta, DeleteAccount, Shapeshift, SMSVerification, Transfer, PasswordManager } from '~/modals';
import { Actionbar, Button, Page } from '~/ui';

import shapeshiftBtn from '../../../assets/images/shapeshift-btn.png';
import shapeshiftBtn from '~/../assets/images/shapeshift-btn.png';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great that it works.


if (hasContacts && Object.keys(balances).length === 0) {
return (
<Loading size={ 3 } />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worried about the loading sizes everywhere - should pick one size and just stick with it throughout. (Only exceptions may be whole pages where everything is blank)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I think size of loader should depend on where it is used. If it's displayed while loading the full app, it should be bigger than when loading MethodDecoding for example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. However in the UI itself it should be 100% consistent. So for the dapp example (not that it is used, agreed) - for the rest, all the same. This doesn't conform to the 2 used elsewhere since the introduction.

@jacogr
Copy link
Contributor

jacogr commented Dec 10, 2016

Merge in master for gitlab build checks.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.003%) to 85.6% when pulling 0f6681d on ng-ui-fixes into a6fcd8a on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 85.613% when pulling 70eab0d on ng-ui-fixes into 08a47ea on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 85.601% when pulling 70eab0d on ng-ui-fixes into 08a47ea on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.006%) to 85.607% when pulling e5c73b2 on ng-ui-fixes into 08a47ea on master.

@jacogr jacogr added A8-looksgood 🦄 Pull request is reviewed well. A7-looksgoodcantmerge 🙄 Pull request is reviewed well, but cannot be merged due to conflicts. and removed A0-pleasereview 🤓 Pull request needs code review. A8-looksgood 🦄 Pull request is reviewed well. labels Dec 10, 2016
@coveralls
Copy link

Coverage Status

Coverage remained the same at 85.601% when pulling e5c73b2 on ng-ui-fixes into 08a47ea on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.009%) to 85.609% when pulling e5c73b2 on ng-ui-fixes into 08a47ea on master.

@ngotchac ngotchac added A8-looksgood 🦄 Pull request is reviewed well. and removed A7-looksgoodcantmerge 🙄 Pull request is reviewed well, but cannot be merged due to conflicts. labels Dec 11, 2016
@gavofyork gavofyork merged commit 078feaa into master Dec 11, 2016
@gavofyork gavofyork deleted the ng-ui-fixes branch December 11, 2016 01:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants