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

Adds subcomponents to AdvancedTradeForm #241

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

kierangillen
Copy link
Contributor

@kierangillen kierangillen commented Apr 1, 2022

  • This is an initial pass at reducing complexity in the AdvancedTradeForm component. This PR breaks the render into more manageable subcomponents. It also moves the checkbox boolean states into one object to reduce re-renders for faster updates and to simplify any potential consistency issues.

@vercel
Copy link

vercel bot commented Apr 1, 2022

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

mango-ui-v3 – ./

🔍 Inspect: https://vercel.com/blockworks-foundation/mango-ui-v3/HnFFVvEmYHpn1Sh2UCNoE49sVvQj
✅ Preview: https://mango-ui-v3-git-kieran-advanced-tr-51e7d7-blockworks-foundation.vercel.app

mango-ui-v3-devnet – ./

🔍 Inspect: https://vercel.com/blockworks-foundation/mango-ui-v3-devnet/2e9VWVLcpDSiYo2YX8FmNcLN4jFd
✅ Preview: https://mango-ui-v3-devnet-git-kieran-adva-a4f33c-blockworks-foundation.vercel.app

@github-actions
Copy link

github-actions bot commented Apr 1, 2022

📦 Next.js Bundle Analysis

This analysis was generated by the next.js bundle analysis action 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 744.24 KB (🟡 +487 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

@kierangillen kierangillen requested review from saml33 and tlrjs April 4, 2022 12:44
@kierangillen kierangillen changed the title WIP: Adds sub components to AdvancedTradeForm Adds subcomponents to AdvancedTradeForm Apr 4, 2022
@kierangillen kierangillen marked this pull request as ready for review April 4, 2022 12:47
Copy link
Contributor

@saml33 saml33 left a comment

Choose a reason for hiding this comment

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

Looks okay to me. There are a few things resolved in main that would need to be updated.

– "Post & Slide" is now "Slide"
– Checking "Post & Slide" and submitting throws a "Missing price" error
– "Post & Slide" shouldn't show on market orders

@@ -722,13 +701,6 @@ export default function AdvancedTradeForm({
}
}

// const showReduceOnly = (basePosition: number) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't think this is wired up on main but it's probably a better UX to not show the reduce only checkbox when a user has no position to reduce

Copy link
Contributor Author

@kierangillen kierangillen Apr 6, 2022

Choose a reason for hiding this comment

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

Okay I can leave in these comments, with this change the aim wasn't to add new logic that needs to be tested, but just refactoring the code structure.

Copy link
Contributor

Choose a reason for hiding this comment

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

No worries

// (basePosition < 0 && side === 'buy')
// )
// }

/*
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thing here. Not sure why sizeTooLarge is set to false. Good to save users from submitting a transaction if size is too large

@kierangillen
Copy link
Contributor Author

kierangillen commented Apr 6, 2022

@saml33 Thanks for your comments, "Post & Slide" is now "Slide" and "Post & Slide" shouldn't show on market orders have already been added to this PR. Could you send me a reference to the fix for the "Missing price" error? I can't reproduce it, so maybe it's already in as well.

@saml33
Copy link
Contributor

saml33 commented Apr 7, 2022

@kierangillen All good. Was messing around with the branch and prob didn't have the latest changes.

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.

2 participants