-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch out app utilities with AragonUI utilities #1166
Switch out app utilities with AragonUI utilities #1166
Conversation
* Copy improvements * More specific copy * Reverting controversial change
* Change confusing token manager copy
* voting: fetch active account votes in script * Move connectedAccount out of the store and cache * Add comment about using strings over symbols * Move functions to helpers * Update comments Co-Authored-By: 2color <[email protected]> * Add newline
Improve the filters layout: - Move TransfersFilters to its own component. - Make the layout work at all sizes. - Update the download button so it looks like the other icon buttons. - Update some labels: - “Date range” => “Period” - “Transfer type” => “Type” (since it is already below the “Transfers” title). - Select the last 90 days (rolling) by default.
* Voting: fix bug with votes not loading initially * Add comment
Fixes aragon/client#734. With aragon/aragon.js#277 we now get the actual errors back from the RPC when a call goes wrong (e.g. naive `token.symbol()` on DAI) and we need to handle these explicitly. This PR converts a lot of the token fallback-related bits into simpler Promise-based code and adds explicit handlers for their error cases.
* TransferFilters: remove duplicate margin rules * DatePicker: update today border color * DateRangePicker: update to allow null values on dates * Transfers: refactor to no default date selection * DateRangeInput: fix font family declaration Co-Authored-By: AquiGorka <[email protected]> * Transfers: recover non-breaking space * DateRangeInput: improve placeholder logic and add input placeholder for screen readers * DateRangeInput: improve on placeholder for accesibility
…ragon#822) * feat(Payroll): small SLOAD optimizations to _transferTokensAmount * fix: put back accidentally deleted line from merge conflict
Prevents the app to crash on the current Firefox Nightly.
* VotingCard: update informative to question * Math utils: refactor scale values set to use bn * Add jest and babel-jest deps for tests * babelrc: add env tests presets * Add math utils tests
Noticeable improvement: the side panels transition should be smoother. Changes: - Move panels in their own components, so that the rendering of SidePanel can be skipped entirely. - Memoize the object returned by usePanel(), so that it can be compared using a strict equality. - Move the voting panel actions in their own component fetching their data, so that the panel component doesn’t need to render that much anymore. - Don’t recreate `votes` every second, instead only do it if any “opened” status has changed.
* Upgrade aragonOS dependency For Vault, Agent and Finance. To fix Istanbul related issues. See https://github.com/aragon/aragonOS/releases/tag/v4.3.0 for more context. * payroll: fix gas values in tests * agent: fix tests `isValidSignature` was calling the `bytes` version due to overloading issue with Truffle. * Fix CI, address PR aragon#1172 comments
- Also, remove addressesEqual() from web3-utils.js
- Also, remove addressesEqual() from web3-utils.js
- Also, remove addressesEqual() from web3-utils.js
…ount() - Also, remove formatAmount() from math-utils.js
@sohkai These are the only duplicated utilities I could find, but let me know if there are others I can add to the list! Also, I couldn't find any way to install the Survey app (?), so I've skipped replacing |
No worries, we are removing the Survey app from this repo soon anyway :). Thanks for doing this! |
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.
Looking really good @ECWireless! Perhaps @bpierre or @Evalir can do a quick scan to check if we have any other utilities that can be deduped, but otherwise this is great!
I've also left a few comments for us to work out and hopefully get this merged soon!
@@ -1,8 +1,7 @@ | |||
import React from 'react' |
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.
Ah, sorry for the rework—we are likely to have a conflict here against #1113.
We'll merge that one first, and then it should be pretty easy to rollback these changes against Voting here to solve any conflicts :).
apps/token-manager/app/src/script.js
Outdated
@@ -1,6 +1,6 @@ | |||
import Aragon, { events } from '@aragon/api' | |||
import { addressesEqual } from '@aragon/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.
Ah... this may be a problem @bpierre.
This is still run in the context of a browser, but I think we should aim for this script to be runnable in a node / etc. environment. AFAIK nothing else used by the script should cause an issue.
From what I remember, importing @aragon/ui
may force a browser context?
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.
It should be fine, aragonUI is now compatible with non-DOM environments: https://github.com/aragon/aragon-ui/pull/699
But another thing to take care of would be to ensure that the entire library doesn’t get included in script.js. That would require using --experimental-scope-hoisting
, but we were having issues with it IIRC.
What would you guys think of inlining the function in every script.js using it, until we move to Parcel 2 or another bundler with a good support for tree shaking? https://github.com/aragon/aragon-ui/blob/master/src/utils/web3.js#L82-L92
* Fix finance USD conversion mechanism * Add Jest * Simplify conversion function * Add some tests for the conversion utility Co-authored-by: Pierre Bertet <[email protected]>
6c5d3f2
to
548a172
Compare
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.
Looking awesome @ECWireless ! Checked for any utilities left and didn't see any that we could move for now. Did some QA over the apps and everything seems to be consistent. Added 2 commits for:
- Bumping Voting's
@aragon/ui
version to1.4.2
, as the previous one didn't includeformatTokenAmount
and was thus breaking the app. (Will be added by Voting: use BN.js everywhere #1113 as well) - Re-adding date formatting changes added in a previous commit by another contributor. This was probably due to switching branches on a commit that didn't have them!
- Fixing some small typos. :)
Pretty confident this should be good to go now, but if you have any time @bpierre you can take a look! We will still have to wait for #1113 though.
@@ -6,7 +6,7 @@ import { | |||
Incoming, | |||
Outgoing, | |||
} from '../transfer-types' | |||
import { addressesEqual } from '../lib/web3-utils' | |||
import { addressesEqual} from '@aragon/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.
import { addressesEqual} from '@aragon/ui' | |
import { addressesEqual } from '@aragon/ui' |
apps/token-manager/app/src/script.js
Outdated
@@ -1,6 +1,6 @@ | |||
import Aragon, { events } from '@aragon/api' | |||
import { addressesEqual } from '@aragon/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.
It should be fine, aragonUI is now compatible with non-DOM environments: https://github.com/aragon/aragon-ui/pull/699
But another thing to take care of would be to ensure that the entire library doesn’t get included in script.js. That would require using --experimental-scope-hoisting
, but we were having issues with it IIRC.
What would you guys think of inlining the function in every script.js using it, until we move to Parcel 2 or another bundler with a good support for tree shaking? https://github.com/aragon/aragon-ui/blob/master/src/utils/web3.js#L82-L92
6e14239
to
f7ef93b
Compare
Fixes #1156
This PR is a work in progress.
Utilities to import from AragonUI:
shortenAddress()
addressesEqual()
formatTokenAmount()
in place offormatNumber()