-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
garrettbear
merged 20 commits into
MetaMask:develop
from
pritam1813:part-of-#19528-in-confirm-add-suggested-token
Jan 24, 2024
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 6c9451f
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
georgewrmarshall 3ec12da
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
georgewrmarshall ff0953c
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
pritam1813 f5b2770
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
pritam1813 80c8659
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
pritam1813 d7957da
Replaced BUTTON_VARIANT with ButtonVariant enum
pritam1813 9ace2ee
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
pritam1813 d1112d4
modified button and removed link style
pritam1813 2c33ce3
removed hardcoded button size value
pritam1813 d757692
Added back className
pritam1813 0cb2bd9
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
pritam1813 05e58f3
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
pritam1813 d37ea0e
Added Top Margin to the BannerAlert Components
pritam1813 54f7dac
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
georgewrmarshall 00fd1a3
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
georgewrmarshall cfafb8f
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
darkwing c12179b
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
georgewrmarshall b0e3a79
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
georgewrmarshall 65674cf
Merge branch 'develop' into part-of-#19528-in-confirm-add-suggested-t…
georgewrmarshall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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, | ||||||
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'; | ||||||
|
@@ -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})`; | ||||||
|
@@ -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}> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add a margin top here
Suggested change
|
||||||
{t('knownTokenWarning', [ | ||||||
<Button | ||||||
type="link" | ||||||
variant={BUTTON_VARIANT.LINK} | ||||||
key="confirm-add-suggested-token-duplicate-warning" | ||||||
className="confirm-add-suggested-token__link" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
rel="noopener noreferrer" | ||||||
|
@@ -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')} | ||||||
/> | ||||||
) | ||||||
); | ||||||
|
@@ -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"> | ||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 theButtonVariant
enum. Could you please replace?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, replaced the enum.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?