0xProject / 0x-launch-kit-frontend

Apache License 2.0
112 stars 207 forks source link

(Feature) Adds a warning card if the user is not on an available network #438

Closed Agupane closed 5 years ago

Agupane commented 5 years ago

Closes #432

Looks like this now: image

Description:

Basically uses the Web3State.Error to detect if the network id is not supported by the app and adds this check on both: /src/components/erc20/marketplace/wallet_balance and /src/components/common/toolbar

Note: the Web3State.Error could occur if the user is not on an available network, if there was an error trying to fetch account information or if there are not default contract addresses found for the given network id. Maybe we could split those cases to avoid showing a wrong error message for each case, but I think it's not very important right now (we are not doing anything with those states right now)

Based on those checks the components will render the following error card: <ErrorCard fontSize={FontSize.Large} text={errorsWallet.mmWrongNetwork} icon={ErrorIcons.Warning} />

Note that this card should have the IconComponent for Warning, but it is not available right now, later on @gabitoesmiapodo will add it. It's now available.