@rango-dev/widget-embedded 0.12.1-next.16 → 0.12.1-next.17

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 (27) hide show
  1. package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts +4 -0
  2. package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts.map +1 -0
  3. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts +3 -0
  4. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts.map +1 -0
  5. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +460 -0
  6. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -0
  7. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts +4 -0
  8. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts.map +1 -0
  9. package/dist/components/LoadingSwapDetails/index.d.ts +2 -0
  10. package/dist/components/LoadingSwapDetails/index.d.ts.map +1 -0
  11. package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
  12. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  13. package/dist/components/SwapDetails/SwapDetails.types.d.ts +1 -1
  14. package/dist/components/SwapDetails/SwapDetails.types.d.ts.map +1 -1
  15. package/dist/index.js +1 -1
  16. package/dist/index.js.map +4 -4
  17. package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
  18. package/package.json +1 -1
  19. package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +41 -0
  20. package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +78 -0
  21. package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +53 -0
  22. package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +3 -0
  23. package/src/components/LoadingSwapDetails/index.ts +1 -0
  24. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +47 -11
  25. package/src/components/SwapDetails/SwapDetails.tsx +5 -2
  26. package/src/components/SwapDetails/SwapDetails.types.ts +1 -1
  27. package/src/pages/SwapDetailsPage.tsx +9 -2
@@ -1 +1 @@
1
- {"version":3,"file":"SwapDetailsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SwapDetailsPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,wBAAgB,eAAe,sBA8C9B"}
1
+ {"version":3,"file":"SwapDetailsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SwapDetailsPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,wBAAgB,eAAe,sBAoD9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.12.1-next.16",
3
+ "version": "0.12.1-next.17",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,41 @@
1
+ import type { StepSkeletonPropsTypes } from './LoadingSwapDetails.types';
2
+
3
+ import { ChainToken, Divider, NextIcon, Skeleton } from '@rango-dev/ui';
4
+ import React from 'react';
5
+
6
+ import { StepContainer } from './LoadingSwapDetails.styles';
7
+
8
+ export function LoadingSwapDetailStep(props: StepSkeletonPropsTypes) {
9
+ const { extraInfo } = props;
10
+ return (
11
+ <StepContainer>
12
+ <div className="step-title">
13
+ <Skeleton height={28} width={28} variant="circular" />
14
+ <Divider direction="horizontal" size={8} />
15
+ <Skeleton height={15} width={148} variant="rounded" />
16
+ </div>
17
+ <div className="step-tokens">
18
+ <Divider direction="horizontal" size={20} />
19
+ <div className="step-token-info">
20
+ <ChainToken size="small" loading chainImage="" tokenImage="" />
21
+ <Divider direction="horizontal" size={8} />
22
+ <Skeleton height={12} width={76} variant="rounded" />
23
+ </div>
24
+ <div className="step-icon-container">
25
+ <NextIcon color="gray" size={16} />
26
+ </div>
27
+ <div className="step-token-info">
28
+ <ChainToken size="small" loading chainImage="" tokenImage="" />
29
+ <Divider direction="horizontal" size={8} />
30
+ <Skeleton height={12} width={76} variant="rounded" />
31
+ </div>
32
+ </div>
33
+ {extraInfo && (
34
+ <div className="extra-info">
35
+ <Divider direction="horizontal" size={20} />
36
+ <Skeleton height={22} width={297} variant="rectangular" />
37
+ </div>
38
+ )}
39
+ </StepContainer>
40
+ );
41
+ }
@@ -0,0 +1,78 @@
1
+ import { styled } from '@rango-dev/ui';
2
+
3
+ export const Container = styled('div', {
4
+ width: '100%',
5
+ height: '100%',
6
+ padding: '$0 $20',
7
+
8
+ '.cost': {
9
+ paddingTop: '$15',
10
+ display: 'flex',
11
+ },
12
+
13
+ '.route-summary': {
14
+ padding: '$15 $0',
15
+ },
16
+
17
+ '.route-summary-item': {
18
+ display: 'flex',
19
+ justifyContent: 'space-between',
20
+ alignItems: 'center',
21
+ },
22
+
23
+ '.token-amount': {
24
+ display: 'flex',
25
+ justifyContent: 'space-between',
26
+ alignItems: 'center',
27
+ },
28
+
29
+ '.route-summary-separator': {
30
+ width: '0px',
31
+ height: '$16',
32
+ borderLeft: '1px solid $neutral400',
33
+ marginLeft: '13px',
34
+ },
35
+
36
+ '.swaps-steps': {
37
+ paddingBottom: '$10',
38
+ },
39
+ });
40
+
41
+ export const StepContainer = styled('div', {
42
+ backgroundColor: '$neutral100',
43
+ borderRadius: '$xm',
44
+ padding: '$10 $15',
45
+
46
+ '.step-title': {
47
+ display: 'flex',
48
+ justifyContent: 'start',
49
+ alignItems: 'center',
50
+ },
51
+ '.step-tokens': {
52
+ paddingTop: '$5',
53
+ display: 'flex',
54
+ alignItems: 'center',
55
+ },
56
+ '.step-token-info': {
57
+ display: 'flex',
58
+ alignItems: 'center',
59
+ },
60
+ '.step-icon-container': {
61
+ padding: '$4 $6',
62
+ display: 'flex',
63
+ justifyContent: 'center',
64
+ alignItems: 'center',
65
+ },
66
+
67
+ '.extra-info': {
68
+ display: 'flex',
69
+ paddingTop: '$10',
70
+ paddingBottom: '$5',
71
+ },
72
+ });
73
+ export const StepSeparator = styled('div', {
74
+ width: '0px',
75
+ height: '$20',
76
+ borderLeft: '1px dashed $neutral900',
77
+ marginLeft: '25px',
78
+ });
@@ -0,0 +1,53 @@
1
+ import { i18n } from '@lingui/core';
2
+ import { ChainToken, Divider, Skeleton, Typography } from '@rango-dev/ui';
3
+ import React from 'react';
4
+
5
+ import { Container, StepSeparator } from './LoadingSwapDetails.styles';
6
+ import { LoadingSwapDetailStep } from './LoadingSwapDetailStep';
7
+
8
+ export function LoadingSwapDetails() {
9
+ const routeSummary = (
10
+ <div className="route-summary-item">
11
+ <div className="token-amount">
12
+ <ChainToken loading size="medium" chainImage="" tokenImage="" />
13
+ <Divider size={8} direction="horizontal" />
14
+ <Skeleton height={15} width={148} variant="rounded" />
15
+ </div>
16
+ <Skeleton height={12} width={64} variant="rounded" />
17
+ </div>
18
+ );
19
+
20
+ return (
21
+ <Container>
22
+ <div className="cost">
23
+ <Skeleton width={60} height={10} variant="rounded" />
24
+ <Divider size={4} direction="horizontal" />
25
+ <Skeleton width={60} height={10} variant="rounded" />
26
+ <Divider size={4} direction="horizontal" />
27
+ <Skeleton width={60} height={10} variant="rounded" />
28
+ </div>
29
+
30
+ <div className="route-summary">
31
+ {routeSummary}
32
+ <div className="route-summary-separator"></div>
33
+ {routeSummary}
34
+ </div>
35
+
36
+ <div className="swaps-steps">
37
+ <Typography variant="title" size="small">
38
+ {i18n.t('Swaps steps')}
39
+ </Typography>
40
+ </div>
41
+
42
+ <div className="step-container">
43
+ <LoadingSwapDetailStep extraInfo />
44
+ <StepSeparator />
45
+ <LoadingSwapDetailStep />
46
+ <StepSeparator />
47
+ <LoadingSwapDetailStep />
48
+ <StepSeparator />
49
+ <LoadingSwapDetailStep />
50
+ </div>
51
+ </Container>
52
+ );
53
+ }
@@ -0,0 +1,3 @@
1
+ export interface StepSkeletonPropsTypes {
2
+ extraInfo?: boolean;
3
+ }
@@ -0,0 +1 @@
1
+ export { LoadingSwapDetails } from './LoadingSwapDetails';
@@ -1,33 +1,69 @@
1
1
  import type { SwapDetailsPlaceholderPropTypes } from './SwapDetails.types';
2
2
 
3
3
  import { i18n } from '@lingui/core';
4
- import { NotFound, Spinner } from '@rango-dev/ui';
4
+ import {
5
+ CopyIcon,
6
+ IconButton,
7
+ NotFound,
8
+ Skeleton,
9
+ Typography,
10
+ } from '@rango-dev/ui';
5
11
  import React from 'react';
6
12
 
7
13
  import { navigationRoutes } from '../../constants/navigationRoutes';
8
14
  import { useNavigateBack } from '../../hooks/useNavigateBack';
9
15
  import { SuffixContainer } from '../HeaderButtons/HeaderButtons.styles';
10
16
  import { Layout } from '../Layout';
17
+ import { LoadingSwapDetails } from '../LoadingSwapDetails';
11
18
 
12
- import { LoaderContainer, PlaceholderContainer } from './SwapDetails.styles';
19
+ import {
20
+ Container,
21
+ HeaderDetails,
22
+ PlaceholderContainer,
23
+ } from './SwapDetails.styles';
13
24
 
14
25
  export function SwapDetailsPlaceholder(props: SwapDetailsPlaceholderPropTypes) {
15
- const { requestId, loading } = props;
26
+ const { requestId, showSkeleton } = props;
16
27
  const { navigateBackFrom } = useNavigateBack();
17
28
 
18
29
  return (
19
30
  <Layout
31
+ noPadding
20
32
  header={{
21
33
  title: i18n.t('Swap and Bridge'),
22
34
  onBack: navigateBackFrom.bind(null, navigationRoutes.swapDetails),
23
35
  suffix: <SuffixContainer />,
24
36
  }}>
25
- <PlaceholderContainer>
26
- {loading ? (
27
- <LoaderContainer>
28
- <Spinner size={24} />
29
- </LoaderContainer>
30
- ) : (
37
+ {showSkeleton && (
38
+ <Container>
39
+ <HeaderDetails>
40
+ <div className="row">
41
+ <Typography variant="label" size="large" color="neutral900">
42
+ {`${i18n.t('Request ID')}:`}
43
+ </Typography>
44
+ <div className="request-id">
45
+ <Typography variant="label" size="small" color="neutral900">
46
+ <Skeleton width={60} height={10} variant="rounded" />
47
+ </Typography>
48
+ <IconButton variant="ghost">
49
+ <CopyIcon size={16} color="gray" />
50
+ </IconButton>
51
+ </div>
52
+ </div>
53
+ <div className="row">
54
+ <Typography variant="label" size="large" color="neutral900">
55
+ {`${i18n.t('Created at')}:`}
56
+ </Typography>
57
+ <Typography variant="label" size="small" color="neutral900">
58
+ <Skeleton width={60} height={10} variant="rounded" />
59
+ </Typography>
60
+ </div>
61
+ </HeaderDetails>
62
+ <LoadingSwapDetails />
63
+ </Container>
64
+ )}
65
+ {!showSkeleton && (
66
+ <PlaceholderContainer>
31
67
  <NotFound
32
68
  title={i18n.t('Not found')}
33
69
  description={i18n.t(
@@ -36,8 +72,8 @@ export function SwapDetailsPlaceholder(props: SwapDetailsPlaceholderPropTypes) {
36
72
  { message: 'Swap with request ID = ${requestId} not found.' }
37
73
  )}
38
74
  />
39
- )}
40
- </PlaceholderContainer>
75
+ </PlaceholderContainer>
76
+ )}
41
77
  </Layout>
42
78
  );
43
79
  }
@@ -66,10 +66,8 @@ import {
66
66
  import { Container, HeaderDetails, StepsList } from './SwapDetails.styles';
67
67
 
68
68
  const DEFAULT_CONTENT_PADDING = 20;
69
-
70
69
  export function SwapDetails(props: SwapDetailsProps) {
71
70
  const { swap, requestId, onDelete, onCancel: onCancelProps } = props;
72
- const { tokens } = useMetaStore.use.meta();
73
71
  const { canSwitchNetworkTo, connect, getWalletInfo } = useWallets();
74
72
  const retry = useBestRouteStore.use.retry();
75
73
  const navigate = useNavigate();
@@ -80,6 +78,9 @@ export function SwapDetails(props: SwapDetailsProps) {
80
78
  const [showCompletedModal, setShowCompletedModal] = useState<
81
79
  'success' | 'failed' | null
82
80
  >(null);
81
+ const {
82
+ meta: { tokens },
83
+ } = useMetaStore();
83
84
 
84
85
  usePaddingRight({
85
86
  elementRef: listRef,
@@ -301,6 +302,7 @@ export function SwapDetails(props: SwapDetailsProps) {
301
302
  </Typography>
302
303
  </div>
303
304
  </HeaderDetails>
305
+
304
306
  <div className="output">
305
307
  <RouteCost
306
308
  fee={numberToString(
@@ -388,6 +390,7 @@ export function SwapDetails(props: SwapDetailsProps) {
388
390
  })}
389
391
  </StepsList>
390
392
  </Container>
393
+
391
394
  <SwapDetailsModal
392
395
  state={modalState}
393
396
  onClose={() => setModalState(null)}
@@ -8,5 +8,5 @@ export interface SwapDetailsProps {
8
8
  }
9
9
  export interface SwapDetailsPlaceholderPropTypes {
10
10
  requestId: string;
11
- loading: boolean;
11
+ showSkeleton: boolean;
12
12
  }
@@ -6,6 +6,7 @@ import { SwapDetails } from '../components/SwapDetails';
6
6
  import { SwapDetailsPlaceholder } from '../components/SwapDetails/SwapDetails.Placeholder';
7
7
  import { navigationRoutes } from '../constants/navigationRoutes';
8
8
  import { useNavigateBack } from '../hooks/useNavigateBack';
9
+ import { useMetaStore } from '../store/meta';
9
10
  import { useUiStore } from '../store/ui';
10
11
  import { getPendingSwaps } from '../utils/queue';
11
12
 
@@ -15,6 +16,9 @@ export function SwapDetailsPage() {
15
16
  const pendingSwaps = getPendingSwaps(manager);
16
17
  const requestId = useUiStore.use.selectedSwapRequestId();
17
18
  const { navigateBackFrom } = useNavigateBack();
19
+ const { loadingStatus } = useMetaStore();
20
+
21
+ const showSkeleton = loading || loadingStatus === 'loading';
18
22
 
19
23
  const selectedSwap = pendingSwaps.find(
20
24
  ({ swap }) => swap.requestId === requestId
@@ -41,9 +45,12 @@ export function SwapDetailsPage() {
41
45
  };
42
46
  const swap = selectedSwap?.swap;
43
47
 
44
- if (!swap) {
48
+ if (!swap || showSkeleton) {
45
49
  return (
46
- <SwapDetailsPlaceholder requestId={requestId || ''} loading={loading} />
50
+ <SwapDetailsPlaceholder
51
+ requestId={requestId || ''}
52
+ showSkeleton={showSkeleton}
53
+ />
47
54
  );
48
55
  }
49
56