mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 17:33:23 +01:00
Reapply view quote screen designs (#9905)
This commit is contained in:
parent
f75c3c6f68
commit
da5e5cd8b6
@ -1605,6 +1605,9 @@
|
||||
"message": "You need $1 more $2 to complete this swap",
|
||||
"description": "Tells the user how many more of a given token they need for a specific swap. $1 is an amount of tokens and $2 is the token symbol."
|
||||
},
|
||||
"swapBetterQuoteAvailable": {
|
||||
"message": "A better quote is available"
|
||||
},
|
||||
"swapBuildQuotePlaceHolderText": {
|
||||
"message": "No tokens available matching $1",
|
||||
"description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text"
|
||||
@ -1701,8 +1704,8 @@
|
||||
"message": "We find the best price from the top liquidity sources, every time. A fee of $1% is automatically factored into each quote, which supports ongoing development to make MetaMask even better.",
|
||||
"description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number."
|
||||
},
|
||||
"swapNQuotesAvailable": {
|
||||
"message": "$1 quotes available",
|
||||
"swapNQuotes": {
|
||||
"message": "$1 quotes",
|
||||
"description": "$1 is the number of quotes that the user can select from when opening the list of quotes on the 'view quote' screen"
|
||||
},
|
||||
"swapNetworkFeeSummary": {
|
||||
@ -1830,6 +1833,9 @@
|
||||
"swapUnknown": {
|
||||
"message": "Unknown"
|
||||
},
|
||||
"swapUsingBestQuote": {
|
||||
"message": "Using the best quote"
|
||||
},
|
||||
"swapVerifyTokenExplanation": {
|
||||
"message": "Multiple tokens can use the same name and symbol. Check Etherscan to verify this is the token you're looking for."
|
||||
},
|
||||
@ -1846,13 +1852,6 @@
|
||||
"swapsAdvancedOptions": {
|
||||
"message": "Advanced Options"
|
||||
},
|
||||
"swapsBestQuote": {
|
||||
"message": "Best quote"
|
||||
},
|
||||
"swapsConvertToAbout": {
|
||||
"message": "Convert $1 to about",
|
||||
"description": "This message is part of a quote for a swap. The $1 is the amount being converted, and the amount it is being swapped for is below this message"
|
||||
},
|
||||
"swapsExcessiveSlippageWarning": {
|
||||
"message": "Slippage amount is too high and will result in a bad rate. Please reduce your slippage tolerance to a value below 15%."
|
||||
},
|
||||
|
3
app/images/down-arrow-grey.svg
Normal file
3
app/images/down-arrow-grey.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg width="12" height="16" viewBox="0 0 12 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M6.00163 15.2045C6.21347 15.1962 6.45833 15.109 6.61275 14.9637L11.6498 10.2232C11.9385 9.90194 12.0577 9.28597 11.7239 8.92693C11.3952 8.57328 10.7576 8.5838 10.4276 8.93611L6.89052 12.2693L6.89052 1.87164C6.89052 1.38076 6.49254 0.982788 6.00163 0.982788C5.51071 0.982788 5.11274 1.38076 5.11274 1.87164L5.11274 12.2693L1.57565 8.93611C1.27181 8.63281 0.611843 8.57675 0.279352 8.92693C-0.0531095 9.27702 0.0531145 9.91513 0.353459 10.2232L5.3905 14.9637C5.56288 15.126 5.76513 15.205 6.00163 15.2045Z" fill="#D6D9DC"/>
|
||||
</svg>
|
After Width: | Height: | Size: 636 B |
@ -20,9 +20,9 @@
|
||||
border-radius: 50%;
|
||||
background: #bbc0c5;
|
||||
flex: 0 1 auto;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
padding-top: 2px;
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,13 @@ import PropTypes from 'prop-types'
|
||||
import classnames from 'classnames'
|
||||
import IconWithFallback from '../icon-with-fallback'
|
||||
|
||||
export default function UrlIcon({ url, className, name }) {
|
||||
export default function UrlIcon({ url, className, name, fallbackClassName }) {
|
||||
return (
|
||||
<IconWithFallback
|
||||
className={classnames('url-icon', className)}
|
||||
icon={url}
|
||||
name={name}
|
||||
fallbackClassName="url-icon__fallback"
|
||||
fallbackClassName={classnames('url-icon__fallback', fallbackClassName)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@ -18,4 +18,5 @@ UrlIcon.propTypes = {
|
||||
url: PropTypes.string,
|
||||
className: PropTypes.string,
|
||||
name: PropTypes.string,
|
||||
fallbackClassName: PropTypes.string,
|
||||
}
|
||||
|
@ -418,6 +418,7 @@ export default function BuildQuote({
|
||||
Number(maxSlippage) > MAX_ALLOWED_SLIPPAGE
|
||||
}
|
||||
hideCancel
|
||||
showTermsOfService
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
|
||||
import BigNumber from 'bignumber.js'
|
||||
import classnames from 'classnames'
|
||||
import { calcTokenAmount } from '../../../helpers/utils/token-util'
|
||||
import { toPrecisionWithoutTrailingZeros } from '../../../helpers/utils/util'
|
||||
import { formatSwapsValueForDisplay } from '../swaps.util'
|
||||
|
||||
export default function ExchangeRateDisplay({
|
||||
primaryTokenValue,
|
||||
@ -13,6 +13,7 @@ export default function ExchangeRateDisplay({
|
||||
secondaryTokenDecimals = 18,
|
||||
secondaryTokenSymbol,
|
||||
arrowColor = 'black',
|
||||
boldSymbols = true,
|
||||
className,
|
||||
}) {
|
||||
const [showPrimaryToSecondary, setShowPrimaryToSecondary] = useState(true)
|
||||
@ -57,16 +58,24 @@ export default function ExchangeRateDisplay({
|
||||
} else if (new BigNumber(rate, 10).lt('0.000001', 10)) {
|
||||
rateToDisplay = rate
|
||||
} else {
|
||||
rateToDisplay = toPrecisionWithoutTrailingZeros(rate, 9)
|
||||
rateToDisplay = formatSwapsValueForDisplay(rate)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={classnames('exchange-rate-display', className)}>
|
||||
<span>1</span>
|
||||
<span className="exchange-rate-display__bold">{baseSymbol}</span>
|
||||
<span
|
||||
className={classnames({ 'exchange-rate-display__bold': boldSymbols })}
|
||||
>
|
||||
{baseSymbol}
|
||||
</span>
|
||||
<span>{comparisonSymbol}</span>
|
||||
<span>{rateToDisplay}</span>
|
||||
<span className="exchange-rate-display__bold">{ratiodSymbol}</span>
|
||||
<span
|
||||
className={classnames({ 'exchange-rate-display__bold': boldSymbols })}
|
||||
>
|
||||
{ratiodSymbol}
|
||||
</span>
|
||||
<div
|
||||
className={classnames('exchange-rate-display__switch-arrows', {
|
||||
'exchange-rate-display__switch-arrows-rotate': rotating,
|
||||
@ -115,4 +124,5 @@ ExchangeRateDisplay.propTypes = {
|
||||
secondaryTokenSymbol: PropTypes.string.isRequired,
|
||||
className: PropTypes.string,
|
||||
arrowColor: PropTypes.string,
|
||||
boldSymbols: PropTypes.bool,
|
||||
}
|
||||
|
@ -11,11 +11,41 @@ export default function FeeCard({
|
||||
tokenApprovalTextComponent,
|
||||
tokenApprovalSourceTokenSymbol,
|
||||
onTokenApprovalClick,
|
||||
metaMaskFee,
|
||||
isBestQuote,
|
||||
numberOfQuotes,
|
||||
onQuotesClick,
|
||||
tokenConversionRate,
|
||||
}) {
|
||||
const t = useContext(I18nContext)
|
||||
|
||||
let bestQuoteText = ''
|
||||
if (isBestQuote && tokenConversionRate) {
|
||||
bestQuoteText = t('swapUsingBestQuote')
|
||||
} else if (tokenConversionRate) {
|
||||
bestQuoteText = t('swapBetterQuoteAvailable')
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="fee-card">
|
||||
<div className="fee-card__savings-and-quotes-header">
|
||||
<div className="fee-card__savings-and-quotes-row">
|
||||
{bestQuoteText && (
|
||||
<p className="fee-card__savings-text">{bestQuoteText}</p>
|
||||
)}
|
||||
<div
|
||||
className="fee-card__quote-link-container"
|
||||
onClick={onQuotesClick}
|
||||
>
|
||||
<p className="fee-card__quote-link-text">
|
||||
{t('swapNQuotes', [numberOfQuotes])}
|
||||
</p>
|
||||
<div className="fee-card__caret-right">
|
||||
<i className="fa fa-angle-up" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="fee-card__main">
|
||||
<div className="fee-card__row-header">
|
||||
<div>
|
||||
@ -83,26 +113,39 @@ export default function FeeCard({
|
||||
</div>
|
||||
</div>
|
||||
{!hideTokenApprovalRow && (
|
||||
<div className="fee-card__top-bordered-row">
|
||||
<div className="fee-card__row-header">
|
||||
<div className="fee-card__row-label">
|
||||
<div className="fee-card__row-header-text">
|
||||
{t('swapThisWillAllowApprove', [tokenApprovalTextComponent])}
|
||||
</div>
|
||||
<div
|
||||
className="fee-card__link"
|
||||
onClick={() => onTokenApprovalClick()}
|
||||
>
|
||||
{t('swapEditLimit')}
|
||||
</div>
|
||||
<InfoTooltip
|
||||
position="top"
|
||||
contentText={t('swapEnableDescription', [
|
||||
tokenApprovalSourceTokenSymbol,
|
||||
])}
|
||||
containerClassName="fee-card__info-tooltip-container"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className="fee-card__link"
|
||||
onClick={() => onTokenApprovalClick()}
|
||||
>
|
||||
{t('swapEditLimit')}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div className="fee-card__top-bordered-row">
|
||||
<div className="fee-card__row-label">
|
||||
<div className="fee-card__row-header-text">
|
||||
{t('swapQuoteIncludesRate', [metaMaskFee])}
|
||||
</div>
|
||||
<InfoTooltip
|
||||
position="top"
|
||||
contentText={t('swapMetaMaskFeeDescription', [metaMaskFee])}
|
||||
wrapperClassName="fee-card__info-tooltip-container"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@ -122,4 +165,9 @@ FeeCard.propTypes = {
|
||||
tokenApprovalTextComponent: PropTypes.node,
|
||||
tokenApprovalSourceTokenSymbol: PropTypes.string,
|
||||
onTokenApprovalClick: PropTypes.func,
|
||||
metaMaskFee: PropTypes.string.isRequired,
|
||||
isBestQuote: PropTypes.bool,
|
||||
onQuotesClick: PropTypes.func.isRequired,
|
||||
numberOfQuotes: PropTypes.number.isRequired,
|
||||
tokenConversionRate: PropTypes.number,
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react'
|
||||
import { action } from '@storybook/addon-actions'
|
||||
import { text } from '@storybook/addon-knobs'
|
||||
import { text, boolean, number, object } from '@storybook/addon-knobs'
|
||||
import FeeCard from './fee-card'
|
||||
|
||||
const tokenApprovalTextComponent = (
|
||||
@ -35,6 +35,13 @@ export const WithAllProps = () => {
|
||||
tokenApprovalSourceTokenSymbol="ABC"
|
||||
onTokenApprovalClick={action('Clicked third row link')}
|
||||
hideTokenApprovalRow={false}
|
||||
metaMaskFee="0.875"
|
||||
savings={object('savings 1', { total: '8.55' })}
|
||||
onQuotesClick={action('Clicked quotes link')}
|
||||
numberOfQuotes={number('numberOfQuotes', 6)}
|
||||
isBestQuote={boolean('isBestQuote', true)}
|
||||
conversionRate={300}
|
||||
currentCurrency="usd"
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
@ -55,6 +62,11 @@ export const WithoutThirdRow = () => {
|
||||
}}
|
||||
onFeeCardMaxRowClick={action('Clicked max fee row link')}
|
||||
hideTokenApprovalRow
|
||||
onQuotesClick={action('Clicked quotes link')}
|
||||
numberOfQuotes={number('numberOfQuotes', 1)}
|
||||
isBestQuote={boolean('isBestQuote', true)}
|
||||
savings={object('savings 1', { total: '8.55' })}
|
||||
metaMaskFee="0.875"
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
@ -70,6 +82,9 @@ export const WithOnlyRequiredProps = () => {
|
||||
}}
|
||||
onFeeCardMaxRowClick={action('Clicked max fee row link')}
|
||||
hideTokenApprovalRow
|
||||
metaMaskFee="0.875"
|
||||
onQuotesClick={action('Clicked quotes link')}
|
||||
numberOfQuotes={2}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
@ -1,11 +1,69 @@
|
||||
.fee-card {
|
||||
border-radius: 8px;
|
||||
border: 1px solid $Grey-100;
|
||||
width: 100%;
|
||||
|
||||
@include H7;
|
||||
|
||||
&__savings-and-quotes-header {
|
||||
display: flex;
|
||||
position: relative;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
&__savings-and-quotes-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
left: 58px;
|
||||
height: 39px;
|
||||
background: $Blue-000;
|
||||
border: 1px solid $Blue-500;
|
||||
border-top-right-radius: 8px;
|
||||
border-top-left-radius: 8px;
|
||||
border-bottom: 0;
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
&__savings-text {
|
||||
@include H6;
|
||||
|
||||
font-weight: bold;
|
||||
color: $Blue-500;
|
||||
}
|
||||
|
||||
&__quote-link-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&__quote-link-text {
|
||||
@include H7;
|
||||
|
||||
color: $Blue-500;
|
||||
}
|
||||
|
||||
&__caret-right {
|
||||
color: $Blue-500;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-left: 6px;
|
||||
|
||||
i {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
}
|
||||
|
||||
&__main {
|
||||
border: 1px solid $Blue-500;
|
||||
border-bottom-left-radius: 8px;
|
||||
border-bottom-right-radius: 8px;
|
||||
width: 100%;
|
||||
max-width: 311px;
|
||||
padding: 16px 16px 12px 16px;
|
||||
}
|
||||
|
||||
@ -31,6 +89,10 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&__row-header-text--bold {
|
||||
color: $Black-100;
|
||||
}
|
||||
|
||||
&__row,
|
||||
&__top-bordered-row {
|
||||
display: flex;
|
||||
@ -51,7 +113,6 @@
|
||||
img {
|
||||
height: 10px;
|
||||
width: 10px;
|
||||
margin-left: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
@ -60,7 +121,12 @@
|
||||
height: 10px;
|
||||
width: 10px;
|
||||
justify-content: center;
|
||||
margin-top: 2px;
|
||||
|
||||
div {
|
||||
// Needed to override the style property added by the react-tippy library
|
||||
display: flex !important;
|
||||
height: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
&__info-tooltip-paragraph {
|
||||
@ -111,11 +177,14 @@
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
&__row-header-primary,
|
||||
&__row-header-primary--bold {
|
||||
&__row-header-primary {
|
||||
color: $Grey-500;
|
||||
}
|
||||
|
||||
&__row-header-primary--bold {
|
||||
color: $Black-100;
|
||||
}
|
||||
|
||||
&__row-header-text--bold,
|
||||
&__row-header-secondary--bold,
|
||||
&__row-header-primary--bold {
|
||||
@ -125,6 +194,11 @@
|
||||
&__bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
&__tilde {
|
||||
font-family: Roboto, Helvetica, Arial, sans-serif;
|
||||
margin-right: -3.5px;
|
||||
}
|
||||
}
|
||||
|
||||
.info-tooltip {
|
||||
|
54
ui/app/pages/swaps/fee-card/pig-icon.js
Normal file
54
ui/app/pages/swaps/fee-card/pig-icon.js
Normal file
@ -0,0 +1,54 @@
|
||||
import React from 'react'
|
||||
|
||||
export default function PigIcon() {
|
||||
return (
|
||||
<svg
|
||||
width="31"
|
||||
height="44"
|
||||
viewBox="0 0 31 44"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M1.86541 24.7218L1.79469 24.7925C1.02602 25.5611 0.602468 26.5834 0.602936 27.6702L1.86541 24.7218ZM1.86541 24.7218L1.93612 24.7925M1.86541 24.7218L1.93612 24.7925M1.93612 24.7925L2.34305 25.1994L2.74999 25.6063L2.82067 25.677M1.93612 24.7925L2.82067 25.677M2.82067 25.677L2.75002 25.7477M2.82067 25.677L2.75002 25.7477M2.75002 25.7477C2.23672 26.2615 1.95374 26.944 1.95374 27.6702C1.95374 28.3964 2.23672 29.0789 2.75002 29.5927L2.67928 29.6633L2.74995 29.5926C3.16102 30.0032 3.67296 30.2457 4.20842 30.3365M2.75002 25.7477L4.20842 30.3365M4.20842 30.3365V29.3801C4.20842 28.7473 4.29699 28.1236 4.44701 27.5174C5.26558 24.2082 8.15856 21.4247 11.5089 21.0552L11.5089 21.0551L11.5122 21.0549L11.5232 21.054C11.5234 21.054 11.5236 21.054 11.5238 21.054C14.4515 20.7946 17.4246 20.7241 20.3655 20.8456L20.3662 20.8456C20.4027 20.8474 20.4448 20.8518 20.4826 20.8558C20.4848 20.856 20.487 20.8562 20.4891 20.8564C21.3008 19.8016 22.4769 19.1281 23.7918 19.1281H24.3672H24.4672V19.2281V22.4872C25.6604 23.4555 26.6321 24.7942 27.2053 26.3565C27.6693 26.3858 28.1337 26.418 28.5993 26.4518L28.6 26.4519C29.8669 26.5531 30.8947 27.6691 30.8947 28.9423V33.532C30.8947 34.8021 29.8707 35.9275 28.6044 36.0438L28.6037 36.0439C28.0461 36.0912 27.4876 36.1351 26.9282 36.1755C26.2881 37.557 25.3323 38.7259 24.2059 39.5696V40.9581C24.2059 42.0522 23.3155 42.9421 22.2215 42.9421H21.2956C20.2321 42.9421 19.3615 42.1011 19.3137 41.0491C18.732 41.0644 18.149 41.0745 17.5651 41.0745C16.1032 41.0745 14.6374 41.0272 13.1767 40.9337V40.9581C13.1767 42.0522 12.2863 42.9421 11.1922 42.9421H10.2664C9.17234 42.9421 8.28244 42.0522 8.28244 40.9581V39.6399C5.89461 38.1267 4.20795 35.3776 4.20842 32.4825V31.7103C3.32631 31.6097 2.47056 31.2229 1.79516 30.5475C1.02648 29.7792 0.602947 28.757 0.602936 27.6702L4.20842 30.3365ZM11.5108 40.8072L11.5108 40.8072L11.5084 40.8069C10.8614 40.7357 10.2331 40.5697 9.63278 40.3321V40.9581C9.63278 41.307 9.91701 41.5913 10.2659 41.5913H11.1918C11.5412 41.5913 11.8254 41.307 11.8254 40.9581V40.8312C11.7948 40.8289 11.7636 40.8266 11.7324 40.8243C11.6578 40.8189 11.5824 40.8133 11.5108 40.8072ZM26.0661 27.2019C25.7283 26.1136 25.1685 25.1424 24.4672 24.3492V25.3928V25.4928H24.3672H23.2164H23.1164V25.3928V20.5711C21.7447 20.9526 20.6961 22.4798 20.6961 24.3256C20.6961 24.6853 20.7363 25.0339 20.8135 25.3705L20.8416 25.4928H20.716H19.5442H19.4607L19.4458 25.4107C19.3819 25.0577 19.3458 24.6961 19.3458 24.3256C19.3458 23.5585 19.4925 22.8324 19.7487 22.1769C19.0205 22.1527 18.291 22.138 17.5604 22.138C15.5864 22.138 13.6074 22.2251 11.6502 22.3983C10.0333 22.5788 8.51004 23.482 7.38991 24.765C6.26962 26.0482 5.55899 27.704 5.55923 29.3796V32.4825V32.5581C5.58001 34.2087 6.28668 35.835 7.38969 37.0991C8.5094 38.3822 10.031 39.2847 11.6432 39.4628C14.5132 39.7172 17.428 39.7865 20.3054 39.6673C22.5772 39.5684 24.8105 37.8103 25.8469 35.2745L25.8469 35.2744L25.9827 34.9431L26.0063 34.8856L26.0684 34.8813L26.4258 34.8565L26.4258 34.8565C27.1144 34.809 27.8016 34.7558 28.4842 34.698C29.0557 34.6452 29.5434 34.1087 29.5434 33.5316V28.9419C29.5434 28.3691 29.0595 27.8434 28.4958 27.7984C27.8886 27.7541 27.2797 27.713 26.6703 27.6762L26.6702 27.6762L26.2735 27.6519L26.2046 27.6477L26.1842 27.5818L26.0661 27.2019L26.0661 27.2019ZM22.8546 40.9581V40.3811C22.1527 40.7107 21.4138 40.9209 20.6629 40.9915C20.6803 41.325 20.9574 41.5913 21.2952 41.5913H22.221C22.5705 41.5913 22.8546 41.307 22.8546 40.9581Z"
|
||||
fill="#037DD6"
|
||||
stroke="#037DD6"
|
||||
strokeWidth="0.2"
|
||||
/>
|
||||
<path
|
||||
d="M15.4018 19.837C12.3221 19.837 9.81661 17.332 9.81661 14.2523C9.81661 11.1726 12.3217 8.66703 15.4018 8.66703C18.4811 8.66703 20.9866 11.1721 20.9866 14.2523C20.9866 17.3315 18.4816 19.837 15.4018 19.837ZM15.4018 10.0174C13.0673 10.0174 11.1674 11.9172 11.1674 14.2518C11.1674 16.5864 13.0673 18.4862 15.4018 18.4862C17.7364 18.4862 19.6358 16.5868 19.6358 14.2518C19.6358 11.9172 17.7369 10.0174 15.4018 10.0174Z"
|
||||
fill="#037DD6"
|
||||
stroke="#037DD6"
|
||||
strokeWidth="0.2"
|
||||
/>
|
||||
<path
|
||||
d="M15.4022 17.8575C13.4136 17.8575 11.7957 16.24 11.7957 14.2514C11.7957 12.2627 13.4136 10.6453 15.4022 10.6453C17.3909 10.6453 19.0083 12.2632 19.0083 14.2514C19.0083 16.2395 17.3909 17.8575 15.4022 17.8575ZM15.4022 11.9961C14.1583 11.9961 13.1465 13.0079 13.1465 14.2519C13.1465 15.4958 14.1582 16.5071 15.4022 16.5071C16.6458 16.5071 17.6575 15.4954 17.6575 14.2519C17.6575 13.0083 16.6457 11.9961 15.4022 11.9961Z"
|
||||
fill="#037DD6"
|
||||
stroke="#037DD6"
|
||||
strokeWidth="0.2"
|
||||
/>
|
||||
<path
|
||||
d="M14.6099 0.842163V0.742163H14.7099H15.8607H15.9607V0.842163V7.35593V7.45593H15.8607H14.7099H14.6099V7.35593V0.842163Z"
|
||||
fill="#037DD6"
|
||||
stroke="#037DD6"
|
||||
strokeWidth="0.2"
|
||||
/>
|
||||
<path
|
||||
d="M17.2175 4.59747V4.49747H17.3175H18.4683H18.5683V4.59747V8.34996V8.44996H18.4683H17.3175H17.2175V8.34996V4.59747Z"
|
||||
fill="#037DD6"
|
||||
stroke="#037DD6"
|
||||
strokeWidth="0.2"
|
||||
/>
|
||||
<path
|
||||
d="M24.4364 28.7993L24.4362 28.7993C24.3635 28.7716 24.2949 28.7581 24.2283 28.7581C23.9048 28.7581 23.6419 29.0179 23.6368 29.3397L23.6378 29.3474L23.6397 29.3614C23.6411 29.372 23.6431 29.3873 23.6447 29.4046L23.6448 29.4054C23.6735 29.7092 23.925 29.9417 24.2283 29.9417C24.5551 29.9417 24.8198 29.6769 24.8198 29.3501C24.8198 29.1005 24.6631 28.8854 24.4364 28.7993ZM23.6367 29.3501C23.6367 29.35 23.6367 29.3499 23.6367 29.3497V29.3501Z"
|
||||
fill="#037DD6"
|
||||
stroke="#037DD6"
|
||||
/>
|
||||
<path
|
||||
d="M17.967 23.5994H12.8346C12.61 23.5994 12.4253 23.7836 12.4251 24.0094V24.1723C12.4251 24.3974 12.6091 24.5814 12.8342 24.5814H17.967C18.1924 24.5814 18.3766 24.397 18.3766 24.1723V24.009C18.3766 23.7836 18.1923 23.5994 17.967 23.5994Z"
|
||||
fill="#037DD6"
|
||||
stroke="#037DD6"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
@ -71,7 +71,7 @@
|
||||
|
||||
font-weight: bold;
|
||||
color: $Black-100;
|
||||
margin-top: 3px;
|
||||
margin-top: -5px;
|
||||
}
|
||||
|
||||
&__header {
|
||||
|
@ -1,28 +1,75 @@
|
||||
.main-quote-summary {
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
height: 196px;
|
||||
max-height: 196px;
|
||||
min-height: 196px;
|
||||
width: 100%;
|
||||
color: $white;
|
||||
color: $Black-100;
|
||||
|
||||
&__quote-backdrop-with-top-tab,
|
||||
&__quote-backdrop {
|
||||
position: absolute;
|
||||
box-shadow: 0 10px 39px rgba(3, 125, 214, 0.15);
|
||||
border-radius: 8px;
|
||||
background: #fafcff;
|
||||
&__source-row,
|
||||
&__destination-row {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
|
||||
@include H6;
|
||||
|
||||
color: $Grey-500;
|
||||
}
|
||||
|
||||
&__quote-backdrop-with-top-tab {
|
||||
width: 348px;
|
||||
height: 215px;
|
||||
&__source-row {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
&__quote-backdrop {
|
||||
width: 310px;
|
||||
height: 164px;
|
||||
&__source-row-value,
|
||||
&__source-row-symbol {
|
||||
// Each of these spans can be half their container width minus the space
|
||||
// needed for the token icon and the span margins
|
||||
max-width: calc(50% - 13px);
|
||||
}
|
||||
|
||||
|
||||
&__source-row-value {
|
||||
margin-right: 5px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
&__source-row-symbol {
|
||||
margin-left: 5px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
&__destination-row {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
&__destination-row-symbol {
|
||||
margin-left: 5px;
|
||||
color: $Black-100;
|
||||
}
|
||||
|
||||
&__icon,
|
||||
&__icon-fallback {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
&__icon-fallback {
|
||||
padding-top: 0;
|
||||
font-size: 12px;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
&__down-arrow {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
&__details {
|
||||
@ -33,62 +80,24 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&__best-quote {
|
||||
@include H7;
|
||||
|
||||
font-weight: bold;
|
||||
position: relative;
|
||||
display: flex;
|
||||
padding-top: 6px;
|
||||
letter-spacing: 0.12px;
|
||||
min-height: 16px;
|
||||
|
||||
> span {
|
||||
margin-left: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
&__quote-details-top {
|
||||
height: 94px;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
padding-top: 2px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
&__bold {
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
&__quote-small-white {
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
margin-bottom: 8px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
&__quote-large {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
align-items: flex-start;
|
||||
margin-top: 8px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
&__quote-large-number {
|
||||
font-size: 40px;
|
||||
line-height: 32px;
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
&__quote-large-symbol {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
font-size: 32px;
|
||||
line-height: 32px;
|
||||
font-size: 60px;
|
||||
line-height: 48px;
|
||||
}
|
||||
|
||||
&__quote-large-white {
|
||||
@ -104,7 +113,10 @@
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 287px;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.2);
|
||||
height: 42px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
&__exchange-rate-display {
|
||||
color: $Grey-500;
|
||||
}
|
||||
}
|
||||
|
@ -1,62 +1,33 @@
|
||||
import React, { useContext } from 'react'
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import BigNumber from 'bignumber.js'
|
||||
import classnames from 'classnames'
|
||||
import { I18nContext } from '../../../contexts/i18n'
|
||||
import { calcTokenAmount } from '../../../helpers/utils/token-util'
|
||||
import { toPrecisionWithoutTrailingZeros } from '../../../helpers/utils/util'
|
||||
import Tooltip from '../../../components/ui/tooltip'
|
||||
import SunCheckIcon from '../../../components/ui/icon/sun-check-icon.component'
|
||||
import UrlIcon from '../../../components/ui/url-icon'
|
||||
import ExchangeRateDisplay from '../exchange-rate-display'
|
||||
import { formatSwapsValueForDisplay } from '../swaps.util'
|
||||
import QuoteBackdrop from './quote-backdrop'
|
||||
|
||||
function getFontSizes(fontSizeScore) {
|
||||
if (fontSizeScore <= 11) {
|
||||
function getFontSizesAndLineHeights(fontSizeScore) {
|
||||
if (fontSizeScore <= 9) {
|
||||
return [60, 48]
|
||||
}
|
||||
if (fontSizeScore <= 13) {
|
||||
return [40, 32]
|
||||
}
|
||||
if (fontSizeScore <= 16) {
|
||||
return [30, 24]
|
||||
}
|
||||
return [24, 14]
|
||||
}
|
||||
|
||||
function getLineHeight(fontSizeScore) {
|
||||
if (fontSizeScore <= 11) {
|
||||
return 32
|
||||
}
|
||||
if (fontSizeScore <= 16) {
|
||||
return 26
|
||||
}
|
||||
return 18
|
||||
}
|
||||
|
||||
// Returns a numerical value based on the length of the two passed strings: amount and symbol.
|
||||
// The returned value equals the number of digits in the amount string plus a value calculated
|
||||
// from the length of the symbol string. The returned number will be passed to the getFontSizes function
|
||||
// to determine the font size to apply to the amount and symbol strings when rendered. The
|
||||
// desired maximum digits and letters to show in the ultimately rendered string is 20, and in
|
||||
// such cases there can also be ellipsis shown and a decimal, combinding for a rendered "string"
|
||||
// length of ~22. As the symbol will always have a smaller font size than the amount, the
|
||||
// additive value of the symbol length to the font size score is corrected based on the total
|
||||
// number of alphanumeric characters in both strings and the desired rendered length of 22.
|
||||
function getFontSizeScore(amount, symbol) {
|
||||
const amountLength = amount.match(/\d+/gu).join('').length
|
||||
const symbolModifier = Math.min((amountLength + symbol.length) / 22, 1)
|
||||
return amountLength + symbol.length * symbolModifier
|
||||
return [26, 15]
|
||||
}
|
||||
|
||||
export default function MainQuoteSummary({
|
||||
isBestQuote,
|
||||
sourceValue,
|
||||
sourceSymbol,
|
||||
sourceDecimals,
|
||||
sourceIconUrl,
|
||||
destinationValue,
|
||||
destinationSymbol,
|
||||
destinationDecimals,
|
||||
destinationIconUrl,
|
||||
}) {
|
||||
const t = useContext(I18nContext)
|
||||
|
||||
const sourceAmount = toPrecisionWithoutTrailingZeros(
|
||||
calcTokenAmount(sourceValue, sourceDecimals).toString(10),
|
||||
12,
|
||||
@ -67,43 +38,55 @@ export default function MainQuoteSummary({
|
||||
)
|
||||
|
||||
const amountToDisplay = formatSwapsValueForDisplay(destinationAmount)
|
||||
const fontSizeScore = getFontSizeScore(amountToDisplay, destinationSymbol)
|
||||
const [numberFontSize, symbolFontSize] = getFontSizes(fontSizeScore)
|
||||
const lineHeight = getLineHeight(fontSizeScore)
|
||||
|
||||
const amountDigitLength = amountToDisplay.match(/\d+/gu).join('').length
|
||||
const [numberFontSize, lineHeight] = getFontSizesAndLineHeights(
|
||||
amountDigitLength,
|
||||
)
|
||||
let ellipsedAmountToDisplay = amountToDisplay
|
||||
if (fontSizeScore > 20) {
|
||||
ellipsedAmountToDisplay = `${amountToDisplay.slice(
|
||||
0,
|
||||
amountToDisplay.length - (fontSizeScore - 20),
|
||||
)}...`
|
||||
|
||||
if (amountDigitLength > 20) {
|
||||
ellipsedAmountToDisplay = `${amountToDisplay.slice(0, 20)}...`
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="main-quote-summary">
|
||||
<div
|
||||
className={classnames('main-quote-summary__quote-backdrop', {
|
||||
'main-quote-summary__quote-backdrop-with-top-tab': isBestQuote,
|
||||
})}
|
||||
>
|
||||
<QuoteBackdrop withTopTab={isBestQuote} />
|
||||
</div>
|
||||
<div className="main-quote-summary__best-quote">
|
||||
{isBestQuote && <SunCheckIcon />}
|
||||
<span>{isBestQuote && t('swapsBestQuote')}</span>
|
||||
</div>
|
||||
<div className="main-quote-summary__details">
|
||||
<div className="main-quote-summary__quote-details-top">
|
||||
<span className="main-quote-summary__quote-small-white">
|
||||
{t('swapsConvertToAbout', [
|
||||
<span
|
||||
className="main-quote-summary__bold"
|
||||
key="main-quote-summary-bold-1"
|
||||
>
|
||||
{`${sourceAmount} ${sourceSymbol}`}
|
||||
</span>,
|
||||
])}
|
||||
</span>
|
||||
<div className="main-quote-summary__source-row">
|
||||
<span
|
||||
className="main-quote-summary__source-row-value"
|
||||
title={formatSwapsValueForDisplay(sourceAmount)}
|
||||
>
|
||||
{formatSwapsValueForDisplay(sourceAmount)}
|
||||
</span>
|
||||
<UrlIcon
|
||||
url={sourceIconUrl}
|
||||
className="main-quote-summary__icon"
|
||||
name={sourceSymbol}
|
||||
fallbackClassName="main-quote-summary__icon-fallback"
|
||||
/>
|
||||
<span
|
||||
className="main-quote-summary__source-row-symbol"
|
||||
title={sourceSymbol}
|
||||
>
|
||||
{sourceSymbol}
|
||||
</span>
|
||||
</div>
|
||||
<img
|
||||
className="main-quote-summary__down-arrow"
|
||||
src="images/down-arrow-grey.svg"
|
||||
/>
|
||||
<div className="main-quote-summary__destination-row">
|
||||
<UrlIcon
|
||||
url={destinationIconUrl}
|
||||
className="main-quote-summary__icon"
|
||||
name={destinationSymbol}
|
||||
fallbackClassName="main-quote-summary__icon-fallback"
|
||||
/>
|
||||
<span className="main-quote-summary__destination-row-symbol">
|
||||
{destinationSymbol}
|
||||
</span>
|
||||
</div>
|
||||
<div className="main-quote-summary__quote-large">
|
||||
<Tooltip
|
||||
interactive
|
||||
@ -122,15 +105,6 @@ export default function MainQuoteSummary({
|
||||
{`${ellipsedAmountToDisplay}`}
|
||||
</span>
|
||||
</Tooltip>
|
||||
<span
|
||||
className="main-quote-summary__quote-large-symbol"
|
||||
style={{
|
||||
fontSize: symbolFontSize,
|
||||
lineHeight: `${lineHeight}px`,
|
||||
}}
|
||||
>
|
||||
{`${destinationSymbol}`}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="main-quote-summary__exchange-rate-container">
|
||||
@ -141,8 +115,9 @@ export default function MainQuoteSummary({
|
||||
secondaryTokenValue={destinationValue}
|
||||
secondaryTokenDecimals={destinationDecimals}
|
||||
secondaryTokenSymbol={destinationSymbol}
|
||||
className="exchange-rate-display--white"
|
||||
arrowColor="white"
|
||||
arrowColor="#037DD6"
|
||||
boldSymbols={false}
|
||||
className="main-quote-summary__exchange-rate-display"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -151,7 +126,6 @@ export default function MainQuoteSummary({
|
||||
}
|
||||
|
||||
MainQuoteSummary.propTypes = {
|
||||
isBestQuote: PropTypes.bool,
|
||||
sourceValue: PropTypes.oneOfType([
|
||||
PropTypes.string,
|
||||
PropTypes.instanceOf(BigNumber),
|
||||
@ -167,4 +141,6 @@ MainQuoteSummary.propTypes = {
|
||||
PropTypes.number,
|
||||
]),
|
||||
destinationSymbol: PropTypes.string.isRequired,
|
||||
sourceIconUrl: PropTypes.string,
|
||||
destinationIconUrl: PropTypes.string,
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import { text, number, boolean } from '@storybook/addon-knobs'
|
||||
import { text, number } from '@storybook/addon-knobs'
|
||||
import MainQuoteSummary from './main-quote-summary'
|
||||
|
||||
export default {
|
||||
@ -8,28 +8,24 @@ export default {
|
||||
|
||||
export const BestQuote = () => {
|
||||
return (
|
||||
<MainQuoteSummary
|
||||
sourceValue={text('sourceValue', '2000000000000000000')}
|
||||
sourceDecimals={number('sourceDecimals', 18)}
|
||||
sourceSymbol={text('sourceSymbol', 'ETH')}
|
||||
destinationValue={text('destinationValue', '200000000000000000')}
|
||||
destinationDecimals={number('destinationDecimals', 18)}
|
||||
destinationSymbol={text('destinationSymbol', 'ABC')}
|
||||
isBestQuote={boolean('isBestQuote', true)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export const NotBestQuote = () => {
|
||||
return (
|
||||
<MainQuoteSummary
|
||||
sourceValue={text('sourceValue', '2000000000000000000')}
|
||||
sourceDecimals={number('sourceDecimals', 18)}
|
||||
sourceSymbol={text('sourceSymbol', 'ETH')}
|
||||
destinationValue={text('destinationValue', '200000000000000000')}
|
||||
destinationDecimals={number('destinationDecimals', 18)}
|
||||
destinationSymbol={text('destinationSymbol', 'ABC')}
|
||||
isBestQuote={boolean('isBestQuote', false)}
|
||||
/>
|
||||
<div
|
||||
style={{
|
||||
width: '360px',
|
||||
height: '224px',
|
||||
border: '1px solid black',
|
||||
padding: '24px',
|
||||
}}
|
||||
>
|
||||
<MainQuoteSummary
|
||||
sourceValue={text('sourceValue', '2000000000000000000')}
|
||||
sourceDecimals={number('sourceDecimals', 18)}
|
||||
sourceSymbol={text('sourceSymbol', 'ETH')}
|
||||
destinationValue={text('destinationValue', '200000000000000000')}
|
||||
destinationDecimals={number('destinationDecimals', 18)}
|
||||
destinationSymbol={text('destinationSymbol', 'ABC')}
|
||||
sourceIconUrl=".storybook/images/metamark.svg"
|
||||
destinationIconUrl=".storybook/images/sai.svg"
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
@ -31,7 +31,10 @@ export default function SwapsFooter({
|
||||
onSubmit={onSubmit}
|
||||
submitText={submitText}
|
||||
submitButtonType="confirm"
|
||||
footerClassName="swaps-footer__custom-page-container-footer-class"
|
||||
footerClassName={classnames(
|
||||
'swaps-footer__custom-page-container-footer-class',
|
||||
className,
|
||||
)}
|
||||
footerButtonClassName={classnames(
|
||||
'swaps-footer__custom-page-container-footer-button-class',
|
||||
{
|
||||
|
@ -507,6 +507,7 @@ export function quotesToRenderableData(
|
||||
destinationTokenDecimals: destinationTokenInfo.decimals,
|
||||
destinationTokenSymbol: destinationTokenInfo.symbol,
|
||||
destinationTokenValue: formatSwapsValueForDisplay(destinationValue),
|
||||
destinationIconUrl: destinationTokenInfo.iconUrl,
|
||||
isBestQuote: quote.isBestQuote,
|
||||
liquiditySourceKey,
|
||||
feeInEth,
|
||||
@ -518,6 +519,7 @@ export function quotesToRenderableData(
|
||||
sourceTokenDecimals: sourceTokenInfo.decimals,
|
||||
sourceTokenSymbol: sourceTokenInfo.symbol,
|
||||
sourceTokenValue: sourceValue,
|
||||
sourceTokenIconUrl: sourceTokenInfo.iconUrl,
|
||||
ethValueOfTrade,
|
||||
minimumAmountReceived,
|
||||
metaMaskFee: fee,
|
||||
|
@ -44,13 +44,13 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 46px;
|
||||
}
|
||||
|
||||
&__view-other-button,
|
||||
&__view-other-button-fade {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
position: absolute;
|
||||
|
||||
@include H7;
|
||||
@ -133,6 +133,9 @@
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: intrinsic; /* Safari/WebKit uses a non-standard name */
|
||||
width: max-content;
|
||||
max-width: 340px;
|
||||
margin-top: 8px;
|
||||
|
||||
@media screen and (min-width: 576px) {
|
||||
@ -149,57 +152,29 @@
|
||||
}
|
||||
|
||||
&__countdown-timer-container {
|
||||
@media screen and (max-width: 576px) {
|
||||
margin-top: 12px;
|
||||
margin-bottom: 16px;
|
||||
|
||||
&--thin {
|
||||
margin-top: 8px;
|
||||
margin-bottom: 8px;
|
||||
|
||||
> div {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 576px) {
|
||||
&--thin {
|
||||
margin-top: 6px;
|
||||
}
|
||||
}
|
||||
width: 152px;
|
||||
min-height: 32px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
border-radius: 42px;
|
||||
background: #f2f3f4;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
&__fee-card-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
margin-top: 8px;
|
||||
max-width: 311px;
|
||||
margin-bottom: 8px;
|
||||
|
||||
@media screen and (min-width: 576px) {
|
||||
margin-bottom: 0;
|
||||
|
||||
&--three-rows {
|
||||
margin-bottom: -16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__main-quote-summary-container {
|
||||
margin-top: 24px;
|
||||
|
||||
@media screen and (max-width: 576px) {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
&--thin {
|
||||
margin-top: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
&__metamask-rate {
|
||||
display: flex;
|
||||
margin-top: 8%;
|
||||
}
|
||||
|
||||
&__metamask-rate-text {
|
||||
@ -214,5 +189,9 @@
|
||||
|
||||
&__thin-swaps-footer {
|
||||
max-height: 82px;
|
||||
|
||||
@media screen and (min-width: 576px) {
|
||||
height: 72px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,6 @@ import { useTokenTracker } from '../../../hooks/useTokenTracker'
|
||||
import { QUOTES_EXPIRED_ERROR } from '../../../helpers/constants/swaps'
|
||||
import CountdownTimer from '../countdown-timer'
|
||||
import SwapsFooter from '../swaps-footer'
|
||||
import InfoTooltip from '../../../components/ui/info-tooltip'
|
||||
import ViewQuotePriceDifference from './view-quote-price-difference'
|
||||
|
||||
export default function ViewQuote() {
|
||||
@ -117,6 +116,7 @@ export default function ViewQuote() {
|
||||
const tradeValue = usedQuote?.trade?.value ?? '0x0'
|
||||
|
||||
const { isBestQuote } = usedQuote
|
||||
|
||||
const fetchParamsSourceToken = fetchParams?.sourceToken
|
||||
|
||||
const usedGasLimit =
|
||||
@ -191,9 +191,11 @@ export default function ViewQuote() {
|
||||
destinationTokenDecimals,
|
||||
destinationTokenSymbol,
|
||||
destinationTokenValue,
|
||||
destinationIconUrl,
|
||||
sourceTokenDecimals,
|
||||
sourceTokenSymbol,
|
||||
sourceTokenValue,
|
||||
sourceTokenIconUrl,
|
||||
} = renderableDataForUsedQuote
|
||||
|
||||
const { feeInFiat, feeInEth } = getRenderableNetworkFeesForQuote(
|
||||
@ -499,11 +501,7 @@ export default function ViewQuote() {
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div
|
||||
className={classnames('view-quote__countdown-timer-container', {
|
||||
'view-quote__countdown-timer-container--thin': isShowingWarning,
|
||||
})}
|
||||
>
|
||||
<div className="view-quote__countdown-timer-container">
|
||||
<CountdownTimer
|
||||
timeStarted={quotesLastFetched}
|
||||
warningTime="0:30"
|
||||
@ -511,53 +509,21 @@ export default function ViewQuote() {
|
||||
labelKey="swapNewQuoteIn"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className={classnames('view-quote__main-quote-summary-container', {
|
||||
'view-quote__main-quote-summary-container--thin': isShowingWarning,
|
||||
})}
|
||||
>
|
||||
<MainQuoteSummary
|
||||
sourceValue={calcTokenValue(sourceTokenValue, sourceTokenDecimals)}
|
||||
sourceDecimals={sourceTokenDecimals}
|
||||
sourceSymbol={sourceTokenSymbol}
|
||||
destinationValue={calcTokenValue(
|
||||
destinationTokenValue,
|
||||
destinationTokenDecimals,
|
||||
)}
|
||||
destinationDecimals={destinationTokenDecimals}
|
||||
destinationSymbol={destinationTokenSymbol}
|
||||
isBestQuote={isBestQuote}
|
||||
/>
|
||||
</div>
|
||||
<div className="view-quote__view-other-button-container">
|
||||
<div className="view-quote__view-other-button">
|
||||
{t('swapNQuotesAvailable', [Object.values(quotes).length])}
|
||||
<i className="fa fa-arrow-right" />
|
||||
</div>
|
||||
<div
|
||||
className="view-quote__view-other-button-fade"
|
||||
onClick={() => {
|
||||
allAvailableQuotesOpened()
|
||||
setSelectQuotePopoverShown(true)
|
||||
}}
|
||||
>
|
||||
{t('swapNQuotesAvailable', [Object.values(quotes).length])}
|
||||
<i className="fa fa-arrow-right" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="view-quote__metamask-rate">
|
||||
<p className="view-quote__metamask-rate-text">
|
||||
{t('swapQuoteIncludesRate', [metaMaskFee])}
|
||||
</p>
|
||||
<InfoTooltip
|
||||
position="top"
|
||||
contentText={t('swapMetaMaskFeeDescription', [metaMaskFee])}
|
||||
wrapperClassName="view-quote__metamask-rate-info-icon"
|
||||
/>
|
||||
</div>
|
||||
<MainQuoteSummary
|
||||
sourceValue={calcTokenValue(sourceTokenValue, sourceTokenDecimals)}
|
||||
sourceDecimals={sourceTokenDecimals}
|
||||
sourceSymbol={sourceTokenSymbol}
|
||||
destinationValue={calcTokenValue(
|
||||
destinationTokenValue,
|
||||
destinationTokenDecimals,
|
||||
)}
|
||||
destinationDecimals={destinationTokenDecimals}
|
||||
destinationSymbol={destinationTokenSymbol}
|
||||
sourceIconUrl={sourceTokenIconUrl}
|
||||
destinationIconUrl={destinationIconUrl}
|
||||
/>
|
||||
<div
|
||||
className={classnames('view-quote__fee-card-container', {
|
||||
'view-quote__fee-card-container--thin': isShowingWarning,
|
||||
'view-quote__fee-card-container--three-rows':
|
||||
approveTxParams && (!balanceError || warningHidden),
|
||||
})}
|
||||
@ -578,6 +544,18 @@ export default function ViewQuote() {
|
||||
tokenApprovalTextComponent={tokenApprovalTextComponent}
|
||||
tokenApprovalSourceTokenSymbol={sourceTokenSymbol}
|
||||
onTokenApprovalClick={onFeeCardTokenApprovalClick}
|
||||
metaMaskFee={metaMaskFee}
|
||||
isBestQuote={isBestQuote}
|
||||
numberOfQuotes={Object.values(quotes).length}
|
||||
onQuotesClick={() => {
|
||||
allAvailableQuotesOpened()
|
||||
setSelectQuotePopoverShown(true)
|
||||
}}
|
||||
tokenConversionRate={
|
||||
destinationTokenSymbol === 'ETH'
|
||||
? 1
|
||||
: memoizedTokenConversionRates[destinationToken.address]
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -595,7 +573,6 @@ export default function ViewQuote() {
|
||||
onCancel={async () => await dispatch(navigateBackToBuildQuote(history))}
|
||||
disabled={balanceError || gasPrice === null || gasPrice === undefined}
|
||||
className={isShowingWarning && 'view-quote__thin-swaps-footer'}
|
||||
showTermsOfService
|
||||
showTopBorder
|
||||
/>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user