-
Notifications
You must be signed in to change notification settings - Fork 25
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
add Blockaid announcement modal #1465
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
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
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
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
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
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
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
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -329,7 +329,6 @@ export const ScamAssetWarning = ({ | |
const { t } = useTranslation(); | ||
const dispatch: AppDispatch = useDispatch(); | ||
const warningRef = useRef<HTMLDivElement>(null); | ||
const { isValidatingSafeAssetsEnabled } = useSelector(settingsSelector); | ||
const { recommendedFee } = useNetworkFees(); | ||
const networkDetails = useSelector(settingsNetworkDetailsSelector); | ||
const publicKey = useSelector(publicKeySelector); | ||
|
@@ -446,7 +445,7 @@ export const ScamAssetWarning = ({ | |
)} | ||
</div> | ||
<div className="ScamAssetWarning__btns"> | ||
{!isValidatingSafeAssetsEnabled && !isSendWarning && ( | ||
{!isSendWarning && ( | ||
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. sorry for another slightly unrelated change - but product says that a blockaid warning should not block the ability to sign something |
||
<Button | ||
data-testid="ScamAsset__add-asset" | ||
size="md" | ||
|
@@ -468,7 +467,7 @@ export const ScamAssetWarning = ({ | |
type="button" | ||
onClick={closeOverlay} | ||
> | ||
{isValidatingSafeAssetsEnabled ? t("Got it") : t("Cancel")} | ||
{t("Cancel")} | ||
</Button> | ||
{isSendWarning && ( | ||
<Button | ||
|
92 changes: 92 additions & 0 deletions
92
extension/src/popup/components/account/BlockaidAnnouncement/index.tsx
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 |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import React from "react"; | ||
import { useDispatch, useSelector } from "react-redux"; | ||
import { useTranslation } from "react-i18next"; | ||
import { Button, Icon, Paragraph } from "@stellar/design-system"; | ||
|
||
import { AppDispatch } from "popup/App"; | ||
|
||
import { LoadingBackground } from "popup/basics/LoadingBackground"; | ||
import { | ||
settingsSelector, | ||
saveIsBlockaidAnnounced, | ||
} from "popup/ducks/settings"; | ||
import { openTab } from "popup/helpers/navigate"; | ||
|
||
import BlockaidLogo from "popup/assets/blockaid-logo.svg"; | ||
|
||
import "./styles.scss"; | ||
|
||
export const BlockaidAnnouncement = () => { | ||
const { t } = useTranslation(); | ||
const dispatch: AppDispatch = useDispatch(); | ||
const { isBlockaidAnnounced } = useSelector(settingsSelector); | ||
|
||
const handleLearnMore = () => { | ||
openTab("https://blockaid.io"); | ||
}; | ||
|
||
const handleCloseModal = () => { | ||
dispatch(saveIsBlockaidAnnounced({ isBlockaidAnnounced: true })); | ||
}; | ||
|
||
return isBlockaidAnnounced ? null : ( | ||
<> | ||
<LoadingBackground isActive /> | ||
<div className="BlockaidAnnouncement"> | ||
<div className="BlockaidAnnouncement__modal"> | ||
<div className="BlockaidAnnouncement__modal__title"> | ||
<div>{t("Freighter is adding a new layer of protection")}</div> | ||
<div className="BlockaidAnnouncement__modal__close"> | ||
<Icon.Close onClick={handleCloseModal} /> | ||
</div> | ||
</div> | ||
<div className="BlockaidAnnouncement__modal__image"> | ||
<img src={BlockaidLogo} alt="Blockaid Logo" /> | ||
</div> | ||
<div className="BlockaidAnnouncement__modal__description"> | ||
<Paragraph size="sm"> | ||
{t("Freighter now uses Blockaid to keep your accounts safer.")} | ||
</Paragraph> | ||
<Paragraph size="sm">{t("By default it will verify:")}</Paragraph> | ||
</div> | ||
<div className="BlockaidAnnouncement__modal__list"> | ||
<ul> | ||
<li>{t("The domains you interact with")}</li> | ||
<li>{t("The assets you interact with")}</li> | ||
<li>{t("The accounts you interact with")}</li> | ||
<li> | ||
{t( | ||
"The operations and functions executed in transactions and smart contracts", | ||
)} | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
<div className="BlockaidAnnouncement__modal__buttons"> | ||
<Button | ||
size="md" | ||
isFullWidth | ||
variant="secondary" | ||
type="button" | ||
onClick={handleLearnMore} | ||
icon={<Icon.ExternalLink />} | ||
iconPosition="right" | ||
> | ||
{t("Learn more")} | ||
</Button> | ||
<Button | ||
data-testid="BlockaidAnnouncement__accept" | ||
size="md" | ||
variant="primary" | ||
isFullWidth | ||
type="button" | ||
onClick={handleCloseModal} | ||
> | ||
{t("Got it")} | ||
</Button> | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
}; |
50 changes: 50 additions & 0 deletions
50
extension/src/popup/components/account/BlockaidAnnouncement/styles.scss
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
.BlockaidAnnouncement { | ||
height: 100%; | ||
width: 100%; | ||
position: absolute; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
|
||
&__modal { | ||
background: var(--color-gray-10); | ||
border-radius: 0.5rem; | ||
border: 1px solid var(--color-gray-40); | ||
padding: 1rem; | ||
width: 312px; | ||
z-index: 2; | ||
|
||
&__title { | ||
display: flex; | ||
line-height: 1.5rem; | ||
margin-bottom: 1.5rem; | ||
} | ||
|
||
&__close { | ||
cursor: pointer; | ||
} | ||
|
||
&__image { | ||
margin-bottom: 0.5rem; | ||
} | ||
|
||
&__description { | ||
color: var(--color-gray-70); | ||
} | ||
|
||
&__list { | ||
color: var(--color-gray-70); | ||
|
||
ul { | ||
font-size: 0.875rem !important; | ||
margin-left: 1rem !important; | ||
} | ||
} | ||
|
||
&__buttons { | ||
display: flex; | ||
column-gap: 1rem; | ||
margin-top: 1rem; | ||
} | ||
} | ||
} |
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.
unrelated - but noticed this errant console.log