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

refactor: Redirect to liquidity token page after adding liquidity #6705

Conversation

memoyil
Copy link
Collaborator

@memoyil memoyil commented Apr 23, 2023

🤖 Generated by Copilot at 81e3e33

Summary

🎣🔄🐛

Refactored the pending text logic for increasing liquidity in V3 by creating a custom hook useSupplyingPendingText and using it in both IncreaseLiquidityV3.tsx and V3FormView/index.tsx. Improved the error handling and redirection logic for the percentage inputs and the liquidity supply operation.

We're adding liquidity to the pool, me hearties
With useSupplyingPendingText we'll do it smartly
Heave away, heave away, on the count of three
We'll handle errors and redirect with glee

Walkthrough

  • Extract the logic for generating the pending text for the increase liquidity transaction into a custom hook useSupplyingPendingText and reuse it in both the IncreaseLiquidityV3.tsx and the V3FormView/index.tsx files (link, link, link)
  • Move the imports of formatCurrencyAmount, currentLanguage, and locale from the main components to the new hook file where they are used to format the amounts for the pending text (link, link, link, link)
  • Modify the onPercentInput callbacks for the currency A and B inputs to use optional chaining and nullish coalescing operators to handle the case where maxAmounts is undefined and prevent errors and crashes (link, link, link, link)
  • Modify the router.push call in the IncreaseLiquidityV3.tsx file to conditionally redirect to the existing position page or the liquidity page based on the hasExistingPosition and existingPositionDetails variables and improve the user experience (link)

@changeset-bot
Copy link

changeset-bot bot commented Apr 23, 2023

⚠️ No Changeset found

Latest commit: 077edc9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Apr 23, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 21, 2023 11:58pm
4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
aptos-web ⬜️ Ignored (Inspect) Jul 21, 2023 11:58pm
blog ⬜️ Ignored (Inspect) Jul 21, 2023 11:58pm
bridge ⬜️ Ignored (Inspect) Jul 21, 2023 11:58pm
uikit ⬜️ Ignored (Inspect) Jul 21, 2023 11:58pm

@vercel
Copy link

vercel bot commented Apr 23, 2023

@memoyil is attempting to deploy a commit to the PancakeSwap Team on Vercel.

A member of the Team first needs to authorize it.

@memoyil memoyil force-pushed the feature/refactor_pending_text_to_hook_redirect_to_token_page branch from 81e3e33 to 4b7f1e9 Compare April 24, 2023 08:38
@memoyil memoyil force-pushed the feature/refactor_pending_text_to_hook_redirect_to_token_page branch from 4b7f1e9 to 504c526 Compare April 28, 2023 13:52
@memoyil memoyil force-pushed the feature/refactor_pending_text_to_hook_redirect_to_token_page branch from 504c526 to 7705249 Compare May 3, 2023 06:15
@memoyil memoyil force-pushed the feature/refactor_pending_text_to_hook_redirect_to_token_page branch from 7705249 to 9ef1c4f Compare May 8, 2023 09:02
@memoyil memoyil force-pushed the feature/refactor_pending_text_to_hook_redirect_to_token_page branch from 9ef1c4f to f926c06 Compare May 15, 2023 14:44
@memoyil memoyil force-pushed the feature/refactor_pending_text_to_hook_redirect_to_token_page branch from f926c06 to b964e08 Compare May 19, 2023 15:22
@memoyil memoyil force-pushed the feature/refactor_pending_text_to_hook_redirect_to_token_page branch from b964e08 to 5df5313 Compare May 26, 2023 19:05
@memoyil memoyil force-pushed the feature/refactor_pending_text_to_hook_redirect_to_token_page branch from 5df5313 to cb8175d Compare May 29, 2023 09:32
@memoyil memoyil force-pushed the feature/refactor_pending_text_to_hook_redirect_to_token_page branch from cb8175d to a07645d Compare June 2, 2023 07:54
@memoyil memoyil force-pushed the feature/refactor_pending_text_to_hook_redirect_to_token_page branch from a07645d to 8fef785 Compare June 7, 2023 21:18
@memoyil memoyil force-pushed the feature/refactor_pending_text_to_hook_redirect_to_token_page branch from 8fef785 to 48b065c Compare June 29, 2023 09:08
@memoyil memoyil force-pushed the feature/refactor_pending_text_to_hook_redirect_to_token_page branch from 48b065c to 8215a6d Compare July 7, 2023 10:15
@memoyil memoyil force-pushed the feature/refactor_pending_text_to_hook_redirect_to_token_page branch from 8215a6d to 077edc9 Compare July 21, 2023 23:38
@chefjackson
Copy link
Collaborator

Close for now as it's stale. Feel free to reopen after updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants