Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/chubby-peaches-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@reservoir0x/relay-kit-ui': patch
---

Add warning for missing token price detection + add stroke to all alerts
1 change: 1 addition & 0 deletions packages/ui/panda.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const Colors = {
// Red
red2: { value: '{colors.red.2}' },
red3: { value: '{colors.red.3}' },
red4: { value: '{colors.red.4}' },
red5: { value: '{colors.red.5}' },
red6: { value: '{colors.red.6}' },
red9: { value: '{colors.red.9}' },
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/components/widgets/SwapWidget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1558,8 +1558,9 @@ const SwapWidget: FC<SwapWidgetProps> = ({
{!isUsdInputMode &&
toToken &&
quote?.details?.currencyOut?.amountUsd &&
quote?.details?.currencyOut?.amountUsd !== '0' &&
!isFetchingQuote &&
quote.details.totalImpact?.percent ? (
quote?.details?.totalImpact?.percent ? (
<Text
style="subtitle3"
color={feeBreakdown?.totalFees.priceImpactColor}
Expand Down
50 changes: 48 additions & 2 deletions packages/ui/src/components/widgets/WidgetErrorWell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ export const WidgetErrorWell: FC<Props> = ({
isHighPriceImpact && totalImpactUsd && Number(totalImpactUsd) <= -10
const isInsufficientLiquidityError =
fetchQuoteErrorMessage?.includes('No quotes found')
const isMissingUsdTokenPrice =
quote?.details?.currencyOut &&
(quote?.details?.currencyOut?.amountUsd === undefined ||
quote?.details?.currencyOut?.amountUsd === '0')

if (isInsufficientLiquidityError) {
return null
Expand Down Expand Up @@ -87,6 +91,8 @@ export const WidgetErrorWell: FC<Props> = ({
gap: '2',
p: '3',
backgroundColor: 'amber2',
'--borderColor': 'colors.amber4',
border: '1px solid var(--borderColor)',
borderRadius: 12,
mb: '3',
...containerCss
Expand All @@ -113,6 +119,8 @@ export const WidgetErrorWell: FC<Props> = ({
gap: '2',
p: '3',
backgroundColor: 'amber2',
'--borderColor': 'colors.amber4',
border: '1px solid var(--borderColor)',
borderRadius: 12,
mb: '3',
...containerCss
Expand Down Expand Up @@ -141,6 +149,8 @@ export const WidgetErrorWell: FC<Props> = ({
gap: '2',
p: '3',
backgroundColor: 'red2',
'--borderColor': 'colors.red4',
border: '1px solid var(--borderColor)',
borderRadius: 12,
mb: '3',
...containerCss
Expand All @@ -163,6 +173,8 @@ export const WidgetErrorWell: FC<Props> = ({
gap: '2',
p: '3',
backgroundColor: 'red2',
'--borderColor': 'colors.red4',
border: '1px solid var(--borderColor)',
borderRadius: 12,
mb: '3',
...containerCss
Expand Down Expand Up @@ -205,6 +217,8 @@ export const WidgetErrorWell: FC<Props> = ({
py: '3',
px: '3',
backgroundColor: 'amber2',
'--borderColor': 'colors.amber4',
border: '1px solid var(--borderColor)',
borderRadius: 12,
mb: '3',
...containerCss
Expand All @@ -230,14 +244,16 @@ export const WidgetErrorWell: FC<Props> = ({
gap: '2',
py: '2',
px: '3',
backgroundColor: 'red2',
backgroundColor: 'amber2',
'--borderColor': 'colors.amber4',
border: '1px solid var(--borderColor)',
borderRadius: 12,
mb: '3',
...containerCss
}}
id={'widget-error-well-section'}
>
<Box css={{ color: 'red9' }}>
<Box css={{ color: 'amber10' }}>
<FontAwesomeIcon icon={faExclamationCircle} width={16} />
</Box>
<Text style="subtitle3" css={{ color: 'amber12' }}>
Expand All @@ -248,6 +264,34 @@ export const WidgetErrorWell: FC<Props> = ({
)
}

if (isMissingUsdTokenPrice) {
return (
<Flex
align="center"
css={{
gap: '2',
py: '2',
px: '3',
backgroundColor: 'amber2',
'--borderColor': 'colors.amber4',
border: '1px solid var(--borderColor)',
borderRadius: 12,
mb: '3',
...containerCss
}}
id={'widget-error-well-section'}
>
<Box css={{ color: 'amber10' }}>
<FontAwesomeIcon icon={faExclamationCircle} width={16} />
</Box>
<Text style="subtitle3" css={{ color: 'amber12' }}>
Unable to detect token price. Please confirm expected output before
submitting.
</Text>
</Flex>
)
}

if (isHighRelayerServiceFee) {
return (
<Flex
Expand All @@ -257,6 +301,8 @@ export const WidgetErrorWell: FC<Props> = ({
py: '3',
px: '3',
backgroundColor: 'amber2',
'--borderColor': 'colors.amber4',
border: '1px solid var(--borderColor)',
borderRadius: 12,
mb: '3',
...containerCss
Expand Down