@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
package/dist/pages/Home.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;AA4BnD,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAEjD,wBAAgB,IAAI,sBAsLnB"}
|
package/dist/types/config.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Language } from '@rango-dev/ui';
|
|
|
2
2
|
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
|
-
export type WidgetVariant = 'default' | '
|
|
5
|
+
export type WidgetVariant = 'default' | 'expanded' | 'full-expanded';
|
|
6
6
|
/**
|
|
7
7
|
* The above type defines a set of optional color properties for a widget.
|
|
8
8
|
* @property {string} background
|
|
@@ -170,7 +170,8 @@ export type Features = Partial<Record<'theme' | 'language' | 'connectWalletButto
|
|
|
170
170
|
* - 'language': Visibility state for the language.
|
|
171
171
|
* - 'experimentalRoute': Enablement state for the experimental route.
|
|
172
172
|
* @property {WidgetVariant} variant
|
|
173
|
-
* If it is
|
|
173
|
+
* If it is expanded, multiple routes will show up on the home page;
|
|
174
|
+
* If it is full-expanded, multiple routes will show up on the home page with full routes;
|
|
174
175
|
* if not, you will need to go to a different page to see the suggested routes.
|
|
175
176
|
*/
|
|
176
177
|
export type WidgetConfig = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot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EAAE,MAAM,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,CAAC,UAAU,GAAG,iBAAiB,CAAC,EAAE,CAAC;IAC7C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB,CAAC"}
|
package/dist/utils/configs.d.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
|
export interface Configs {
|
|
4
4
|
API_KEY: string;
|
|
@@ -19,5 +19,6 @@ export declare const DEFAULT_FONT_FAMILY = "Roboto";
|
|
|
19
19
|
export declare const THEME_CLASS_NAME_PREFIX = "theme-widget";
|
|
20
20
|
export declare const isTokenExcludedInConfig: (token: Token | null, tokensConfig?: TokensConfig) => boolean;
|
|
21
21
|
export declare const isBlockchainExcludedInConfig: (blockchain: BlockchainMeta | null, blockchainsConfig?: string[]) => boolean | null | undefined;
|
|
22
|
+
export declare const isVarianExpandable: (variant?: WidgetVariant) => boolean;
|
|
22
23
|
export {};
|
|
23
24
|
//# sourceMappingURL=configs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../../src/utils/configs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../../src/utils/configs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAM9D,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,KAAK,YAAY,GACb,KAAK,EAAE,GACP;IACE,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B,CAAC;AAMN,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,OAAO,UAE5C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,OAAO,EAAE,KAAK,EAAE,GAAG,OAIxD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,OAAO,WAS9C;AAED,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAEtD,eAAO,MAAM,uBAAuB,UAC3B,KAAK,GAAG,IAAI,iBACJ,YAAY,YAe5B,CAAC;AAEF,eAAO,MAAM,4BAA4B,eAC3B,cAAc,GAAG,IAAI,sBACb,MAAM,EAAE,+BAO7B,CAAC;AAEF,eAAO,MAAM,kBAAkB,aAAc,aAAa,YAEzD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.23.1-next.
|
|
3
|
+
"version": "0.23.1-next.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@rango-dev/queue-manager-core": "^0.26.0",
|
|
26
26
|
"@rango-dev/queue-manager-rango-preset": "^0.28.1-next.3",
|
|
27
27
|
"@rango-dev/queue-manager-react": "^0.26.0",
|
|
28
|
-
"@rango-dev/ui": "^0.29.1-next.
|
|
28
|
+
"@rango-dev/ui": "^0.29.1-next.10",
|
|
29
29
|
"@rango-dev/wallets-react": "^0.14.1-next.1",
|
|
30
30
|
"@rango-dev/wallets-shared": "^0.28.1-next.1",
|
|
31
31
|
"bignumber.js": "^9.1.1",
|
|
@@ -48,4 +48,4 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
}
|
|
51
|
-
}
|
|
51
|
+
}
|
|
@@ -5,6 +5,12 @@ export const HeaderButton = styled(IconButton, {
|
|
|
5
5
|
position: 'relative',
|
|
6
6
|
padding: '0',
|
|
7
7
|
overflow: 'unset',
|
|
8
|
+
'&:hover': {
|
|
9
|
+
backgroundColor: '$info100',
|
|
10
|
+
[`.${darkTheme} &`]: {
|
|
11
|
+
backgroundColor: '$neutral',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
8
14
|
});
|
|
9
15
|
|
|
10
16
|
export const ConnectedIcon = styled('div', {
|
|
@@ -31,7 +37,6 @@ export const SuffixContainer = styled('div', {
|
|
|
31
37
|
|
|
32
38
|
export const NotificationsBadgeContainer = styled('div', {
|
|
33
39
|
position: 'absolute',
|
|
34
|
-
backgroundColor: '$secondary500',
|
|
35
40
|
width: '14px',
|
|
36
41
|
height: '14px',
|
|
37
42
|
display: 'flex',
|
|
@@ -40,6 +45,16 @@ export const NotificationsBadgeContainer = styled('div', {
|
|
|
40
45
|
borderRadius: '7px',
|
|
41
46
|
top: '$0',
|
|
42
47
|
right: '$0',
|
|
48
|
+
variants: {
|
|
49
|
+
isSever: {
|
|
50
|
+
true: {
|
|
51
|
+
backgroundColor: '$error500',
|
|
52
|
+
},
|
|
53
|
+
false: {
|
|
54
|
+
backgroundColor: '$secondary500',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
43
58
|
});
|
|
44
59
|
|
|
45
60
|
export const ProgressIcon = styled('div', {
|
|
@@ -53,3 +68,11 @@ export const ProgressIcon = styled('div', {
|
|
|
53
68
|
},
|
|
54
69
|
},
|
|
55
70
|
});
|
|
71
|
+
|
|
72
|
+
export const InProgressTransactionBadgeContainer = styled('div', {
|
|
73
|
+
position: 'absolute',
|
|
74
|
+
right: '$4',
|
|
75
|
+
top: '$4',
|
|
76
|
+
backgroundColor: '$background',
|
|
77
|
+
borderRadius: '100%',
|
|
78
|
+
});
|
|
@@ -16,6 +16,7 @@ import { isFeatureHidden } from '../../utils/settings';
|
|
|
16
16
|
import { NotificationContent } from '../NotificationContent';
|
|
17
17
|
|
|
18
18
|
import { HeaderButton } from './HeaderButtons.styles';
|
|
19
|
+
import InProgressTransactionBadge from './InProgressTransactionBadge';
|
|
19
20
|
import { RefreshButton } from './RefreshButton';
|
|
20
21
|
import { UnreadNotificationsBadge } from './UnreadNotificationsBadge';
|
|
21
22
|
|
|
@@ -83,6 +84,7 @@ export function HeaderButtons(props: HeaderButtonsPropTypes) {
|
|
|
83
84
|
content={i18n.t('Transactions History')}>
|
|
84
85
|
<HeaderButton size="small" variant="ghost" onClick={onClickHistory}>
|
|
85
86
|
<TransactionIcon size={18} color="black" />
|
|
87
|
+
<InProgressTransactionBadge />
|
|
86
88
|
</HeaderButton>
|
|
87
89
|
</Tooltip>
|
|
88
90
|
)}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PendingSwap } from 'rango-types';
|
|
2
|
+
|
|
3
|
+
import { useManager } from '@rango-dev/queue-manager-react';
|
|
4
|
+
import { InProgressIcon } from '@rango-dev/ui';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { getPendingSwaps } from '../../utils/queue';
|
|
8
|
+
|
|
9
|
+
import { InProgressTransactionBadgeContainer } from './HeaderButtons.styles';
|
|
10
|
+
|
|
11
|
+
const InProgressTransactionBadge = () => {
|
|
12
|
+
const { manager } = useManager();
|
|
13
|
+
const list: PendingSwap[] = getPendingSwaps(manager).map(({ swap }) => swap);
|
|
14
|
+
|
|
15
|
+
if (!list.find((swap) => swap.status === 'running')) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<InProgressTransactionBadgeContainer>
|
|
21
|
+
<InProgressIcon color="info" size={6} />
|
|
22
|
+
</InProgressTransactionBadgeContainer>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default InProgressTransactionBadge;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EventSeverity } from '@rango-dev/queue-manager-rango-preset';
|
|
1
2
|
import { Typography } from '@rango-dev/ui';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
|
|
@@ -8,10 +9,17 @@ import { NotificationsBadgeContainer } from './HeaderButtons.styles';
|
|
|
8
9
|
export function UnreadNotificationsBadge() {
|
|
9
10
|
const { getUnreadNotifications } = useNotificationStore();
|
|
10
11
|
|
|
11
|
-
const
|
|
12
|
+
const notificationsList = getUnreadNotifications();
|
|
13
|
+
|
|
14
|
+
const notificationsCount = notificationsList.length;
|
|
15
|
+
|
|
16
|
+
const hasSeverNotification = !!notificationsList.find(
|
|
17
|
+
(notificationItem) =>
|
|
18
|
+
notificationItem.event.messageSeverity === EventSeverity.WARNING
|
|
19
|
+
);
|
|
12
20
|
|
|
13
21
|
return notificationsCount ? (
|
|
14
|
-
<NotificationsBadgeContainer>
|
|
22
|
+
<NotificationsBadgeContainer isSever={hasSeverNotification}>
|
|
15
23
|
<Typography variant="body" size="xsmall" color="$background">
|
|
16
24
|
{notificationsCount}
|
|
17
25
|
</Typography>
|
|
@@ -9,6 +9,9 @@ import {
|
|
|
9
9
|
type QuoteRequestFailed,
|
|
10
10
|
} from '../../types';
|
|
11
11
|
|
|
12
|
+
const SMALL_NO_ROUTE__ICON_SIZE = 24;
|
|
13
|
+
const LARGE_NO_ROUTE_ICON_SIZE = 60;
|
|
14
|
+
|
|
12
15
|
export function makeInfo(
|
|
13
16
|
error: NoResultError | QuoteRequestFailed | null,
|
|
14
17
|
disabledLiquiditySources: string[],
|
|
@@ -57,3 +60,13 @@ export function makeInfo(
|
|
|
57
60
|
description: errorMessages().noResultError.description,
|
|
58
61
|
};
|
|
59
62
|
}
|
|
63
|
+
|
|
64
|
+
export enum NoRouteIconSize {
|
|
65
|
+
small = SMALL_NO_ROUTE__ICON_SIZE,
|
|
66
|
+
large = LARGE_NO_ROUTE_ICON_SIZE,
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export enum NoRouteTitleSize {
|
|
70
|
+
small = 'small',
|
|
71
|
+
large = 'medium',
|
|
72
|
+
}
|
|
@@ -6,8 +6,26 @@ export const Container = styled('div', {
|
|
|
6
6
|
alignItems: 'center',
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
+
export const ErrorDescription = styled('div', {
|
|
10
|
+
variants: {
|
|
11
|
+
size: {
|
|
12
|
+
small: {},
|
|
13
|
+
large: {
|
|
14
|
+
maxWidth: '316px',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
9
20
|
export const Footer = styled('div', {
|
|
10
|
-
|
|
21
|
+
variants: {
|
|
22
|
+
size: {
|
|
23
|
+
small: {
|
|
24
|
+
width: '100%',
|
|
25
|
+
},
|
|
26
|
+
large: {},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
11
29
|
});
|
|
12
30
|
|
|
13
31
|
export const PrefixIcon = styled('div', {
|
|
@@ -13,16 +13,24 @@ import React from 'react';
|
|
|
13
13
|
import { errorMessages } from '../../constants/errors';
|
|
14
14
|
import { useAppStore } from '../../store/AppStore';
|
|
15
15
|
|
|
16
|
-
import {
|
|
17
|
-
|
|
16
|
+
import {
|
|
17
|
+
makeInfo,
|
|
18
|
+
NoRouteIconSize,
|
|
19
|
+
NoRouteTitleSize,
|
|
20
|
+
} from './NoResult.helpers';
|
|
21
|
+
import {
|
|
22
|
+
Container,
|
|
23
|
+
ErrorDescription,
|
|
24
|
+
Footer,
|
|
25
|
+
PrefixIcon,
|
|
26
|
+
} from './NoResult.styles';
|
|
18
27
|
|
|
19
28
|
export function NoResult(props: PropTypes) {
|
|
20
|
-
const { fetch, error } = props;
|
|
29
|
+
const { fetch, error, size = 'small' } = props;
|
|
21
30
|
const disabledLiquiditySources = useAppStore().getDisabledLiquiditySources();
|
|
22
31
|
const toggleAllLiquiditySources = useAppStore().toggleAllLiquiditySources;
|
|
23
32
|
|
|
24
33
|
const swappers = useAppStore().swappers();
|
|
25
|
-
|
|
26
34
|
const info = makeInfo(
|
|
27
35
|
error,
|
|
28
36
|
disabledLiquiditySources,
|
|
@@ -32,27 +40,30 @@ export function NoResult(props: PropTypes) {
|
|
|
32
40
|
|
|
33
41
|
return (
|
|
34
42
|
<Container>
|
|
35
|
-
<NoRouteIcon size={
|
|
43
|
+
<NoRouteIcon size={NoRouteIconSize[size]} color="gray" />
|
|
36
44
|
<Divider size={4} />
|
|
37
|
-
<Typography variant="title" size=
|
|
45
|
+
<Typography variant="title" size={NoRouteTitleSize[size]}>
|
|
38
46
|
{errorMessages().noResultError.title}
|
|
39
47
|
</Typography>
|
|
48
|
+
{size === 'large' && <Divider size={4} />}
|
|
40
49
|
{!!info.description && (
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
<ErrorDescription size={size}>
|
|
51
|
+
<Typography
|
|
52
|
+
variant="body"
|
|
53
|
+
size="small"
|
|
54
|
+
align="center"
|
|
55
|
+
color="neutral700">
|
|
56
|
+
{info.description}
|
|
57
|
+
</Typography>
|
|
58
|
+
</ErrorDescription>
|
|
48
59
|
)}
|
|
49
|
-
<Divider size={4} />
|
|
60
|
+
<Divider size={size === 'large' ? '24' : '4'} />
|
|
50
61
|
{!!info.alert && (
|
|
51
|
-
<Footer>
|
|
62
|
+
<Footer size={size}>
|
|
52
63
|
<Alert
|
|
53
64
|
type={info.alert.type}
|
|
54
65
|
title={info.alert.text}
|
|
55
|
-
titleAlign={'
|
|
66
|
+
titleAlign={'left'}
|
|
56
67
|
action={
|
|
57
68
|
info.alert.action && (
|
|
58
69
|
<Button
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { styled } from '@rango-dev/ui';
|
|
1
|
+
import { darkTheme, ListItemButton, styled } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
3
|
export const Container = styled('div', {
|
|
4
4
|
padding: '$10',
|
|
@@ -17,6 +17,19 @@ export const List = styled('ul', {
|
|
|
17
17
|
},
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
+
export const ListItem = styled(ListItemButton, {
|
|
21
|
+
variants: {
|
|
22
|
+
actionRequired: {
|
|
23
|
+
true: {
|
|
24
|
+
backgroundColor: '$error300',
|
|
25
|
+
[`.${darkTheme} &`]: {
|
|
26
|
+
backgroundColor: '$error600',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
20
33
|
export const Images = styled('div', {
|
|
21
34
|
display: 'flex',
|
|
22
35
|
padding: 0,
|
|
@@ -5,7 +5,7 @@ import { EventSeverity } from '@rango-dev/queue-manager-rango-preset';
|
|
|
5
5
|
import {
|
|
6
6
|
ChainToken,
|
|
7
7
|
ChevronRightIcon,
|
|
8
|
-
|
|
8
|
+
Divider,
|
|
9
9
|
Typography,
|
|
10
10
|
} from '@rango-dev/ui';
|
|
11
11
|
import React from 'react';
|
|
@@ -16,7 +16,12 @@ import { useAppStore } from '../../store/AppStore';
|
|
|
16
16
|
import { useNotificationStore } from '../../store/notification';
|
|
17
17
|
import { areTokensEqual } from '../../utils/wallets';
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
Container,
|
|
21
|
+
Images,
|
|
22
|
+
List,
|
|
23
|
+
ListItem,
|
|
24
|
+
} from './NotificationContent.styles';
|
|
20
25
|
import { NotificationNotFound } from './NotificationNotFound';
|
|
21
26
|
|
|
22
27
|
const MAX_NOTIFICATIONS_DISPLAYED = 4;
|
|
@@ -41,7 +46,7 @@ export function NotificationContent() {
|
|
|
41
46
|
<Container>
|
|
42
47
|
{sortedNotification.length ? (
|
|
43
48
|
<List>
|
|
44
|
-
{sortedNotification.map((notificationItem) => {
|
|
49
|
+
{sortedNotification.map((notificationItem, index) => {
|
|
45
50
|
const { route, requestId, event } = notificationItem;
|
|
46
51
|
const fromToken = tokens.find((tokenItem) =>
|
|
47
52
|
areTokensEqual(tokenItem, route.from)
|
|
@@ -60,42 +65,47 @@ export function NotificationContent() {
|
|
|
60
65
|
);
|
|
61
66
|
|
|
62
67
|
return (
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
68
|
+
<React.Fragment key={requestId}>
|
|
69
|
+
{index > 0 && <Divider size={4} />}
|
|
70
|
+
<ListItem
|
|
71
|
+
onClick={() => handleOnClick(requestId)}
|
|
72
|
+
actionRequired={
|
|
73
|
+
event.messageSeverity === EventSeverity.WARNING
|
|
74
|
+
}
|
|
75
|
+
title={
|
|
76
|
+
<Typography
|
|
77
|
+
variant="body"
|
|
78
|
+
size="small"
|
|
79
|
+
color={
|
|
80
|
+
event.messageSeverity === EventSeverity.WARNING
|
|
81
|
+
? '$foreground'
|
|
82
|
+
: '$neutral700'
|
|
83
|
+
}>
|
|
84
|
+
{i18n.t(event.message)}
|
|
85
|
+
</Typography>
|
|
86
|
+
}
|
|
87
|
+
id={requestId}
|
|
88
|
+
start={
|
|
89
|
+
<Images>
|
|
90
|
+
<div className="from-chain-token">
|
|
91
|
+
<ChainToken
|
|
92
|
+
tokenImage={fromToken ? fromToken.image : ''}
|
|
93
|
+
chainImage={fromBlockchain ? fromBlockchain.logo : ''}
|
|
94
|
+
size="small"
|
|
95
|
+
/>
|
|
96
|
+
</div>
|
|
97
|
+
<div className="to-chain-token">
|
|
98
|
+
<ChainToken
|
|
99
|
+
tokenImage={toToken ? toToken.image : ''}
|
|
100
|
+
chainImage={toBlockchain ? toBlockchain.logo : ''}
|
|
101
|
+
size="small"
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
</Images>
|
|
105
|
+
}
|
|
106
|
+
end={<ChevronRightIcon size={12} color="gray" />}
|
|
107
|
+
/>
|
|
108
|
+
</React.Fragment>
|
|
99
109
|
);
|
|
100
110
|
})}
|
|
101
111
|
</List>
|