-
-
Notifications
You must be signed in to change notification settings - Fork 347
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
Warn users when using Test Dapp on Mainnet #134
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,3 +41,30 @@ header { | |
#encryptMessageInput { | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.error-div { | ||
margin-bottom: 12px; | ||
} | ||
|
||
.error-message { | ||
min-height: 32px; | ||
border: 1px solid #e88f97; | ||
color: #24292e; | ||
background: #fcf2f3; | ||
border-radius: 8px; | ||
display: flex; | ||
justify-content: flex-start; | ||
align-items: center; | ||
padding: 8px 10px; | ||
} | ||
.error-message-icon { | ||
margin-right: 8px; | ||
flex: 0 0 auto; | ||
} | ||
.error-message-text { | ||
overflow: auto; | ||
} | ||
|
||
.warning-invisible { | ||
display:none; | ||
} | ||
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. nit: could we add a newline at the end of the file here? 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. |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -33,7 +33,17 @@ <h1 id="logo-text" class="text-center"> | |||||
<h3 class="card-title"> | ||||||
Status | ||||||
</h3> | ||||||
|
||||||
<div id="warning" class="row justify-content-center error-div"> | ||||||
<div class="error-message justify-content-center col-xl-4 col-lg-6 col-md-12 col-sm-12 col-12"> | ||||||
<img | ||||||
src="alert-red.svg" | ||||||
alt="" | ||||||
class="error-message-icon | ||||||
" | ||||||
/> | ||||||
<div class="error-message-text">You are using Test Dapp on Mainnet</div> | ||||||
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.
Suggested change
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. |
||||||
</div> | ||||||
</div> | ||||||
<div class="row"> | ||||||
<div class="col-xl-4 col-lg-6 col-md-12 col-sm-12 col-12"> | ||||||
<p class="info-text alert alert-primary"> | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ const { isMetaMaskInstalled } = MetaMaskOnboarding; | |
const networkDiv = document.getElementById('network'); | ||
const chainIdDiv = document.getElementById('chainId'); | ||
const accountsDiv = document.getElementById('accounts'); | ||
const warningDiv = document.getElementById('warning'); | ||
|
||
// Basic Actions Section | ||
const onboardButton = document.getElementById('connectButton'); | ||
|
@@ -1067,6 +1068,12 @@ const initialize = async () => { | |
|
||
function handleNewNetwork(networkId) { | ||
networkDiv.innerHTML = networkId; | ||
|
||
if (networkId === '1') { | ||
warningDiv.classList.remove('warning-invisible'); | ||
} else { | ||
warningDiv.classList.add('warning-invisible'); | ||
} | ||
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. We're trying to avoid using the 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. |
||
} | ||
|
||
async function getNetworkAndChainId() { | ||
|
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.
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.
@ryanml
Resolved - f7844d1