Skip to content
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

feat: Add MANA approval to the buy items slots flow #1707

Merged

Conversation

LautaroPetaccio
Copy link
Contributor

This PR does the following:

  • Adds the MANA approval modal that will be shown if the user has not authorized the MANA contract to operate with the tiers contract.
  • Changes the way the modal closes to clear the errors when it does.
  • Fixes an issue where errors with empty strings wouldn't show the error message.
  • Abstracts the process of building a MANA authorization for a contract.

@vercel
Copy link

vercel bot commented Dec 31, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/decentraland/builder/7vcUSYSEYEM8ELVgyzuJ1ubqkxtq
✅ Preview: https://builder-git-feat-add-mana-approve-modal-to-e6c8a3-decentraland1.vercel.app

@coveralls
Copy link

coveralls commented Dec 31, 2021

Pull Request Test Coverage Report for Build 1658645763

  • 6 of 12 (50.0%) changed or added relevant lines in 4 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.05%) to 17.843%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/components/Modals/BuyItemSlotsModal/BuyItemSlotsModal.container.ts 0 1 0.0%
src/components/ThirdPartyCollectionDetailPage/ThirdPartyCollectionDetailPage.container.ts 0 1 0.0%
src/modules/wallet/sagas.ts 0 4 0.0%
Files with Coverage Reduction New Missed Lines %
src/components/Modals/BuyItemSlotsModal/BuyItemSlotsModal.container.ts 1 0%
src/modules/wallet/sagas.ts 1 0%
Totals Coverage Status
Change from base Build 1641432461: 0.05%
Covered Lines: 2018
Relevant Lines: 10136

💛 - Coveralls

Copy link
Contributor

@nicosantangelo nicosantangelo left a comment

Choose a reason for hiding this comment

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

A few silly things

@@ -16,6 +16,12 @@ export default class BuyItemSlotsModal extends React.PureComponent<Props, State>
selectedTierId: undefined
}

onCloseModal = (): void => {
Copy link
Contributor

Choose a reason for hiding this comment

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

To follow conventions, I think this should be called handleOnCloseModal right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it!

Comment on lines 24 to +25
onTierSelected: () => dispatch(clearTiersError()),
onBeforeClose: () => dispatch(clearTiersError()),
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be coincidental, but given that we have two methods with different names poiting to the same dispatched action, what if we just have onClearTiersError() and call that instead?

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 definitely though about it, but from the perspective of the component as an isolated chunk of code, there's nothing to explicitly clear the errors, so it might be a bit confusing.

const MANA_SYMBOL = '⏣'

export function addSymbol(num: string | number) {
return num > 0 ? `${MANA_SYMBOL} ${num.toString()}` : ''
}

export function buildManaAuthorization(address: string, chainId: ChainId, contractName: ContractName): Authorization {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can test this method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I forgot to add tests to it! Added them.

…ub.com:decentraland/builder into feat/add-mana-approve-modal-to-buy-items-slots
@LautaroPetaccio LautaroPetaccio merged commit 286464e into master Jan 5, 2022
@LautaroPetaccio LautaroPetaccio deleted the feat/add-mana-approve-modal-to-buy-items-slots branch January 5, 2022 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants