@rango-dev/widget-embedded 0.23.1-next.11 → 0.23.1-next.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/HeaderButtons/HeaderButtons.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +165 -1
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
- package/dist/components/HeaderButtons/InProgressTransactionBadge.d.ts +4 -0
- package/dist/components/HeaderButtons/InProgressTransactionBadge.d.ts.map +1 -0
- package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts.map +1 -1
- package/dist/components/NoResult/NoResult.d.ts.map +1 -1
- package/dist/components/NoResult/NoResult.helpers.d.ts +8 -0
- package/dist/components/NoResult/NoResult.helpers.d.ts.map +1 -1
- package/dist/components/NoResult/NoResult.styles.d.ts +167 -1
- package/dist/components/NoResult/NoResult.styles.d.ts.map +1 -1
- package/dist/components/NoResult/NoResult.types.d.ts +1 -0
- package/dist/components/NoResult/NoResult.types.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts +165 -0
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/Quote/Quote.types.d.ts +1 -0
- package/dist/components/Quote/Quote.types.d.ts.map +1 -1
- package/dist/components/Quotes/Quotes.d.ts.map +1 -1
- package/dist/components/Quotes/Quotes.types.d.ts +1 -0
- package/dist/components/Quotes/Quotes.types.d.ts.map +1 -1
- package/dist/containers/ExpandedQuotes/ExpandedQuotes.d.ts.map +1 -1
- package/dist/containers/ExpandedQuotes/ExpandedQuotes.styles.d.ts +3 -1
- package/dist/containers/ExpandedQuotes/ExpandedQuotes.styles.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +1 -0
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/types/config.d.ts +3 -2
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +2 -1
- package/dist/utils/configs.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/HeaderButtons/HeaderButtons.styles.ts +24 -1
- package/src/components/HeaderButtons/HeaderButtons.tsx +2 -0
- package/src/components/HeaderButtons/InProgressTransactionBadge.tsx +26 -0
- package/src/components/HeaderButtons/UnreadNotificationsBadge.tsx +10 -2
- package/src/components/NoResult/NoResult.helpers.ts +13 -0
- package/src/components/NoResult/NoResult.styles.ts +19 -1
- package/src/components/NoResult/NoResult.tsx +27 -16
- package/src/components/NoResult/NoResult.types.ts +1 -0
- package/src/components/NotificationContent/NotificationContent.styles.ts +14 -1
- package/src/components/NotificationContent/NotificationContent.tsx +49 -39
- package/src/components/Quote/Quote.tsx +162 -145
- package/src/components/Quote/Quote.types.ts +1 -0
- package/src/components/Quotes/Quotes.tsx +17 -7
- package/src/components/Quotes/Quotes.types.ts +1 -0
- package/src/containers/ExpandedQuotes/ExpandedQuotes.styles.ts +12 -0
- package/src/containers/ExpandedQuotes/ExpandedQuotes.tsx +5 -0
- package/src/containers/QuoteInfo/QuoteInfo.tsx +2 -0
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +1 -0
- package/src/pages/Home.tsx +2 -1
- package/src/types/config.ts +3 -2
- package/src/utils/configs.ts +5 -1
|
@@ -6,6 +6,7 @@ import { i18n } from '@lingui/core';
|
|
|
6
6
|
import {
|
|
7
7
|
Alert,
|
|
8
8
|
Divider,
|
|
9
|
+
FullExpandedQuote,
|
|
9
10
|
InfoIcon,
|
|
10
11
|
QuoteTag,
|
|
11
12
|
StepDetails,
|
|
@@ -33,7 +34,7 @@ import {
|
|
|
33
34
|
} from '../../containers/QuoteInfo/QuoteInfo.styles';
|
|
34
35
|
import { useAppStore } from '../../store/AppStore';
|
|
35
36
|
import { QuoteErrorType, QuoteWarningType } from '../../types';
|
|
36
|
-
import { getContainer } from '../../utils/common';
|
|
37
|
+
import { getContainer, getExpanded } from '../../utils/common';
|
|
37
38
|
import {
|
|
38
39
|
getBlockchainShortNameFor,
|
|
39
40
|
getSwapperDisplayName,
|
|
@@ -83,6 +84,7 @@ export function Quote(props: QuoteProps) {
|
|
|
83
84
|
tagHidden = true,
|
|
84
85
|
showModalFee = true,
|
|
85
86
|
onClickAllRoutes,
|
|
87
|
+
fullExpandedMode = false,
|
|
86
88
|
} = props;
|
|
87
89
|
const blockchains = useAppStore().blockchains();
|
|
88
90
|
const tokens = useAppStore().tokens();
|
|
@@ -298,157 +300,172 @@ export function Quote(props: QuoteProps) {
|
|
|
298
300
|
GAS_FEE_MAX_DECIMALS
|
|
299
301
|
);
|
|
300
302
|
|
|
301
|
-
return (
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
<
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
303
|
+
return fullExpandedMode ? (
|
|
304
|
+
<FullExpandedQuote
|
|
305
|
+
selected={selected}
|
|
306
|
+
fee={fee}
|
|
307
|
+
time={totalTime}
|
|
308
|
+
tooltipContainer={getExpanded()}
|
|
309
|
+
steps={steps}
|
|
310
|
+
tags={sortedQuoteTags}
|
|
311
|
+
percentageChange={percentageChange}
|
|
312
|
+
warningLevel={priceImpactWarningLevel}
|
|
313
|
+
outputPrice={{
|
|
314
|
+
value: roundedOutput,
|
|
315
|
+
usdValue: roundedOutputUsdValue,
|
|
316
|
+
realValue: formatTooltipNumbers(output.value),
|
|
317
|
+
realUsdValue: formatTooltipNumbers(output.usdValue),
|
|
318
|
+
}}
|
|
319
|
+
/>
|
|
320
|
+
) : (
|
|
321
|
+
<SummaryContainer
|
|
322
|
+
selected={selected}
|
|
323
|
+
listItem={type === 'list-item'}
|
|
324
|
+
basic={type === 'basic'}>
|
|
325
|
+
<div className={summaryStyles()}>
|
|
326
|
+
{!tagHidden && sortedQuoteTags.length ? (
|
|
327
|
+
<>
|
|
328
|
+
<TagContainer>
|
|
329
|
+
{sortedQuoteTags.map((tag, index) => {
|
|
330
|
+
const key = `${tag.value}_${index}`;
|
|
331
|
+
return (
|
|
332
|
+
<>
|
|
333
|
+
<QuoteTag label={tag.label} key={key} value={tag.value} />
|
|
334
|
+
<Divider size={4} direction="horizontal" />
|
|
335
|
+
</>
|
|
336
|
+
);
|
|
337
|
+
})}
|
|
338
|
+
</TagContainer>
|
|
339
|
+
<Line />
|
|
340
|
+
{!showAllRoutesButton && <Divider size={4} />}
|
|
341
|
+
</>
|
|
342
|
+
) : null}
|
|
343
|
+
<div id="portal-root" className={summaryHeaderStyles()}>
|
|
344
|
+
<QuoteCostDetails
|
|
345
|
+
quote={quote}
|
|
346
|
+
time={totalTime}
|
|
347
|
+
fee={fee}
|
|
348
|
+
feeWarning={totalFee.gte(new BigNumber(GAS_FEE_MAX))}
|
|
349
|
+
showModalFee={showModalFee}
|
|
350
|
+
steps={numberOfSteps}
|
|
351
|
+
/>
|
|
334
352
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
<Tooltip
|
|
360
|
-
content={formatTooltipNumbers(output.value)}
|
|
361
|
-
container={container}
|
|
362
|
-
open={!output.value ? false : undefined}>
|
|
363
|
-
<BasicInfoOutput size="small" variant="body">
|
|
364
|
-
|
|
365
|
-
{`${roundedOutput} ${
|
|
366
|
-
steps[steps.length - 1].to.token.displayName
|
|
367
|
-
}`}
|
|
368
|
-
</BasicInfoOutput>
|
|
369
|
-
</Tooltip>
|
|
370
|
-
</ContainerInfoOutput>
|
|
353
|
+
{showAllRoutesButton && (
|
|
354
|
+
<AllRoutesButton
|
|
355
|
+
onClick={(e) => {
|
|
356
|
+
e.stopPropagation();
|
|
357
|
+
onClickAllRoutes();
|
|
358
|
+
}}
|
|
359
|
+
size="xxsmall"
|
|
360
|
+
type="secondary"
|
|
361
|
+
variant="default">
|
|
362
|
+
<Typography color="secondary" variant="label" size="medium">
|
|
363
|
+
{i18n.t('See All Routes')}
|
|
364
|
+
</Typography>
|
|
365
|
+
</AllRoutesButton>
|
|
366
|
+
)}
|
|
367
|
+
</div>
|
|
368
|
+
{type === 'basic' && (
|
|
369
|
+
<div className={basicInfoStyles()}>
|
|
370
|
+
<FrameIcon>
|
|
371
|
+
<InfoIcon size={12} color="gray" />
|
|
372
|
+
</FrameIcon>
|
|
373
|
+
<ContainerInfoOutput>
|
|
374
|
+
<BasicInfoOutput size="small" variant="body">
|
|
375
|
+
{`${roundedInput} ${steps[0].from.token.displayName} = `}
|
|
376
|
+
</BasicInfoOutput>
|
|
371
377
|
<Tooltip
|
|
372
|
-
content={formatTooltipNumbers(output.
|
|
378
|
+
content={formatTooltipNumbers(output.value)}
|
|
373
379
|
container={container}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
variant="body">
|
|
382
|
-
{`($${roundedOutputUsdValue})`}
|
|
383
|
-
</Typography>
|
|
380
|
+
open={!output.value ? false : undefined}>
|
|
381
|
+
<BasicInfoOutput size="small" variant="body">
|
|
382
|
+
|
|
383
|
+
{`${roundedOutput} ${
|
|
384
|
+
steps[steps.length - 1].to.token.displayName
|
|
385
|
+
}`}
|
|
386
|
+
</BasicInfoOutput>
|
|
384
387
|
</Tooltip>
|
|
385
|
-
</
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
388
|
+
</ContainerInfoOutput>
|
|
389
|
+
<Tooltip
|
|
390
|
+
content={formatTooltipNumbers(output.usdValue)}
|
|
391
|
+
container={container}
|
|
392
|
+
style={{
|
|
393
|
+
display: 'flex',
|
|
394
|
+
}}>
|
|
395
|
+
<Typography
|
|
396
|
+
color="$neutral600"
|
|
397
|
+
ml={2}
|
|
398
|
+
size="xsmall"
|
|
399
|
+
variant="body">
|
|
400
|
+
{`($${roundedOutputUsdValue})`}
|
|
401
|
+
</Typography>
|
|
402
|
+
</Tooltip>
|
|
403
|
+
</div>
|
|
404
|
+
)}
|
|
405
|
+
{type === 'list-item' && (
|
|
406
|
+
<TokenAmount
|
|
407
|
+
tooltipContainer={container}
|
|
408
|
+
type="output"
|
|
409
|
+
direction="vertical"
|
|
410
|
+
price={{
|
|
411
|
+
value: roundedOutput,
|
|
412
|
+
usdValue: roundedOutputUsdValue,
|
|
413
|
+
realValue: formatTooltipNumbers(output.value),
|
|
414
|
+
realUsdValue: formatTooltipNumbers(output.usdValue),
|
|
415
|
+
}}
|
|
416
|
+
token={{
|
|
417
|
+
displayName: steps[numberOfSteps - 1].to.token.displayName,
|
|
418
|
+
image: steps[numberOfSteps - 1].to.token.image,
|
|
419
|
+
}}
|
|
420
|
+
chain={{ image: steps[numberOfSteps - 1].to.chain.image }}
|
|
421
|
+
percentageChange={percentageChange}
|
|
422
|
+
warningLevel={priceImpactWarningLevel}
|
|
423
|
+
/>
|
|
424
|
+
)}
|
|
425
|
+
{type === 'swap-preview' && (
|
|
426
|
+
<>
|
|
427
|
+
<QuoteSummary
|
|
428
|
+
from={steps[0].from}
|
|
429
|
+
to={steps[numberOfSteps - 1].to}
|
|
403
430
|
percentageChange={percentageChange}
|
|
404
431
|
warningLevel={priceImpactWarningLevel}
|
|
405
432
|
/>
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
</div>
|
|
419
|
-
<QuoteContainer
|
|
433
|
+
<Divider size={4} />
|
|
434
|
+
</>
|
|
435
|
+
)}
|
|
436
|
+
</div>
|
|
437
|
+
<QuoteContainer
|
|
438
|
+
selected={selected}
|
|
439
|
+
listItem={type === 'list-item'}
|
|
440
|
+
open={expanded}
|
|
441
|
+
onOpenChange={setExpanded}>
|
|
442
|
+
<QuoteTrigger
|
|
443
|
+
type={type}
|
|
444
|
+
quoteRef={quoteRef}
|
|
420
445
|
selected={selected}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
/>
|
|
446
|
-
);
|
|
447
|
-
})}
|
|
448
|
-
</div>
|
|
449
|
-
</Content>
|
|
450
|
-
</QuoteContainer>
|
|
451
|
-
</SummaryContainer>
|
|
452
|
-
</>
|
|
446
|
+
setExpanded={setExpanded}
|
|
447
|
+
expanded={expanded}
|
|
448
|
+
steps={steps}
|
|
449
|
+
/>
|
|
450
|
+
<Content open={expanded}>
|
|
451
|
+
<HorizontalSeparator />
|
|
452
|
+
<div className={stepsDetailsStyles()}>
|
|
453
|
+
{steps.map((step, index) => {
|
|
454
|
+
const key = `item-${index}`;
|
|
455
|
+
return (
|
|
456
|
+
<StepDetails
|
|
457
|
+
type="quote-details"
|
|
458
|
+
key={key}
|
|
459
|
+
tooltipContainer={container}
|
|
460
|
+
step={step}
|
|
461
|
+
hasSeparator={index !== steps.length - 1}
|
|
462
|
+
state={step.state}
|
|
463
|
+
/>
|
|
464
|
+
);
|
|
465
|
+
})}
|
|
466
|
+
</div>
|
|
467
|
+
</Content>
|
|
468
|
+
</QuoteContainer>
|
|
469
|
+
</SummaryContainer>
|
|
453
470
|
);
|
|
454
471
|
}
|
|
@@ -2,7 +2,7 @@ import type { PropTypes } from './Quotes.types';
|
|
|
2
2
|
import type { MultiRouteSimulationResult } from 'rango-sdk';
|
|
3
3
|
|
|
4
4
|
import { i18n } from '@lingui/core';
|
|
5
|
-
import { Divider, Typography } from '@rango-dev/ui';
|
|
5
|
+
import { Divider, FullExpandedQuote, Typography } from '@rango-dev/ui';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import { QuoteInfo } from '../../containers/QuoteInfo';
|
|
@@ -26,6 +26,7 @@ export function Quotes(props: PropTypes) {
|
|
|
26
26
|
fetch,
|
|
27
27
|
showModalFee,
|
|
28
28
|
hasSort = true,
|
|
29
|
+
fullExpandedMode = false,
|
|
29
30
|
} = props;
|
|
30
31
|
const {
|
|
31
32
|
selectedQuote,
|
|
@@ -69,11 +70,15 @@ export function Quotes(props: PropTypes) {
|
|
|
69
70
|
{loading &&
|
|
70
71
|
Array.from({ length: ITEM_SKELETON_COUNT }, (_, index) => (
|
|
71
72
|
<React.Fragment key={index}>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
{fullExpandedMode ? (
|
|
74
|
+
<FullExpandedQuote loading />
|
|
75
|
+
) : (
|
|
76
|
+
<QuoteSkeleton
|
|
77
|
+
tagHidden={false}
|
|
78
|
+
type="list-item"
|
|
79
|
+
expanded={false}
|
|
80
|
+
/>
|
|
81
|
+
)}
|
|
77
82
|
<Divider size={16} />
|
|
78
83
|
</React.Fragment>
|
|
79
84
|
))}
|
|
@@ -106,6 +111,7 @@ export function Quotes(props: PropTypes) {
|
|
|
106
111
|
loading={loading}
|
|
107
112
|
error={quoteError?.options || null}
|
|
108
113
|
warning={quoteWarning}
|
|
114
|
+
fullExpandedMode={fullExpandedMode}
|
|
109
115
|
onClick={(quote) => {
|
|
110
116
|
if (!quoteError) {
|
|
111
117
|
updateQuotePartialState('warning', quoteWarning);
|
|
@@ -124,7 +130,11 @@ export function Quotes(props: PropTypes) {
|
|
|
124
130
|
})
|
|
125
131
|
: showNoResultMessage && (
|
|
126
132
|
<ErrorsContainer>
|
|
127
|
-
<NoResult
|
|
133
|
+
<NoResult
|
|
134
|
+
size={fullExpandedMode ? 'large' : 'small'}
|
|
135
|
+
error={error}
|
|
136
|
+
fetch={fetch}
|
|
137
|
+
/>
|
|
128
138
|
</ErrorsContainer>
|
|
129
139
|
)}
|
|
130
140
|
</>
|
|
@@ -10,6 +10,18 @@ export const Container = styled('div', {
|
|
|
10
10
|
[`.${darkTheme} &`]: {
|
|
11
11
|
backgroundColor: '$neutral300',
|
|
12
12
|
},
|
|
13
|
+
|
|
14
|
+
variants: {
|
|
15
|
+
expandMode: {
|
|
16
|
+
default: {
|
|
17
|
+
width: '390px',
|
|
18
|
+
},
|
|
19
|
+
full: {
|
|
20
|
+
width: '719px',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
|
|
13
25
|
'&.is-hidden': {
|
|
14
26
|
width: 0,
|
|
15
27
|
opacity: 0,
|
|
@@ -9,6 +9,7 @@ import { LayoutContainer } from '../../components/Layout/Layout.styles';
|
|
|
9
9
|
import { Quotes } from '../../components/Quotes';
|
|
10
10
|
import { SelectStrategy } from '../../components/Quotes/SelectStrategy';
|
|
11
11
|
import { WIDGET_UI_ID } from '../../constants';
|
|
12
|
+
import { useAppStore } from '../../store/AppStore';
|
|
12
13
|
import { getExpanded } from '../../utils/common';
|
|
13
14
|
|
|
14
15
|
import { Container, Content } from './ExpandedQuotes.styles';
|
|
@@ -19,6 +20,8 @@ export function ExpandedQuotes(props: PropTypes) {
|
|
|
19
20
|
const { fetch, loading, onClickOnQuote, onClickRefresh, isVisible } = props;
|
|
20
21
|
const [isDelayedVisible, setIsDelayedVisible] = useState(false);
|
|
21
22
|
const containerClass = isDelayedVisible ? '' : 'is-hidden';
|
|
23
|
+
const { config } = useAppStore();
|
|
24
|
+
const fullExpandedMode = config?.variant === 'full-expanded';
|
|
22
25
|
|
|
23
26
|
useEffect(() => {
|
|
24
27
|
let timeout: ReturnType<typeof setTimeout> | null = null;
|
|
@@ -43,6 +46,7 @@ export function ExpandedQuotes(props: PropTypes) {
|
|
|
43
46
|
|
|
44
47
|
return (
|
|
45
48
|
<Container
|
|
49
|
+
expandMode={config?.variant === 'full-expanded' ? 'full' : 'default'}
|
|
46
50
|
className={`${containerClass} ${LayoutContainer()}`}
|
|
47
51
|
id={WIDGET_UI_ID.EXPANDED_BOX_ID}>
|
|
48
52
|
<Header
|
|
@@ -64,6 +68,7 @@ export function ExpandedQuotes(props: PropTypes) {
|
|
|
64
68
|
hasSort={false}
|
|
65
69
|
loading={loading}
|
|
66
70
|
onClickOnQuote={onClickOnQuote}
|
|
71
|
+
fullExpandedMode={fullExpandedMode}
|
|
67
72
|
/>
|
|
68
73
|
</Content>
|
|
69
74
|
</Container>
|
|
@@ -25,6 +25,7 @@ export function QuoteInfo(props: PropTypes) {
|
|
|
25
25
|
showModalFee,
|
|
26
26
|
selected,
|
|
27
27
|
onClickAllRoutes,
|
|
28
|
+
fullExpandedMode = false,
|
|
28
29
|
} = props;
|
|
29
30
|
const { inputAmount, inputUsdValue, toToken } = useQuoteStore();
|
|
30
31
|
|
|
@@ -65,6 +66,7 @@ export function QuoteInfo(props: PropTypes) {
|
|
|
65
66
|
type={type}
|
|
66
67
|
expanded={expanded}
|
|
67
68
|
onClickAllRoutes={onClickAllRoutes}
|
|
69
|
+
fullExpandedMode={fullExpandedMode}
|
|
68
70
|
input={{
|
|
69
71
|
value: inputAmount,
|
|
70
72
|
usdValue: inputUsdValue?.toString() ?? '',
|
package/src/pages/Home.tsx
CHANGED
|
@@ -16,6 +16,7 @@ import { useAppStore } from '../store/AppStore';
|
|
|
16
16
|
import { useQuoteStore } from '../store/quote';
|
|
17
17
|
import { useUiStore } from '../store/ui';
|
|
18
18
|
import { useWalletsStore } from '../store/wallets';
|
|
19
|
+
import { isVarianExpandable } from '../utils/configs';
|
|
19
20
|
import { getSwapButtonState } from '../utils/swap';
|
|
20
21
|
|
|
21
22
|
const MainContainer = styled('div', {
|
|
@@ -67,7 +68,7 @@ export function Home() {
|
|
|
67
68
|
warning: quoteWarning,
|
|
68
69
|
needsToWarnEthOnPath,
|
|
69
70
|
});
|
|
70
|
-
const isExpandable = config?.variant
|
|
71
|
+
const isExpandable = isVarianExpandable(config?.variant) && !isMobile;
|
|
71
72
|
const hasInputs =
|
|
72
73
|
!!inputAmount && !!fromToken && !!toToken && inputAmount !== '0';
|
|
73
74
|
const fetchingQuote = hasInputs && fetchMetaStatus === 'success' && loading;
|
package/src/types/config.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { ProviderInterface } from '@rango-dev/wallets-react';
|
|
|
3
3
|
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
4
4
|
import type { Asset } from 'rango-sdk';
|
|
5
5
|
|
|
6
|
-
export type WidgetVariant = 'default' | '
|
|
6
|
+
export type WidgetVariant = 'default' | 'expanded' | 'full-expanded';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The above type defines a set of optional color properties for a widget.
|
|
@@ -182,7 +182,8 @@ export type Features = Partial<
|
|
|
182
182
|
* - 'language': Visibility state for the language.
|
|
183
183
|
* - 'experimentalRoute': Enablement state for the experimental route.
|
|
184
184
|
* @property {WidgetVariant} variant
|
|
185
|
-
* If it is
|
|
185
|
+
* If it is expanded, multiple routes will show up on the home page;
|
|
186
|
+
* If it is full-expanded, multiple routes will show up on the home page with full routes;
|
|
186
187
|
* if not, you will need to go to a different page to see the suggested routes.
|
|
187
188
|
*/
|
|
188
189
|
|
package/src/utils/configs.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Tokens } from '../types';
|
|
1
|
+
import type { Tokens, WidgetVariant } from '../types';
|
|
2
2
|
import type { Asset, BlockchainMeta, Token } from 'rango-sdk';
|
|
3
3
|
|
|
4
4
|
import { RANGO_PUBLIC_API_KEY } from '../constants';
|
|
@@ -79,3 +79,7 @@ export const isBlockchainExcludedInConfig = (
|
|
|
79
79
|
!blockchainsConfig.includes(blockchain.name)
|
|
80
80
|
);
|
|
81
81
|
};
|
|
82
|
+
|
|
83
|
+
export const isVarianExpandable = (variant?: WidgetVariant) => {
|
|
84
|
+
return variant === 'expanded' || variant === 'full-expanded';
|
|
85
|
+
};
|