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

feat: use WarningAcknowledgement component #6647

Merged
merged 58 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
4513c3b
Merge branch 'main' into develop
woodenfurniture Apr 2, 2024
bd20bf0
feat: regenerate asset data 04/02/2024 (#6620)
gomesalexandre Apr 2, 2024
88ab918
feat: disable sym deposits after RUNE (#6622)
gomesalexandre Apr 2, 2024
b1e3490
fix: don't bork asset generation on idle API failures (#6619)
gomesalexandre Apr 2, 2024
ca37e0e
feat: collect 0x trade surplus (#6625)
0xApotheosis Apr 3, 2024
76119c8
feat: bottom sheet dialog (#6623)
reallybeard Apr 3, 2024
faa414f
chore: use unchained proxy endpoints over nownodes proxy (#6606)
kaladinlight Apr 3, 2024
f1f0d1b
feat: use proxy validation endpoint (#6626)
0xApotheosis Apr 4, 2024
ced5a38
feat: many migrations (#6631)
gomesalexandre Apr 4, 2024
939320c
fix: remove portal on account dropdown (#6635)
reallybeard Apr 4, 2024
4844a2c
feat: cow affiliate fees (#6621)
gomesalexandre Apr 4, 2024
e038343
chore: update app translations (#6638)
firebomb1 Apr 4, 2024
8967dcd
feat: cow quote/unsigned order build cleanup (#6639)
gomesalexandre Apr 5, 2024
340c9fc
fix: deep merge opportunities accounts (#6627)
gomesalexandre Apr 5, 2024
43db1bb
feat: regenerate asset data 04/04/2024 (#6636)
gomesalexandre Apr 5, 2024
88b3612
fix: defi aggregated opportunities uniqBy id first (#6628)
gomesalexandre Apr 5, 2024
62d6160
feat: lending loan summary repayment lock (#6642)
gomesalexandre Apr 5, 2024
ef740bb
fix: mobile dashboard routing (#6637)
gomesalexandre Apr 5, 2024
0bfb6ba
feat: thorchain lp disable max deposits (#6645)
gomesalexandre Apr 5, 2024
0da4bb9
feat: uni-v2 pools static generation (#6629)
gomesalexandre Apr 7, 2024
43fb92c
Merge branch 'main' into develop
0xApotheosis Apr 8, 2024
60aab31
feat: regenerate asset data 04/08/2024 (#6648)
gomesalexandre Apr 8, 2024
d3f4241
feat: thorchain LP charts (#6624)
gomesalexandre Apr 9, 2024
aa484a3
feat: tag foxy as expired opportunity (#6651)
gomesalexandre Apr 9, 2024
ddec22a
fix: empty my position pools page (#6656)
reallybeard Apr 9, 2024
8e3487b
feat: add first pass WarningAcknowledgement component
0xApotheosis Apr 8, 2024
a5bc377
chore: use translations
0xApotheosis Apr 9, 2024
a77d372
chore: wire up savers deposit
0xApotheosis Apr 9, 2024
9651bcc
chore: tidy
0xApotheosis Apr 9, 2024
19582f0
feat: use warningAcknowledgement in trade quote confirm
0xApotheosis Apr 9, 2024
725e53c
feat: use warningAcknowledgement in trade quote confirm
0xApotheosis Apr 10, 2024
caebbe5
Merge branch 'develop' into warning-ack
0xApotheosis Apr 11, 2024
56eb92a
feat: use warningAcknowledgement in trade lp deposit
0xApotheosis Apr 11, 2024
34dfc9a
fix: trade quote input warning logic
0xApotheosis Apr 11, 2024
a877d68
chore: use dimmed background
0xApotheosis Apr 11, 2024
56b0b15
chore: component a little closer to mock
0xApotheosis Apr 11, 2024
561a41d
chore: component tweaks
0xApotheosis Apr 11, 2024
9e709d5
Merge branch 'develop' into warning-ack
0xApotheosis Apr 12, 2024
d8267dc
chore: style fixes
0xApotheosis Apr 12, 2024
2a1dae0
chore: use cancel translation
0xApotheosis Apr 12, 2024
4eb4138
fix: trade confirm warning
0xApotheosis Apr 12, 2024
da141c3
Update WarningAcknowledgement.tsx
reallybeard Apr 12, 2024
98517f8
Update WarningAcknowledgement.tsx
reallybeard Apr 12, 2024
d0c6e85
Merge branch 'develop' into warning-ack
gomesalexandre Apr 12, 2024
d169ae2
feat: chart styles and loading state (#6655)
reallybeard Apr 12, 2024
ff32121
fix: thor token repayments (#6676)
gomesalexandre Apr 12, 2024
ead8c2e
fix: don't render back button on modals initial routes (#6675)
gomesalexandre Apr 14, 2024
05c292f
chore: use translations & constants
0xApotheosis Apr 15, 2024
916ecb4
chore: address review feedback
0xApotheosis Apr 15, 2024
508d80f
Merge branch 'develop' into warning-ack
0xApotheosis Apr 16, 2024
66420d8
fix: unbork trade widget size
0xApotheosis Apr 16, 2024
c281c20
fix: show minimum trade amount when unsafe
0xApotheosis Apr 16, 2024
68d0ff7
fix: trade confirm width
0xApotheosis Apr 16, 2024
d1295c2
Merge branch 'develop' into warning-ack
gomesalexandre Apr 16, 2024
a4d7407
chore: trigger CI
gomesalexandre Apr 16, 2024
08201d0
fix: typo
gomesalexandre Apr 16, 2024
a80e329
chore: extract motion style to constant
0xApotheosis Apr 16, 2024
ab30e3c
fix: add no min fallback message
0xApotheosis Apr 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/assets/translations/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -2336,7 +2336,7 @@
"highSlippageDeposit": "This deposit has high slippage (%{slippagePercentage}%). Proceed with caution.",
"highSlippageBorrow": "This borrow has high slippage (%{slippagePercentage}%). Proceed with caution.",
"highSlippageTrade": "This trade is impacted by price movement (%{slippagePercentage}%). Proceed with caution.",
"unsafeTrade": "This trade may be unssafe, proceed with caution."
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
"unsafeTrade": "This trade may be unsafe, proceed with caution."
},
"watchlist": {
"empty": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { ArrowDownIcon } from '@chakra-ui/icons'
import {
Alert,
AlertDescription,
AlertIcon,
Button,
Card,
CardFooter,
Expand Down Expand Up @@ -48,14 +45,12 @@ import { useWallet } from 'hooks/useWallet/useWallet'
import { useWalletSupportsChain } from 'hooks/useWalletSupportsChain/useWalletSupportsChain'
import { positiveOrZero } from 'lib/bignumber/bignumber'
import type { ParameterModel } from 'lib/fees/parameters/types'
import { fromBaseUnit } from 'lib/math'
import { getMixPanel } from 'lib/mixpanel/mixPanelSingleton'
import { MixPanelEvent } from 'lib/mixpanel/types'
import {
THORCHAIN_LONGTAIL_STREAMING_SWAP_SOURCE,
THORCHAIN_LONGTAIL_SWAP_SOURCE,
} from 'lib/swapper/swappers/ThorchainSwapper/constants'
import type { ThorTradeQuote } from 'lib/swapper/swappers/ThorchainSwapper/getThorTradeQuote/getTradeQuote'
import { isKeplrHDWallet, isToken } from 'lib/utils'
import { selectIsSnapshotApiQueriesPending, selectVotingPower } from 'state/apis/snapshot/selectors'
import { selectIsTradeQuoteApiQueryPending } from 'state/apis/swapper/selectors'
Expand Down Expand Up @@ -379,10 +374,6 @@ export const TradeInput = memo(({ isCompact }: TradeInputProps) => {
wallet,
])

useEffect(() => {
if (isUnsafeQuote) setShouldShowWarningAcknowledgement(true)
}, [isUnsafeQuote])

useEffect(() => {
// Reset the trade warning if the active quote has changed, i.e. a better quote has come in and the
// user has not yet confirmed the previous one
Expand Down Expand Up @@ -430,34 +421,6 @@ export const TradeInput = memo(({ isCompact }: TradeInputProps) => {
isTradeQuoteApiQueryPending,
])

const maybeUnsafeTradeWarning = useMemo(() => {
if (!isUnsafeQuote) return null

const recommendedMinimumCryptoBaseUnit = (activeQuote as ThorTradeQuote)
?.recommendedMinimumCryptoBaseUnit
if (!recommendedMinimumCryptoBaseUnit) return null
const recommendedMinimumCryptoPrecision = fromBaseUnit(
recommendedMinimumCryptoBaseUnit,
sellAsset.precision,
)

return (
<Flex direction='column' gap={2}>
<Alert status='error' width='auto' fontSize='sm' variant='solid'>
<AlertIcon color='red' />
<Stack spacing={0}>
<AlertDescription lineHeight='short'>
{translate('trade.errors.unsafeQuote', {
symbol: sellAsset.symbol,
recommendedMin: recommendedMinimumCryptoPrecision,
})}
</AlertDescription>
</Stack>
</Alert>
</Flex>
)
}, [activeQuote, isUnsafeQuote, sellAsset.precision, sellAsset.symbol, translate])

const handleCloseCompactQuoteList = useCallback(() => setIsCompactQuoteListOpen(false), [])

const handleOpenCompactQuoteList = useCallback(() => {
Expand Down Expand Up @@ -522,7 +485,6 @@ export const TradeInput = memo(({ isCompact }: TradeInputProps) => {
>
<WithLazyMount shouldUse={Boolean(receiveAddress)} component={RecipientAddress} />
<WithLazyMount shouldUse={!walletSupportsBuyAssetChain} component={ManualAddressEntry} />
{maybeUnsafeTradeWarning}

<Button
type='submit'
Expand Down Expand Up @@ -556,21 +518,17 @@ export const TradeInput = memo(({ isCompact }: TradeInputProps) => {
priceImpactPercentage,
receiveAddress,
walletSupportsBuyAssetChain,
maybeUnsafeTradeWarning,
quoteHasError,
shouldDisablePreviewButton,
quoteStatusTranslation,
],
)

const handleFormSubmit = useMemo(() => handleSubmit(onSubmit), [handleSubmit, onSubmit])
const handleTradeQouteConfirm = useCallback(() => {
if (isUnsafeQuote) {
return setShouldShowWarningAcknowledgement(true)
} else {
handleFormSubmit()
}
}, [handleFormSubmit, isUnsafeQuote])
const handleTradeQouteConfirm = useCallback(
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
() => (isUnsafeQuote ? setShouldShowWarningAcknowledgement(true) : handleFormSubmit()),
[handleFormSubmit, isUnsafeQuote],
)

const sellTradeAssetSelect = useMemo(
() => (
Expand Down
7 changes: 4 additions & 3 deletions src/pages/Lending/Pool/components/Borrow/BorrowInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,10 @@ export const BorrowInput = ({
lendingQuoteError?.message,
])

const handleBorrowSubmit = useCallback(() => {
return !!isUnsafeQuote ? setShouldShowWarningAcknowledgement(true) : onSubmit()
}, [isUnsafeQuote, onSubmit])
const handleBorrowSubmit = useCallback(
() => (isUnsafeQuote ? setShouldShowWarningAcknowledgement(true) : onSubmit()),
[isUnsafeQuote, onSubmit],
)

if (!(collateralAsset && borrowAsset && collateralFeeAsset)) return null

Expand Down
Loading