From 619baa7b4af5b86a7a93c1f04cdab6f299cc33f0 Mon Sep 17 00:00:00 2001 From: goosewobbler <432005+goosewobbler@users.noreply.github.com> Date: Thu, 6 Apr 2023 15:41:18 +0100 Subject: [PATCH] return different send dapp error when mainnet is down (#1503) --- app/dapp/App.js | 72 ++++++++++----------------- app/dapp/index.styl | 22 ++++++++ main/windows/frames/frameInstances.ts | 2 +- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/app/dapp/App.js b/app/dapp/App.js index dedaa8fdc..114c7e64d 100644 --- a/app/dapp/App.js +++ b/app/dapp/App.js @@ -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 { @@ -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 (
- {/*
*/} - {/*
-
{ - link.send('unsetCurrentView') - }} - > -
-
- {/*
-
-
- {Object.keys(store('main.dapps')).map((id, index) => { - return - })} -
-
-
-
*/}
- {currentDapp ? ( - <> - {/*
-
-
*/} - - ) : !currentView.ready ? ( - sendDapp.status === 'failed' ? ( -
-
{'Send dapp failed to load'}
+ {!currentView.ready && sendDapp.status === 'failed' ? ( +
+
+ {isMainnetConnected + ? 'Send dapp failed to load' + : 'Mainnet connection required to resolve ENS for Send dapp'}
- ) : null + {!isMainnetConnected && ( +
{ + link.send('tray:action', 'navDash', { view: 'chains', data: {} }) + setTimeout(() => { + link.send('frame:close') + }, 100) + }} + > + View Chains +
+ )} +
) : null}
@@ -81,13 +69,3 @@ class App extends React.Component { } export default Restore.connect(App) - -//
-// {Object.keys(store('main.dapps')).map(id => { -// return ( -//
-//         {JSON.stringify(store('main.dapps', id), null, 4)}
-//       
-// ) -// })} -//
diff --git a/app/dapp/index.styl b/app/dapp/index.styl index 5dc692a4f..794523033 100644 --- a/app/dapp/index.styl +++ b/app/dapp/index.styl @@ -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 diff --git a/main/windows/frames/frameInstances.ts b/main/windows/frames/frameInstances.ts index 084024f84..3bbd0a3d9 100644 --- a/main/windows/frames/frameInstances.ts +++ b/main/windows/frames/frameInstances.ts @@ -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', () => {