mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Replacing deprecated constants and components (#19718)
* Replacing deprecated constants and components * updating button component * updating snapshot * more snapshot updates * suggested changes * Fixing e2e tests * Updating deprecated components * More updates to style and layout --------- Co-authored-by: George Marshall <george.marshall@consensys.net> Co-authored-by: Garrett Bear <gwhisten@gmail.com>
This commit is contained in:
parent
52c44924e3
commit
66b4d7c9fb
@ -1,25 +1,17 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import Button from '../button';
|
|
||||||
import { useI18nContext } from '../../../hooks/useI18nContext';
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||||
import {
|
import { Severity } from '../../../helpers/constants/design-system';
|
||||||
DISPLAY,
|
|
||||||
JustifyContent,
|
|
||||||
TextVariant,
|
|
||||||
Color,
|
|
||||||
} from '../../../helpers/constants/design-system';
|
|
||||||
import Box from '../box/box';
|
|
||||||
import ActionableMessage from '../actionable-message/actionable-message';
|
|
||||||
import { getCurrentChainId } from '../../../selectors';
|
import { getCurrentChainId } from '../../../selectors';
|
||||||
import { getCompletedOnboarding } from '../../../ducks/metamask/metamask';
|
import { getCompletedOnboarding } from '../../../ducks/metamask/metamask';
|
||||||
import { Icon, IconName, IconSize, Text } from '../../component-library';
|
import { BannerAlert, BUTTON_VARIANT } from '../../component-library';
|
||||||
|
|
||||||
export default function DeprecatedTestNetworks() {
|
export default function DeprecatedTestNetworks() {
|
||||||
const currentChainID = useSelector(getCurrentChainId);
|
const currentChainID = useSelector(getCurrentChainId);
|
||||||
const [isShowingWarning, setIsShowingWarning] = useState(false);
|
const [isShowingWarning, setIsShowingWarning] = useState(false);
|
||||||
const completedOnboarding = useSelector(getCompletedOnboarding);
|
const completedOnboarding = useSelector(getCompletedOnboarding);
|
||||||
const t = useI18nContext();
|
const t = useI18nContext();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
completedOnboarding &&
|
completedOnboarding &&
|
||||||
@ -35,48 +27,19 @@ export default function DeprecatedTestNetworks() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
isShowingWarning && (
|
isShowingWarning && (
|
||||||
<ActionableMessage
|
<BannerAlert
|
||||||
type="warning"
|
severity={Severity.Warning}
|
||||||
className="deprecated-test-networks"
|
className="deprecated-test-networks"
|
||||||
withRightButton
|
description={t('deprecatedTestNetworksMsg')}
|
||||||
message={
|
onClose={() => setIsShowingWarning(false)}
|
||||||
<Box
|
margin={2}
|
||||||
display={DISPLAY.FLEX}
|
actionButtonLabel={t('deprecatedTestNetworksLink')}
|
||||||
className="deprecated-test-networks__content"
|
actionButtonProps={{
|
||||||
>
|
className: 'deprecated-test-networks__content__inline-link',
|
||||||
<Box marginRight={2} color={Color.warningDefault}>
|
href: 'https://blog.ethereum.org/2022/06/21/testnet-deprecation/',
|
||||||
<Icon name={IconName.Info} size={IconSize.Sm} />
|
variant: BUTTON_VARIANT.LINK,
|
||||||
</Box>
|
externalLink: true,
|
||||||
<Box justifyContent={JustifyContent.spaceBetween}>
|
}}
|
||||||
<Text
|
|
||||||
variant={TextVariant.bodySm}
|
|
||||||
as="h6"
|
|
||||||
marginTop={0}
|
|
||||||
marginBottom={0}
|
|
||||||
>
|
|
||||||
{t('deprecatedTestNetworksMsg')}
|
|
||||||
|
|
||||||
<Button
|
|
||||||
className="deprecated-test-networks__content__inline-link"
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://blog.ethereum.org/2022/06/21/testnet-deprecation/"
|
|
||||||
>
|
|
||||||
{' '}
|
|
||||||
{t('deprecatedTestNetworksLink')}
|
|
||||||
</Button>
|
|
||||||
</Text>
|
|
||||||
|
|
||||||
<Box
|
|
||||||
className="deprecated-test-networks__content__close"
|
|
||||||
marginLeft={2}
|
|
||||||
marginTop={0}
|
|
||||||
color={Color.iconAlternative}
|
|
||||||
onClick={() => setIsShowingWarning(false)}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -1,8 +1,22 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { Provider } from 'react-redux';
|
||||||
|
import testData from '../../../../.storybook/test-data';
|
||||||
|
import configureStore from '../../../store/store';
|
||||||
|
|
||||||
import DeprecatedTestNetworks from './deprecated-test-networks';
|
import DeprecatedTestNetworks from './deprecated-test-networks';
|
||||||
|
|
||||||
|
const store = configureStore({
|
||||||
|
...testData,
|
||||||
|
metamask: {
|
||||||
|
...testData.metamask,
|
||||||
|
completedOnboarding: true,
|
||||||
|
providerConfig: { chainId: '0x3' },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: 'Components/UI/DeprecatedTestNetworks',
|
title: 'Components/UI/DeprecatedTestNetworks',
|
||||||
|
decorators: [(story) => <Provider store={store}>{story()}</Provider>],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DefaultStory = () => <DeprecatedTestNetworks />;
|
export const DefaultStory = () => <DeprecatedTestNetworks />;
|
||||||
|
@ -1,21 +1,5 @@
|
|||||||
.deprecated-test-networks {
|
.deprecated-test-networks {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
margin: 8px;
|
|
||||||
z-index: 1050;
|
z-index: 1050;
|
||||||
|
|
||||||
&__content {
|
|
||||||
&__inline-link {
|
|
||||||
@include H7;
|
|
||||||
|
|
||||||
display: initial;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__close::after {
|
|
||||||
content: '\00D7';
|
|
||||||
font-size: 24px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
.nft-info {
|
|
||||||
&__content {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__button {
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
}
|
|
@ -7,41 +7,38 @@ import {
|
|||||||
TextColor,
|
TextColor,
|
||||||
TextVariant,
|
TextVariant,
|
||||||
} from '../../../helpers/constants/design-system';
|
} from '../../../helpers/constants/design-system';
|
||||||
import Identicon from '../identicon';
|
import {
|
||||||
import { Text, Button, Box, BUTTON_VARIANT } from '../../component-library';
|
Text,
|
||||||
|
Box,
|
||||||
|
ButtonLink,
|
||||||
|
AvatarAccount,
|
||||||
|
AvatarAccountSize,
|
||||||
|
} from '../../component-library';
|
||||||
|
|
||||||
export default function NftInfo({ assetName, tokenAddress, tokenId }) {
|
export default function NftInfo({ assetName, tokenAddress, tokenId }) {
|
||||||
const t = useContext(I18nContext);
|
const t = useContext(I18nContext);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
display={Display.Flex}
|
|
||||||
className="nft-info"
|
className="nft-info"
|
||||||
|
display={Display.Flex}
|
||||||
|
gap={4}
|
||||||
backgroundColor={BackgroundColor.backgroundAlternative}
|
backgroundColor={BackgroundColor.backgroundAlternative}
|
||||||
|
padding={4}
|
||||||
>
|
>
|
||||||
<Box display={Display.Flex} className="nft-info__content">
|
<AvatarAccount address={tokenAddress} size={AvatarAccountSize.Md} />
|
||||||
<Box margin={4}>
|
<div style={{ overflow: 'hidden' }}>
|
||||||
<Identicon address={tokenAddress} diameter={24} />
|
<Text variant={TextVariant.bodySmBold} ellipsis>
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
<Text variant={TextVariant.bodySmBold} as="h6" marginTop={4}>
|
|
||||||
{assetName}
|
{assetName}
|
||||||
</Text>
|
</Text>
|
||||||
<Text
|
<Text
|
||||||
variant={TextVariant.bodySm}
|
variant={TextVariant.bodySm}
|
||||||
as="h6"
|
|
||||||
marginBottom={4}
|
|
||||||
color={TextColor.textAlternative}
|
color={TextColor.textAlternative}
|
||||||
|
ellipsis
|
||||||
>
|
>
|
||||||
{t('tokenId')} #{tokenId}
|
{t('tokenId')} #{tokenId}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</div>
|
||||||
</Box>
|
<ButtonLink marginLeft="auto">{t('view')}</ButtonLink>
|
||||||
<Box marginTop={4} marginRight={4}>
|
|
||||||
<Button className="nft-info__button" variant={BUTTON_VARIANT.LINK}>
|
|
||||||
{t('view')}
|
|
||||||
</Button>
|
|
||||||
</Box>
|
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,6 @@
|
|||||||
@import 'update-nickname-popover/index';
|
@import 'update-nickname-popover/index';
|
||||||
@import 'disclosure/disclosure';
|
@import 'disclosure/disclosure';
|
||||||
@import 'deprecated-test-networks/index.scss';
|
@import 'deprecated-test-networks/index.scss';
|
||||||
@import 'nft-info/index.scss';
|
|
||||||
@import 'nft-collection-image/index';
|
@import 'nft-collection-image/index';
|
||||||
@import '../institutional/custody-labels/index';
|
@import '../institutional/custody-labels/index';
|
||||||
@import '../institutional/note-to-trader/index';
|
@import '../institutional/note-to-trader/index';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user