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: extract TradeConfirmation component from LimitOrdersConfirmModal #2564

Merged
merged 22 commits into from
May 30, 2023

Conversation

shoom3301
Copy link
Collaborator

@shoom3301 shoom3301 commented May 29, 2023

Summary

Fixes #2429

Refactored LimitOrdersConfirmModal in order to create a generic TradeConfirmation component that can be used in any trade widget.
Unfortunately, in the changes we can't see that the component is just refactored version of LimitOrdersConfirmModal. But, in the first commit you can see that it just was moved using git mv.

TradeConfirmation looks like this:

image

Essentially, it's just a representation of sell + buy amounts with an arbitrary content at the bottom.

Changes

shoom3301 added 20 commits May 26, 2023 15:01
… fix/2429-1

# Conflicts:
#	src/common/pure/CurrencyAmountPreview/index.tsx
#	src/modules/limitOrders/pure/LimitOrdersConfirm/index.tsx
#	src/modules/limitOrders/pure/LimitOrdersConfirm/styled.tsx
… fix/2429-1

# Conflicts:
#	src/common/hooks/useRateInfoParams.ts
#	src/common/pure/CurrencyAmountPreview/index.tsx
#	src/common/pure/RateInfo/index.tsx
#	src/modules/limitOrders/containers/LimitOrdersConfirmModal/index.tsx
#	src/modules/limitOrders/pure/LimitOrdersConfirm/index.cosmos.tsx
#	src/modules/limitOrders/pure/LimitOrdersConfirm/index.tsx
#	src/modules/limitOrders/utils/buildPriceFromCurrencyAmounts.ts
@vercel
Copy link

vercel bot commented May 29, 2023

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

Name Status Preview Comments Updated (UTC)
swap-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback

🌃 Cosmos ↗︎

@shoom3301 shoom3301 changed the title Fix/2429 1 refactor: extract TradeConfirmation component from LimitOrdersConfirmModal May 29, 2023
@shoom3301 shoom3301 requested a review from a team May 29, 2023 13:11
@shoom3301 shoom3301 self-assigned this May 29, 2023

import { CurrencyLogo } from 'common/pure/CurrencyLogo'
import { TokenSymbol } from 'common/pure/TokenSymbol'

import * as styledEl from './styled'

export interface CurrencySelectButtonProps {
currency?: Currency
currency?: Nullish<Currency>
Copy link
Contributor

Choose a reason for hiding this comment

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

do you still need the question-mark in the prop?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. Optional !== undefined

Copy link
Contributor

Choose a reason for hiding this comment

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

fine with me, different is subtle, the point is if we want to make it optional.

Currency is even in the name of the component, and the 2 uses provide the prop

currency={disabled ? undefined : currency || undefined}

<CurrencySelectButton readonlyMode={true} loading={false} currency={token} />

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Aaaah, got your point. Will refactor it in the next PR.
Thank you!

Copy link
Contributor

@anxolin anxolin left a comment

Choose a reason for hiding this comment

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

Great changes! just reviewed the code, i didn't test the app itself

Copy link
Contributor

@nenadV91 nenadV91 left a comment

Choose a reason for hiding this comment

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

LGTM

@shoom3301 shoom3301 merged commit 5711042 into develop May 30, 2023
@github-actions github-actions bot locked and limited conversation to collaborators May 30, 2023
@alfetopito alfetopito deleted the fix/2429-1 branch May 30, 2023 08:37
@elena-zh
Copy link
Contributor

In this PR (or maybe some earlier) it is impossible to create a limit order with a native token in the To field
image

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

Successfully merging this pull request may close these issues.

Create a generic component TradeConfirmationModal (to replace LimitOrdersConfirmModal)
4 participants