@rango-dev/widget-embedded 0.21.1-next.7 → 0.21.1-next.9
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/CustomCollapsible/CustomCollapsible.d.ts.map +1 -1
- package/dist/components/HistoryGroupedList/HistoryGroupedList.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/package.json +2 -2
- package/src/components/CustomCollapsible/CustomCollapsible.tsx +1 -10
- package/src/components/HistoryGroupedList/HistoryGroupedList.tsx +25 -31
- package/src/components/Quote/Quote.tsx +1 -11
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { PropTypes } from './CustomCollapsible.types';
|
|
2
2
|
import type { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
|
-
import React, {
|
|
4
|
+
import React, { useRef } from 'react';
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
CollapsibleContent,
|
|
8
8
|
CollapsibleRoot,
|
|
9
|
-
EXPANDABLE_TRANSITION_DURATION,
|
|
10
9
|
Trigger,
|
|
11
10
|
} from './CustomCollapsible.styles';
|
|
12
11
|
|
|
@@ -22,14 +21,6 @@ export function CustomCollapsible(props: PropsWithChildren<PropTypes>) {
|
|
|
22
21
|
} = props;
|
|
23
22
|
const ref = useRef<HTMLDivElement | null>(null);
|
|
24
23
|
|
|
25
|
-
useLayoutEffect(() => {
|
|
26
|
-
if (open && ref.current) {
|
|
27
|
-
setTimeout(() => {
|
|
28
|
-
ref?.current?.scrollIntoView({ behavior: 'smooth' });
|
|
29
|
-
}, EXPANDABLE_TRANSITION_DURATION);
|
|
30
|
-
}
|
|
31
|
-
}, [open]);
|
|
32
|
-
|
|
33
24
|
return (
|
|
34
25
|
<CollapsibleRoot
|
|
35
26
|
ref={ref}
|
|
@@ -4,6 +4,7 @@ import { i18n } from '@lingui/core';
|
|
|
4
4
|
import {
|
|
5
5
|
Divider,
|
|
6
6
|
GroupedVirtualizedList,
|
|
7
|
+
Skeleton,
|
|
7
8
|
SwapListItem,
|
|
8
9
|
Typography,
|
|
9
10
|
} from '@rango-dev/ui';
|
|
@@ -50,39 +51,29 @@ export function HistoryGroupedList(props: PropTypes) {
|
|
|
50
51
|
}, [isLoading, loadMore]);
|
|
51
52
|
|
|
52
53
|
if (isLoading) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const loadingGroups = [
|
|
56
|
-
{
|
|
57
|
-
title: i18n.t('Today'),
|
|
58
|
-
swaps,
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
title: i18n.t('This month'),
|
|
62
|
-
swaps,
|
|
63
|
-
},
|
|
64
|
-
];
|
|
54
|
+
// The number of items presented in each group.
|
|
55
|
+
const swaps = [1, 2];
|
|
56
|
+
const loadingGroups = [swaps, swaps];
|
|
65
57
|
return (
|
|
66
58
|
<>
|
|
67
|
-
{loadingGroups.map((group) =>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
size="
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
))}
|
|
59
|
+
{loadingGroups.map((group, index) => {
|
|
60
|
+
const key = index;
|
|
61
|
+
return (
|
|
62
|
+
<Group key={key}>
|
|
63
|
+
<Time>
|
|
64
|
+
<Skeleton variant="text" width={60} size="small" />
|
|
65
|
+
<Divider size={16} />
|
|
66
|
+
</Time>
|
|
67
|
+
<Divider size={4} />
|
|
68
|
+
<SwapList>
|
|
69
|
+
{group.map((_, index) => {
|
|
70
|
+
const key = index;
|
|
71
|
+
return <SwapListItem isLoading={true} key={key} />;
|
|
72
|
+
})}
|
|
73
|
+
</SwapList>
|
|
74
|
+
</Group>
|
|
75
|
+
);
|
|
76
|
+
})}
|
|
86
77
|
</>
|
|
87
78
|
);
|
|
88
79
|
}
|
|
@@ -111,6 +102,9 @@ export function HistoryGroupedList(props: PropTypes) {
|
|
|
111
102
|
}}
|
|
112
103
|
itemContent={(index, groupIndex) => {
|
|
113
104
|
const swap = swaps[index];
|
|
105
|
+
if (!swap) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
114
108
|
const firstStep = swap.steps[0];
|
|
115
109
|
const lastStep = swap.steps[swap.steps.length - 1];
|
|
116
110
|
return (
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
Typography,
|
|
14
14
|
} from '@rango-dev/ui';
|
|
15
15
|
import BigNumber from 'bignumber.js';
|
|
16
|
-
import React, {
|
|
16
|
+
import React, { useRef, useState } from 'react';
|
|
17
17
|
|
|
18
18
|
import {
|
|
19
19
|
PERCENTAGE_CHANGE_MAX_DECIMALS,
|
|
@@ -42,7 +42,6 @@ import {
|
|
|
42
42
|
basicInfoStyles,
|
|
43
43
|
ContainerInfoOutput,
|
|
44
44
|
Content,
|
|
45
|
-
EXPANDABLE_QUOTE_TRANSITION_DURATION,
|
|
46
45
|
FrameIcon,
|
|
47
46
|
HorizontalSeparator,
|
|
48
47
|
QuoteContainer,
|
|
@@ -69,7 +68,6 @@ export function Quote(props: QuoteProps) {
|
|
|
69
68
|
|
|
70
69
|
const [expanded, setExpanded] = useState(props.expanded);
|
|
71
70
|
const quoteRef = useRef<HTMLButtonElement | null>(null);
|
|
72
|
-
const prevExpanded = useRef(expanded);
|
|
73
71
|
const roundedInput = numberToString(
|
|
74
72
|
input.value,
|
|
75
73
|
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
@@ -263,14 +261,6 @@ export function Quote(props: QuoteProps) {
|
|
|
263
261
|
const steps = getQuoteSteps(quote.result?.swaps ?? []);
|
|
264
262
|
const numberOfSteps = steps.length;
|
|
265
263
|
const tooltipContainer = getContainer();
|
|
266
|
-
useLayoutEffect(() => {
|
|
267
|
-
if (expanded && !prevExpanded.current && quoteRef.current) {
|
|
268
|
-
setTimeout(() => {
|
|
269
|
-
quoteRef?.current?.scrollIntoView({ behavior: 'smooth' });
|
|
270
|
-
}, EXPANDABLE_QUOTE_TRANSITION_DURATION);
|
|
271
|
-
}
|
|
272
|
-
prevExpanded.current = expanded;
|
|
273
|
-
}, [expanded, prevExpanded]);
|
|
274
264
|
|
|
275
265
|
return (
|
|
276
266
|
<>
|