Skip to content

Commit

Permalink
return different send dapp error when mainnet is down (#1503)
Browse files Browse the repository at this point in the history
  • Loading branch information
goosewobbler committed Apr 6, 2023
1 parent 436c76f commit 619baa7
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 48 deletions.
72 changes: 25 additions & 47 deletions app/dapp/App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react'
import Restore from 'react-restore'

import link from '../../resources/link'
import Native from '../../resources/Native'

class App extends React.Component {
Expand All @@ -25,54 +26,41 @@ class App extends React.Component {

const frame = this.store('main.frames', window.frameId)
const currentView = frame.views[frame.currentView] || {}
const currentDapp = currentView.dappId ? this.store('main.dapps', currentView.dappId) : ''

// Hard code send dapp status for now
const sendDapp =
this.store('main.dapps', '0xe8d705c28f65bc3fe10df8b22f9daa265b99d0e1893b2df49fd38120f0410bca') || {}

const mainnet = this.store('main.networks.ethereum.1')
const isMainnetConnected =
mainnet.on && (mainnet.connection.primary.connected || mainnet.connection.secondary.connected)

return (
<div className='splash'>
<Native />
{/* <div className='overlay' /> */}
{/* <div className='mainLeft'>
<div
className='accountTile'
onClick={() => {
link.send('unsetCurrentView')
}}
>
<div className='accountIcon'></div>
</div>
{/* <div className='dappIcons'>
<div className='dappIconsScroll'>
<div className='dappIconsWrap'>
{Object.keys(store('main.dapps')).map((id, index) => {
return <DappTile key={`dapp-${index}`} ens={store('main.dapps', id, 'ens')} />
})}
</div>
</div>
</div>
</div> */}
<div className='main'>
<div className='mainTop' />
{currentDapp ? (
<>
{/* <div
className='mainDappBackground'
style={{
background: currentDapp.colors ? currentDapp.colors.background : 'none'
}}
>
<div className='mainDappBackgroundTop' />
</div> */}
</>
) : !currentView.ready ? (
sendDapp.status === 'failed' ? (
<div className='mainDappLoading'>
<div className='mainDappLoadingText'>{'Send dapp failed to load'}</div>
{!currentView.ready && sendDapp.status === 'failed' ? (
<div className='mainDappLoading'>
<div className='mainDappLoadingText'>
{isMainnetConnected
? 'Send dapp failed to load'
: 'Mainnet connection required to resolve ENS for Send dapp'}
</div>
) : null
{!isMainnetConnected && (
<div
className='mainDappEnableChains'
onClick={() => {
link.send('tray:action', 'navDash', { view: 'chains', data: {} })
setTimeout(() => {
link.send('frame:close')
}, 100)
}}
>
View Chains
</div>
)}
</div>
) : null}
</div>
</div>
Expand All @@ -81,13 +69,3 @@ class App extends React.Component {
}

export default Restore.connect(App)

// <div className='mainApps'>
// {Object.keys(store('main.dapps')).map(id => {
// return (
// <pre>
// {JSON.stringify(store('main.dapps', id), null, 4)}
// </pre>
// )
// })}
// </div>
22 changes: 22 additions & 0 deletions app/dapp/index.styl
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,28 @@ body
100%
transform rotate(360deg)

.mainDappEnableChains
height 40px
margin-top 30px
background var(--ghostA)
border-bottom 2px solid var(--ghostZ)
box-shadow 0px 1px 4px var(--ghostX)
border-radius 15px
box-sizing border-box
cursor pointer
display flex
justify-content center
align-items center
font-size 11px
font-weight 400
letter-spacing 1px
text-transform uppercase
padding 1px 20px 0px 21px

.mainDappEnableChains:hover
background var(--ghostB)
color var(--outerspace)

.mainApps
width 600px
height 300px
Expand Down
2 changes: 1 addition & 1 deletion main/windows/frames/frameInstances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default {
})

frameInstance.loadURL(
isDev ? 'http://localhost:1234/Dapp/index.dev.html' : `file://${process.env.BUNDLE_LOCATION}/dapp.html`
isDev ? 'http://localhost:1234/dapp/index.dev.html' : `file://${process.env.BUNDLE_LOCATION}/dapp.html`
)

frameInstance.on('ready-to-show', () => {
Expand Down

0 comments on commit 619baa7

Please sign in to comment.