@rango-dev/ui 0.1.10-next.92 → 0.1.11-next.2

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.
Files changed (96) hide show
  1. package/README.md +1 -181
  2. package/dist/components/Alert/LoadingFailedAlert.d.ts +2 -0
  3. package/dist/components/Alert/NotFoundAlert.d.ts +7 -0
  4. package/dist/components/Alert/index.d.ts +1 -0
  5. package/dist/components/BlockchainSelector/BlockchainSelector.d.ts +1 -1
  6. package/dist/components/Button/Button.d.ts +1 -1
  7. package/dist/components/Divider/Divider.d.ts +6 -0
  8. package/dist/components/Divider/index.d.ts +1 -0
  9. package/dist/components/Header/Header.d.ts +9 -0
  10. package/dist/components/Header/index.d.ts +1 -0
  11. package/dist/components/Icon/ArrowRightIcon.d.ts +3 -0
  12. package/dist/components/Icon/index.d.ts +1 -0
  13. package/dist/components/LiquiditySourceList/LiquiditySourceList.d.ts +3 -1
  14. package/dist/components/LiquiditySourcesSelector/LiquiditySourcesSelector.d.ts +2 -1
  15. package/dist/components/Modal/Modal.d.ts +0 -1
  16. package/dist/components/SelectableWalletList/mock.d.ts +1 -1
  17. package/dist/components/Settings/Settings.d.ts +2 -1
  18. package/dist/components/SwapContainer/SwapContainer.d.ts +1 -0
  19. package/dist/components/SwapDetail/Token.d.ts +16 -0
  20. package/dist/components/TokenList/TokenList.d.ts +2 -2
  21. package/dist/components/TokenSelector/TokenSelector.d.ts +4 -3
  22. package/dist/components/index.d.ts +2 -0
  23. package/dist/containers/ConfirmSwap/ConfirmSwap.d.ts +10 -17
  24. package/dist/containers/ConfirmSwap/ConfirmSwap.stories.d.ts +1 -0
  25. package/dist/containers/ConfirmSwap/mock.d.ts +3 -0
  26. package/dist/containers/History/History.d.ts +6 -1
  27. package/dist/containers/History/index.d.ts +1 -1
  28. package/dist/containers/History/types.d.ts +3 -24
  29. package/dist/containers/SwapHistory/SwapHistory.d.ts +16 -3
  30. package/dist/containers/SwapHistory/SwapMessages.d.ts +17 -0
  31. package/dist/containers/index.d.ts +0 -1
  32. package/dist/helper/index.d.ts +1 -0
  33. package/dist/types/meta.d.ts +1 -0
  34. package/dist/ui.cjs.development.js +1069 -857
  35. package/dist/ui.cjs.development.js.map +1 -1
  36. package/dist/ui.cjs.production.min.js +1 -1
  37. package/dist/ui.cjs.production.min.js.map +1 -1
  38. package/dist/ui.esm.js +1068 -859
  39. package/dist/ui.esm.js.map +1 -1
  40. package/package.json +3 -2
  41. package/src/components/Alert/Alert.tsx +33 -12
  42. package/src/components/Alert/LoadingFailedAlert.tsx +11 -0
  43. package/src/components/Alert/NotFoundAlert.tsx +19 -0
  44. package/src/components/Alert/index.ts +1 -0
  45. package/src/components/BestRoute/mock.ts +10 -0
  46. package/src/components/BlockchainSelector/BlockchainSelector.tsx +13 -19
  47. package/src/components/Button/Button.tsx +2 -1
  48. package/src/components/ConnectWalletsModal/mockData.ts +16 -0
  49. package/src/components/Divider/Divider.tsx +41 -0
  50. package/src/components/Divider/index.ts +1 -0
  51. package/src/components/Header/Header.tsx +39 -0
  52. package/src/components/Header/index.ts +1 -0
  53. package/src/components/Icon/ArrowRightIcon.tsx +31 -0
  54. package/src/components/Icon/index.ts +1 -0
  55. package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +72 -22
  56. package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.tsx +15 -10
  57. package/src/components/Modal/Modal.tsx +1 -6
  58. package/src/components/SecondaryPage/SecondaryPage.tsx +26 -52
  59. package/src/components/SelectableWalletList/SelectableWalletList.tsx +5 -0
  60. package/src/components/SelectableWalletList/mock.ts +4 -3
  61. package/src/components/Settings/Settings.tsx +30 -11
  62. package/src/components/StatusDrawer/StatusDrawer.tsx +1 -0
  63. package/src/components/StepDetail/StepDetail.tsx +1 -0
  64. package/src/components/SwapContainer/SwapContainer.tsx +21 -16
  65. package/src/components/SwapDetail/SwapDetail.tsx +77 -115
  66. package/src/components/SwapDetail/Token.tsx +68 -0
  67. package/src/components/SwapDetail/mock.ts +1 -0
  68. package/src/components/TextField/TextField.tsx +1 -0
  69. package/src/components/TokenList/TokenItem.tsx +4 -1
  70. package/src/components/TokenList/TokenList.tsx +18 -21
  71. package/src/components/TokenSelector/TokenSelector.tsx +38 -25
  72. package/src/components/Wallet/Wallet.tsx +1 -1
  73. package/src/components/index.ts +2 -0
  74. package/src/containers/ConfirmSwap/ConfirmSwap.stories.tsx +11 -2
  75. package/src/containers/ConfirmSwap/ConfirmSwap.tsx +103 -117
  76. package/src/containers/ConfirmSwap/mock.ts +79 -2
  77. package/src/containers/History/History.tsx +57 -38
  78. package/src/containers/History/index.ts +1 -1
  79. package/src/containers/History/mock.ts +1 -0
  80. package/src/containers/History/types.tsx +2 -30
  81. package/src/containers/SwapHistory/SwapHistory.tsx +313 -165
  82. package/src/containers/SwapHistory/SwapMessages.tsx +116 -0
  83. package/src/containers/SwapHistory/mock.ts +1 -0
  84. package/src/containers/index.ts +0 -1
  85. package/src/helper/index.ts +14 -0
  86. package/src/types/meta.ts +2 -0
  87. package/dist/containers/ConfirmWallets/ConfirmWallets.d.ts +0 -16
  88. package/dist/containers/ConfirmWallets/ConfirmWallets.stories.d.ts +0 -6
  89. package/dist/containers/ConfirmWallets/index.d.ts +0 -1
  90. package/dist/containers/ConfirmWallets/mock.d.ts +0 -5
  91. package/dist/helper/swaps.d.ts +0 -5
  92. package/src/containers/ConfirmWallets/ConfirmWallets.stories.tsx +0 -26
  93. package/src/containers/ConfirmWallets/ConfirmWallets.tsx +0 -143
  94. package/src/containers/ConfirmWallets/index.ts +0 -1
  95. package/src/containers/ConfirmWallets/mock.ts +0 -222
  96. package/src/helper/swaps.ts +0 -23
@@ -1,8 +1,7 @@
1
1
  import { CSSProperties } from '@stitches/react';
2
2
  import React from 'react';
3
3
  import { containsText } from '../../helper';
4
- import { styled } from '../../theme';
5
- import { LiquiditySource } from '../../types/meta';
4
+ import { LiquiditySource, LoadingStatus } from '../../types/meta';
6
5
  import { Button } from '../Button';
7
6
  import { LiquiditySourceList } from '../LiquiditySourceList';
8
7
  import { SecondaryPage } from '../SecondaryPage/SecondaryPage';
@@ -21,15 +20,19 @@ export interface PropTypes {
21
20
  onBack?: () => void;
22
21
  hasHeader?: boolean;
23
22
  listContainerStyle?: CSSProperties;
23
+ loadingStatus: LoadingStatus;
24
24
  }
25
- const ActionButton = styled(Button, {
26
- position: 'absolute',
27
- right: 0,
28
- });
29
25
 
30
26
  export function LiquiditySourcesSelector(props: PropTypes) {
31
- const { list, onChange, onBack, hasHeader, listContainerStyle, toggleAll } =
32
- props;
27
+ const {
28
+ list,
29
+ onChange,
30
+ onBack,
31
+ hasHeader,
32
+ listContainerStyle,
33
+ toggleAll,
34
+ loadingStatus,
35
+ } = props;
33
36
 
34
37
  return (
35
38
  <SecondaryPage
@@ -37,9 +40,9 @@ export function LiquiditySourcesSelector(props: PropTypes) {
37
40
  textFieldPlaceholder="Search By Name"
38
41
  title="Liquidity Sources"
39
42
  TopButton={
40
- <ActionButton variant="ghost" type="primary" onClick={toggleAll}>
43
+ <Button variant="ghost" type="primary" onClick={toggleAll}>
41
44
  {list.find((item) => item.selected) ? 'Deselect all' : 'Select all'}
42
- </ActionButton>
45
+ </Button>
43
46
  }
44
47
  hasHeader={hasHeader}
45
48
  onBack={onBack}
@@ -49,6 +52,8 @@ export function LiquiditySourcesSelector(props: PropTypes) {
49
52
  listContainerStyle={listContainerStyle}
50
53
  list={filterLiquiditySources(list, searchedFor)}
51
54
  onChange={onChange}
55
+ loadingStatus={loadingStatus}
56
+ searchedFor={searchedFor}
52
57
  />
53
58
  )}
54
59
  </SecondaryPage>
@@ -12,7 +12,6 @@ export interface PropTypes {
12
12
  content: React.ReactNode;
13
13
  action?: React.ReactNode;
14
14
  containerStyle?: CSSProperties;
15
- contentStyle?: CSSProperties;
16
15
  }
17
16
 
18
17
  const BackDrop = styled('div', {
@@ -48,7 +47,6 @@ const ModalHeader = styled('div', {
48
47
  marginBottom: '$16',
49
48
  });
50
49
 
51
- const ContentContainer = styled('div', {});
52
50
 
53
51
  export function Modal(props: PropTypes) {
54
52
  const {
@@ -58,7 +56,6 @@ export function Modal(props: PropTypes) {
58
56
  onClose,
59
57
  containerStyle,
60
58
  action,
61
- contentStyle,
62
59
  } = props;
63
60
 
64
61
  const handleBackDropClick = (event: React.MouseEvent<HTMLDivElement>) => {
@@ -81,9 +78,7 @@ export function Modal(props: PropTypes) {
81
78
  <CloseIcon size={24} onClick={onClose} />
82
79
  </Row>
83
80
  </ModalHeader>
84
- <ContentContainer style={contentStyle}>
85
- {content}
86
- </ContentContainer>
81
+ {content}
87
82
  </ModalContainer>
88
83
  </BackDrop>,
89
84
  document.body
@@ -1,8 +1,9 @@
1
1
  import React, { ReactNode, useState } from 'react';
2
2
  import { styled } from '../../theme';
3
- import { AngleLeftIcon, SearchIcon } from '../Icon';
4
- import { TextField } from '../TextField/TextField';
5
- import { Typography } from '../Typography';
3
+ import { Divider } from '../Divider';
4
+ import { Header } from '../Header';
5
+ import { SearchIcon } from '../Icon';
6
+ import { TextField } from '../TextField';
6
7
 
7
8
  export type PropTypes = (
8
9
  | {
@@ -22,40 +23,16 @@ export type PropTypes = (
22
23
  hasHeader?: boolean;
23
24
  };
24
25
 
25
- const Container = styled('div', {
26
+ const ContentContainer = styled('div', {
27
+ overflow: 'hidden',
26
28
  display: 'flex',
27
29
  flexDirection: 'column',
28
- height: '100%',
29
- width: '100%',
30
- padding: '$12 0',
31
- position: 'relative',
32
-
33
- '@lg': {
34
- padding: '$16 0',
35
- },
36
- });
37
-
38
- const HeaderContainer = styled('div', {
39
- display: 'flex',
40
- justifyContent: 'center',
41
- alignItems: 'center',
42
- marginBottom: '$16',
43
- position: 'relative',
44
- });
45
-
46
- const BackIcon = styled(AngleLeftIcon, {
47
- position: 'absolute',
48
- left: '0',
49
- });
50
- const StyledBackIcon = styled(BackIcon, {
51
- cursor: 'pointer',
30
+ flex: '1',
31
+ padding: '0 $4',
52
32
  });
53
33
 
54
- const ContentContainer = styled('div', {
55
- flex: '1',
56
- overflowY: 'auto',
57
- overflowX: 'hidden',
58
- marginTop: '$16',
34
+ const TextFieldContainer = styled('div', {
35
+ padding: '1px',
59
36
  });
60
37
 
61
38
  export function SecondaryPage(props: PropTypes) {
@@ -63,32 +40,29 @@ export function SecondaryPage(props: PropTypes) {
63
40
  const [searchedFor, setSearchedFor] = useState('');
64
41
 
65
42
  return (
66
- <Container>
43
+ <>
67
44
  {hasHeader && (
68
- <HeaderContainer>
69
- <StyledBackIcon size={24} onClick={onBack} />
70
- <Typography variant="h4">{title}</Typography>
71
- {TopButton}
72
- </HeaderContainer>
45
+ <Header onBack={onBack} title={title || ''} suffix={TopButton} />
73
46
  )}
74
47
 
75
- {props.textField && (
76
- <div>
77
- <TextField
78
- size="large"
79
- prefix={<SearchIcon size={24} />}
80
- placeholder={props.textFieldPlaceholder}
81
- onChange={(event) => setSearchedFor(event.target.value)}
82
- value={searchedFor}
83
- autoFocus
84
- />
85
- </div>
86
- )}
87
48
  <ContentContainer>
49
+ {props.textField && (
50
+ <TextFieldContainer>
51
+ <TextField
52
+ size="large"
53
+ prefix={<SearchIcon size={24} />}
54
+ placeholder={props.textFieldPlaceholder}
55
+ onChange={(event) => setSearchedFor(event.target.value)}
56
+ value={searchedFor}
57
+ autoFocus
58
+ />
59
+ <Divider size={16} />
60
+ </TextFieldContainer>
61
+ )}
88
62
  {props.textField && props.children?.(searchedFor)}
89
63
  {!props.textField && props.children}
90
64
  </ContentContainer>
91
65
  {Footer}
92
- </Container>
66
+ </>
93
67
  );
94
68
  }
@@ -2,6 +2,7 @@ import React, { PropsWithChildren, useEffect, useState } from 'react';
2
2
  import { styled } from '../../theme';
3
3
  import { SelectableWallet } from '../../types';
4
4
  import { Typography } from '../Typography';
5
+ import { getConciseAddress } from '../../helper';
5
6
 
6
7
  const Row = styled('div', {
7
8
  display: 'flex',
@@ -69,6 +70,7 @@ const Container = styled('div', {
69
70
  },
70
71
  },
71
72
  });
73
+
72
74
  export interface PropTypes {
73
75
  list: SelectableWallet[];
74
76
  onChange: (w: SelectableWallet) => void;
@@ -102,6 +104,9 @@ export function SelectableWalletList({
102
104
  >
103
105
  <img src={w.image} alt={w.walletType} width={24} height={24} />
104
106
  <Typography variant="body2">{w.name}</Typography>
107
+ <Typography variant="caption">
108
+ {getConciseAddress(w.address)}
109
+ </Typography>
105
110
  <Circle checked={checked}>
106
111
  <SolidCircle checked={checked} />
107
112
  </Circle>
@@ -1,9 +1,10 @@
1
- import { WalletType } from '@rango-dev/wallets-shared';
2
- import { SelectableWallet } from '../../containers/ConfirmWallets/types';
1
+ import { Network, WalletType } from '@rango-dev/wallets-shared';
2
+ import { SelectableWallet } from '../../types';
3
3
 
4
4
  export const data: SelectableWallet[] = [
5
5
  {
6
- blockchain: 'BSC',
6
+ chain: Network.BTC,
7
+ name: Network.BTC,
7
8
  walletType: WalletType.META_MASK,
8
9
  address: '0x5423e28219d6d568dcf62a8134d623e6f4a1c2df',
9
10
  image: 'https://app.rango.exchange/wallets/metamask.svg',
@@ -4,10 +4,11 @@ import { AngleRightIcon } from '../Icon';
4
4
  import { SecondaryPage } from '../SecondaryPage/SecondaryPage';
5
5
  import { Typography } from '../Typography';
6
6
  import { Chip } from '../Chip';
7
- import { LiquiditySource } from '../../types/meta';
7
+ import { LiquiditySource, LoadingStatus } from '../../types/meta';
8
8
  import { TextField } from '../TextField';
9
9
  import { Radio } from '../Radio';
10
10
  import { Switch } from '../Switch';
11
+ import { Button } from '../Button';
11
12
 
12
13
  const BaseContainer = styled('div', {
13
14
  borderRadius: '$5',
@@ -71,6 +72,7 @@ export interface PropTypes {
71
72
  onBack: () => void;
72
73
  infiniteApprove: boolean;
73
74
  toggleInfiniteApprove: (infinite: boolean) => void;
75
+ loadingStatus: LoadingStatus;
74
76
  }
75
77
 
76
78
  export function Settings(props: PropTypes) {
@@ -89,6 +91,7 @@ export function Settings(props: PropTypes) {
89
91
  onThemeChange,
90
92
  toggleInfiniteApprove,
91
93
  infiniteApprove,
94
+ loadingStatus,
92
95
  } = props;
93
96
 
94
97
  const [selectedSlippage, setSelectedSlippage] = useState(
@@ -167,16 +170,32 @@ export function Settings(props: PropTypes) {
167
170
  <Typography variant="body1">Infinite Approval</Typography>
168
171
  <Switch checked={infiniteApprove} onChange={toggleInfiniteApprove} />
169
172
  </InfiniteContainer>
170
- <LiquiditySourceContainer onClick={onLiquiditySourcesClick}>
171
- <Typography variant="body1">Liquidity Sources</Typography>
172
- <LiquiditySourceNumber>
173
- <Typography variant="body2" color="neutrals800">
174
- {liquiditySources.length !== selectedLiquiditySources.length
175
- ? `${selectedLiquiditySources.length} / ${liquiditySources.length}`
176
- : liquiditySources.length}
177
- </Typography>
178
- <StyledAngleRight />
179
- </LiquiditySourceNumber>
173
+ <LiquiditySourceContainer>
174
+ <Button
175
+ onClick={onLiquiditySourcesClick}
176
+ align="start"
177
+ variant="ghost"
178
+ loading={loadingStatus === 'loading'}
179
+ suffix={
180
+ <LiquiditySourceNumber>
181
+ {loadingStatus === 'success' && (
182
+ <Typography variant="body2" color="neutrals800">
183
+ {liquiditySources.length !== selectedLiquiditySources.length
184
+ ? `${selectedLiquiditySources.length} / ${liquiditySources.length}`
185
+ : liquiditySources.length}
186
+ </Typography>
187
+ )}
188
+ {loadingStatus === 'failed' && (
189
+ <Typography variant="body2" color="$error500">
190
+ Loading failed
191
+ </Typography>
192
+ )}
193
+ <StyledAngleRight />
194
+ </LiquiditySourceNumber>
195
+ }
196
+ >
197
+ <Typography variant="body1">Liquidity Sources</Typography>
198
+ </Button>
180
199
  </LiquiditySourceContainer>
181
200
  </>
182
201
  );
@@ -37,6 +37,7 @@ export function StatusDrawer({
37
37
  }: PropTypes) {
38
38
  return (
39
39
  <Drawer
40
+ container={document.body}
40
41
  content={
41
42
  <>
42
43
  <Header>
@@ -69,6 +69,7 @@ const Detail = styled('div', {
69
69
  });
70
70
  const SubTitle = styled(Typography, {
71
71
  color: '$neutrals600',
72
+ display: 'block',
72
73
  });
73
74
  export interface PropTypes {
74
75
  logo: string;
@@ -3,36 +3,41 @@ import React, { PropsWithChildren } from 'react';
3
3
  import { styled } from '../../theme';
4
4
 
5
5
  const MainContainer = styled('div', {
6
+ position: 'relative',
7
+ display: 'flex',
8
+ flexDirection: 'column',
6
9
  borderRadius: '$10',
7
- maxWidth: '512px',
8
10
  boxShadow: '$s',
9
- minWidth: '375px',
10
11
  width: '100%',
11
- backgroundColor: '$background',
12
- height: 'fit-content',
13
- display: 'flex',
14
- flexDirection: 'column',
15
- alignItems: 'end',
12
+ minWidth: '375px',
13
+ maxWidth: '512px',
14
+ maxHeight: '595px',
16
15
  padding: '$16',
17
16
  boxSizing: 'border-box',
18
- position: 'relative',
19
- });
20
-
21
- const ContentContainer = styled('div', {
22
- width: '100%',
23
- // maxHeight: '600px',
17
+ backgroundColor: '$background',
18
+ variants: {
19
+ fixedHeight: {
20
+ true: {
21
+ height: '595px',
22
+ },
23
+ false: {
24
+ height: 'auto',
25
+ },
26
+ },
27
+ },
24
28
  });
25
29
 
26
30
  export interface PropTypes {
27
31
  style?: CSSProperties;
32
+ fixedHeight?: boolean;
28
33
  }
29
34
 
30
35
  export function SwapContainer(props: PropsWithChildren<PropTypes>) {
31
- const { children, style } = props;
36
+ const { children, style, fixedHeight = true } = props;
32
37
 
33
38
  return (
34
- <MainContainer style={style} id="swap-box">
35
- <ContentContainer>{children}</ContentContainer>
39
+ <MainContainer style={style} id="swap-box" fixedHeight={fixedHeight}>
40
+ {children}
36
41
  </MainContainer>
37
42
  );
38
43
  }
@@ -2,88 +2,45 @@ import React, { PropsWithChildren } from 'react';
2
2
  import { PendingSwap } from '../../containers/History/types';
3
3
  import { styled } from '../../theme';
4
4
  import { Button } from '../Button';
5
- import { CheckCircleIcon, InfoCircleIcon, TryAgainIcon } from '../Icon';
6
- import { StepDetail } from '../StepDetail';
5
+ import { ArrowRightIcon } from '../Icon';
6
+ import { Spacer } from '../Spacer';
7
+ import { Spinner } from '../Spinner';
8
+ import { Token } from './Token';
7
9
 
8
10
  const Container = styled('div', {
9
11
  position: 'relative',
10
- });
11
-
12
- const ButtonContainer = styled('div', {
13
- paddingTop: '$8',
14
- });
15
- const SwapContainer = styled('div', {
16
12
  display: 'flex',
17
13
  justifyContent: 'space-between',
18
- '@md': {
19
- padding: '$12',
14
+ alignItems: 'center',
15
+ padding: '$16 0',
16
+ borderBottom: '1px solid $neutrals300',
17
+
18
+ '& > .info': {
19
+ display: 'flex',
20
+ alignItems: 'center',
20
21
  },
21
- '&:hover': {
22
- borderColor: '$primary',
22
+
23
+ '.status': {
24
+ textTransform: 'uppercase',
25
+ fontWeight: 'bold',
26
+ fontSize: '$12',
23
27
  },
24
28
 
25
- variants: {
26
- status: {
27
- failed: {
28
- borderColor: '$error',
29
- },
30
- running: {
31
- borderColor: '$neutrals400',
32
- },
33
- success: {
34
- borderColor: '$success',
35
- },
36
- },
29
+ '&.running': {
30
+ color: '$foreground',
37
31
  },
38
- });
39
- const Arrow = styled('div', {
40
- display: 'flex',
41
- justifyContent: 'center',
42
- alignItems: 'center',
43
- });
44
- const Line = styled('div', {
45
- height: '0',
46
- width: '$20',
47
- border: '1px dashed $foreground',
48
- borderRadius: 'inherit',
49
- '@md': {
50
- width: '$36',
32
+ '&.failed,&.success': {
33
+ color: '$neutrals600',
51
34
  },
52
- '@lg': {
53
- width: '$48',
35
+
36
+ '&.failed .status': {
37
+ color: '$error',
54
38
  },
55
- });
56
- const Dot = styled('div', {
57
- width: '$6',
58
- height: '$6',
59
- backgroundColor: '$foreground',
60
- borderRadius: '50%',
61
- '@lg': {
62
- width: '$8',
63
- height: '$8',
39
+ '&.success .status': {
40
+ color: '$success',
64
41
  },
65
42
  });
66
- const ArrowRight = styled('div', {
67
- width: '0px',
68
- height: '0px',
69
- borderTop: '5px solid transparent',
70
- borderBottom: '5px solid transparent',
71
- borderLeft: '5px solid $foreground',
72
- });
73
- const StatusContainer = styled('div', {
74
- position: 'absolute',
75
- right: '-8px',
76
- top: '30%',
77
- background: '$background',
78
- borderRadius: '50%',
79
- display: 'flex',
80
- justifyContent: 'center',
81
43
 
82
- '@md': {
83
- top: '40%',
84
- right: '-8px',
85
- },
86
- });
87
44
  export interface PropTypes {
88
45
  swap: PendingSwap;
89
46
  status: 'running' | 'failed' | 'success';
@@ -99,52 +56,57 @@ export function SwapDetail({
99
56
  const lastStep = swap.steps[swap.steps.length - 1];
100
57
 
101
58
  return (
102
- <Container onClick={onClick.bind(null, swap.requestId)}>
103
- <ButtonContainer>
104
- <Button
105
- variant="outlined"
106
- align="grow"
107
- size="large"
108
- type={
109
- status === 'failed'
110
- ? 'error'
111
- : status === 'success'
112
- ? 'success'
113
- : undefined
114
- }
115
- >
116
- <SwapContainer>
117
- <StepDetail
118
- logo={firstStep.fromLogo}
119
- symbol={firstStep.fromSymbol}
120
- chainLogo={firstStep.fromBlockchainLogo}
121
- blockchain={firstStep.fromBlockchain}
122
- amount={swap.inputAmount}
123
- />
124
- <Arrow>
125
- <Dot />
126
- <Line />
127
- <ArrowRight />
128
- </Arrow>
129
- <StepDetail
130
- logo={lastStep.toLogo}
131
- symbol={lastStep.toSymbol}
132
- chainLogo={lastStep.toBlockchainLogo}
133
- blockchain={lastStep.toBlockchain}
134
- amount={lastStep.outputAmount}
135
- />
136
- </SwapContainer>
137
- </Button>
138
- </ButtonContainer>
139
- <StatusContainer>
140
- {status === 'running' ? (
141
- <TryAgainIcon size={16} />
142
- ) : status === 'failed' ? (
143
- <InfoCircleIcon size={18} color="error" />
144
- ) : (
145
- <CheckCircleIcon size={18} color="success" />
146
- )}
147
- </StatusContainer>
148
- </Container>
59
+ <Button
60
+ variant="ghost"
61
+ size="free"
62
+ fullWidth
63
+ onClick={onClick.bind(null, swap.requestId)}
64
+ >
65
+ <Container className={`${status}`}>
66
+ <div className="info">
67
+ <Token
68
+ data={{
69
+ token: {
70
+ logo: firstStep.fromLogo,
71
+ symbol: firstStep.fromSymbol,
72
+ },
73
+ blockchain: {
74
+ // @ts-ignore
75
+ logo: firstStep.fromBlockchainLogo || '',
76
+ name: firstStep.fromBlockchain,
77
+ },
78
+ amount: swap.inputAmount,
79
+ }}
80
+ />
81
+ <Spacer size={12} />
82
+ <ArrowRightIcon size={12} />
83
+ <Spacer size={12} />
84
+ <Token
85
+ data={{
86
+ token: {
87
+ logo: lastStep.toLogo,
88
+ symbol: lastStep.toSymbol,
89
+ },
90
+ blockchain: {
91
+ // @ts-ignore
92
+ logo: lastStep.toBlockchainLogo,
93
+ name: lastStep.toBlockchain,
94
+ },
95
+ amount:
96
+ lastStep.outputAmount ||
97
+ lastStep.expectedOutputAmountHumanReadable ||
98
+ '',
99
+ }}
100
+ />
101
+ </div>
102
+ <div className={`status`}>
103
+ {status === 'running' ? (
104
+ <Spinner size={24} color="primary" />
105
+ ) : (
106
+ status
107
+ )}
108
+ </div>
109
+ </Container>
110
+ </Button>
149
111
  );
150
112
  }
@@ -0,0 +1,68 @@
1
+ import React from 'react';
2
+ import { styled } from '../../theme';
3
+ import { Spacer } from '../Spacer';
4
+
5
+ const TokenContainer = styled('div', {
6
+ display: 'flex',
7
+ alignItems: 'center',
8
+
9
+ '& .amount': {
10
+ fontWeight: 'bold',
11
+ },
12
+ });
13
+
14
+ const TokenImage = styled('div', {
15
+ position: 'relative',
16
+ width: '$24',
17
+ height: '$24',
18
+
19
+ img: {
20
+ width: '100%',
21
+ display: 'block',
22
+ },
23
+
24
+ '.overlay': {
25
+ position: 'absolute',
26
+ right: -4,
27
+ bottom: -4,
28
+ width: '$16',
29
+ height: '$16',
30
+ padding: '$2',
31
+ borderRadius: '50%',
32
+ backgroundColor: '$background',
33
+ border: '1px solid $neutrals400',
34
+ },
35
+ });
36
+
37
+ interface PropTypes {
38
+ data: {
39
+ token: {
40
+ logo: string;
41
+ symbol: string;
42
+ };
43
+ blockchain: {
44
+ logo: string;
45
+ name: string;
46
+ };
47
+ amount: string;
48
+ };
49
+ }
50
+ export function Token(props: PropTypes) {
51
+ return (
52
+ <TokenContainer>
53
+ <TokenImage>
54
+ <img src={props.data.token.logo} alt="" />
55
+ <div className="overlay">
56
+ <img
57
+ src={props.data.blockchain.logo}
58
+ alt={props.data.blockchain.name}
59
+ />
60
+ </div>
61
+ </TokenImage>
62
+ <Spacer size={8} />
63
+ <span className="amount">{props.data.amount}</span>
64
+ <Spacer size={4} />
65
+ {props.data.token.symbol}
66
+ </TokenContainer>
67
+ );
68
+ }
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  import { RoutingResultType, TransactionType } from 'rango-sdk';
2
3
  import { PendingSwap } from '../../containers/History/types';
3
4