-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10148 from hicommonwealth/malik.9887.launchpad-un…
…iswap-widget Added uniswap trade widget
- Loading branch information
Showing
38 changed files
with
3,739 additions
and
646 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...dals/TradeTokenModel/TradeTokenModal.scss → ...el/CommonTradeModal/CommonTradeModal.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...nwealth/client/scripts/views/modals/TradeTokenModel/CommonTradeModal/CommonTradeModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { SupportedCurrencies } from 'helpers/currency'; | ||
import useBeforeUnload from 'hooks/useBeforeUnload'; | ||
import React from 'react'; | ||
import { CWText } from '../../../components/component_kit/cw_text'; | ||
import { | ||
CWModal, | ||
CWModalBody, | ||
CWModalFooter, | ||
CWModalHeader, | ||
} from '../../../components/component_kit/new_designs/CWModal'; | ||
import TokenIcon from '../TokenIcon'; | ||
import { TradeTokenModalProps } from '../types'; | ||
import './CommonTradeModal.scss'; | ||
import TradeTokenForm, { | ||
useCommonTradeTokenForm, | ||
} from './CommonTradeTokenForm'; | ||
|
||
const TRADING_CURRENCY = SupportedCurrencies.USD; // make configurable when needed | ||
|
||
const CommonTradeModal = ({ | ||
isOpen, | ||
onModalClose, | ||
tradeConfig, | ||
}: TradeTokenModalProps) => { | ||
const { trading, addresses, isActionPending, onCTAClick } = | ||
useCommonTradeTokenForm({ | ||
tradeConfig: { | ||
...tradeConfig, | ||
currency: TRADING_CURRENCY, | ||
buyTokenPresetAmounts: [100, 300, 1000], | ||
sellTokenPresetAmounts: ['Max'], | ||
}, | ||
addressType: tradeConfig.addressType, | ||
onTradeComplete: () => onModalClose?.(), | ||
}); | ||
|
||
useBeforeUnload(isActionPending); | ||
|
||
return ( | ||
<CWModal | ||
open={isOpen} | ||
onClose={() => !isActionPending && onModalClose?.()} | ||
size="medium" | ||
className="CommonTradeModal" | ||
content={ | ||
<> | ||
<CWModalHeader | ||
label={ | ||
<CWText type="h4" className="token-info"> | ||
Trade Token - {tradeConfig.token.symbol}{' '} | ||
{trading.token.icon_url && ( | ||
<TokenIcon size="large" url={trading.token.icon_url} /> | ||
)} | ||
</CWText> | ||
} | ||
onModalClose={() => !isActionPending && onModalClose?.()} | ||
/> | ||
<CWModalBody> | ||
<TradeTokenForm | ||
trading={trading} | ||
addresses={addresses} | ||
onCTAClick={onCTAClick} | ||
isActionPending={isActionPending} | ||
/> | ||
</CWModalBody> | ||
<CWModalFooter> | ||
<></> | ||
</CWModalFooter> | ||
</> | ||
} | ||
/> | ||
); | ||
}; | ||
|
||
export default CommonTradeModal; |
2 changes: 1 addition & 1 deletion
2
...enForm/AddressBalance/AddressBalance.scss → ...enForm/AddressBalance/AddressBalance.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...rm/AmountSelections/AmountSelections.scss → ...rm/AmountSelections/AmountSelections.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
10 changes: 8 additions & 2 deletions
10
...nModel/TradeTokenForm/TradeTokenForm.scss → ...nTradeTokenForm/CommonTradeTokenForm.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.