Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced ActionableMessage and Deprecated Button #20443

Merged
Changes from 5 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
02a4268
Replaced ActionableMessage and Deprecated Button
pritam1813 Aug 14, 2023
6c9451f
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
georgewrmarshall Aug 15, 2023
3ec12da
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
georgewrmarshall Aug 17, 2023
ff0953c
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
pritam1813 Aug 21, 2023
f5b2770
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
pritam1813 Aug 21, 2023
80c8659
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
pritam1813 Aug 29, 2023
d7957da
Replaced BUTTON_VARIANT with ButtonVariant enum
pritam1813 Aug 29, 2023
9ace2ee
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
pritam1813 Sep 15, 2023
d1112d4
modified button and removed link style
pritam1813 Sep 15, 2023
2c33ce3
removed hardcoded button size value
pritam1813 Sep 15, 2023
d757692
Added back className
pritam1813 Sep 15, 2023
0cb2bd9
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
pritam1813 Sep 15, 2023
05e58f3
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
pritam1813 Oct 18, 2023
d37ea0e
Added Top Margin to the BannerAlert Components
pritam1813 Oct 18, 2023
54f7dac
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
georgewrmarshall Oct 18, 2023
00fd1a3
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
georgewrmarshall Oct 25, 2023
cfafb8f
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
darkwing Dec 4, 2023
c12179b
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
georgewrmarshall Jan 12, 2024
b0e3a79
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
georgewrmarshall Jan 17, 2024
65674cf
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
georgewrmarshall Jan 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ import React, { useCallback, useContext, useEffect, useMemo } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { useHistory } from 'react-router-dom';
import { ethErrors, serializeError } from 'eth-rpc-errors';
import ActionableMessage from '../../components/ui/actionable-message/actionable-message';
import Button from '../../components/ui/button';
import {
BUTTON_VARIANT,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe BUTTON_VARIANT has now been deprecated in favor of the ButtonVariant enum. Could you please replace?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, replaced the enum.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, I am facing this bug #19818, as a result I couldn't update the screenshot. Any suggestion on how to avoid this bug ? I am on Ubuntu.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @kumavis, would it be possible to support @pritam1813 on his lavamoat issue?

BannerAlert,
Button,
} from '../../components/component-library';
import Identicon from '../../components/ui/identicon';
import TokenBalance from '../../components/ui/token-balance';
import { PageContainerFooter } from '../../components/ui/page-container';
Expand All @@ -27,6 +30,7 @@ import {
TokenStandard,
} from '../../../shared/constants/transaction';
import { getSuggestedTokens } from '../../selectors';
import { Severity } from '../../helpers/constants/design-system';

function getTokenName(name, symbol) {
return name === undefined ? symbol : `${name} (${symbol})`;
Expand Down Expand Up @@ -80,13 +84,13 @@ const ConfirmAddSuggestedToken = () => {
const tokens = useSelector(getTokens);
const trackEvent = useContext(MetaMetricsContext);

const knownTokenActionableMessage = useMemo(() => {
const knownTokenBannerAlert = useMemo(() => {
return (
hasDuplicateAddress(suggestedTokens, tokens) && (
<ActionableMessage
message={t('knownTokenWarning', [
<BannerAlert severity={Severity.Warning}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a margin top here

Suggested change
<BannerAlert severity={Severity.Warning}>
<BannerAlert severity={Severity.Warning} marginTop={4}>

{t('knownTokenWarning', [
<Button
type="link"
variant={BUTTON_VARIANT.LINK}
key="confirm-add-suggested-token-duplicate-warning"
className="confirm-add-suggested-token__link"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this class and removed the associated styles

  &__link {
    @include H7;

    display: inline;
    color: var(--color-primary-default);
    padding-left: 0;
  }

from ui/pages/confirm-add-suggested-token/index.scss

We want the link here to be the same size as the body text

Screenshot 2023-08-28 at 5 02 58 PM

rel="noopener noreferrer"
Expand All @@ -96,24 +100,17 @@ const ConfirmAddSuggestedToken = () => {
{t('learnScamRisk')}
</Button>,
])}
type="warning"
withRightButton
useIcon
iconFillColor="#f8c000"
/>
</BannerAlert>
)
);
}, [suggestedTokens, tokens, t]);

const reusedTokenNameActionableMessage = useMemo(() => {
const reusedTokenNameBannerAlert = useMemo(() => {
return (
hasDuplicateSymbolAndDiffAddress(suggestedTokens, tokens) && (
<ActionableMessage
message={t('reusedTokenNameWarning')}
type="warning"
withRightButton
useIcon
iconFillColor="#f8c000"
<BannerAlert
georgewrmarshall marked this conversation as resolved.
Show resolved Hide resolved
severity={Severity.Warning}
description={t('reusedTokenNameWarning')}
/>
)
);
Expand Down Expand Up @@ -174,8 +171,8 @@ const ConfirmAddSuggestedToken = () => {
<div className="page-container__subtitle">
{t('likeToImportTokens')}
</div>
{knownTokenActionableMessage}
{reusedTokenNameActionableMessage}
{knownTokenBannerAlert}
{reusedTokenNameBannerAlert}
</div>
<div className="page-container__content">
<div className="confirm-add-suggested-token">
Expand Down
Loading