From 28f377bcb462165bb69e2642781726aa6dbad4f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Wed, 4 Jul 2018 19:49:21 +0200 Subject: [PATCH 1/2] Drop unused Print and make Onboarding rendering from inside Default --- src/components/App.js | 15 +++----- src/components/Onboarding/index.js | 5 --- src/components/layout/Default.js | 62 +++++++++++++++--------------- src/components/layout/Print.js | 47 ---------------------- 4 files changed, 37 insertions(+), 92 deletions(-) delete mode 100644 src/components/layout/Print.js diff --git a/src/components/App.js b/src/components/App.js index d3dbd19a..a6b3d186 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -12,10 +12,8 @@ import theme from 'styles/theme' import i18n from 'renderer/i18n/electron' -import OnboardingOrElse from 'components/OnboardingOrElse' import ThrowBlock from 'components/ThrowBlock' import Default from 'components/layout/Default' -import Print from 'components/layout/Print' import CounterValues from 'helpers/countervalues' import { BridgeSyncProvider } from 'bridge/BridgeSyncContext' @@ -34,14 +32,11 @@ const App = ({ - - - - - - - - + + + + + diff --git a/src/components/Onboarding/index.js b/src/components/Onboarding/index.js index 7efec2ae..18a172be 100644 --- a/src/components/Onboarding/index.js +++ b/src/components/Onboarding/index.js @@ -25,9 +25,7 @@ import { getCurrentDevice } from 'reducers/devices' import { unlock } from 'reducers/application' -import ExportLogsBtn from 'components/ExportLogsBtn' import Box from 'components/base/Box' -import TriggerAppReady from '../TriggerAppReady' import Start from './steps/Start' import InitStep from './steps/Init' @@ -160,9 +158,6 @@ class Onboarding extends PureComponent { return ( - - - {step.options.showBreadcrumb && } diff --git a/src/components/layout/Default.js b/src/components/layout/Default.js index e52522b5..4f8bab68 100644 --- a/src/components/layout/Default.js +++ b/src/components/layout/Default.js @@ -24,7 +24,7 @@ import LibcoreBusyIndicator from 'components/LibcoreBusyIndicator' import DeviceBusyIndicator from 'components/DeviceBusyIndicator' import TriggerAppReady from 'components/TriggerAppReady' import ExportLogsBtn from 'components/ExportLogsBtn' - +import OnboardingOrElse from 'components/OnboardingOrElse' import AppRegionDrag from 'components/AppRegionDrag' import IsUnlocked from 'components/IsUnlocked' import SideBar from 'components/MainSideBar' @@ -82,36 +82,38 @@ class Default extends Component { {process.platform === 'darwin' && } - - {Object.entries(modals).map(([name, ModalComponent]: [string, any]) => ( - - ))} - - - -
- - - - - - -
(this._scrollContainer = n)} tabIndex={-1}> - - - - - -
+ + + {Object.entries(modals).map(([name, ModalComponent]: [string, any]) => ( + + ))} + + + +
+ + + + + + +
(this._scrollContainer = n)} tabIndex={-1}> + + + + + +
+
- - - - - - - - + + + + + + + + ) } diff --git a/src/components/layout/Print.js b/src/components/layout/Print.js deleted file mode 100644 index 6051d353..00000000 --- a/src/components/layout/Print.js +++ /dev/null @@ -1,47 +0,0 @@ -// @flow - -import React, { PureComponent } from 'react' -import { remote } from 'electron' -import qs from 'qs' - -import CurrentAddress from 'components/CurrentAddress' - -class Print extends PureComponent { - componentDidMount() { - window.requestAnimationFrame(() => - setTimeout(() => { - if (!this._node) { - return - } - - const { height, width } = this._node.getBoundingClientRect() - const currentWindow = remote.getCurrentWindow() - - currentWindow.setContentSize(width, height) - currentWindow.emit('print-ready') - }, 300), - ) - } - - _node = null - - render() { - const data = qs.parse(this.props.location.search, { ignoreQueryPrefix: true }) - - if (!data) { - return null - } - const { address, amount, accountName } = data - return ( - (this._node = n)} - withQRCode - /> - ) - } -} - -export default Print From 4d4d6ba814590bcf330873ba91c588a7bc4c8d84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Wed, 4 Jul 2018 19:51:18 +0200 Subject: [PATCH 2/2] Add c+r to reload the app --- src/components/layout/Default.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/layout/Default.js b/src/components/layout/Default.js index 4f8bab68..964d7c32 100644 --- a/src/components/layout/Default.js +++ b/src/components/layout/Default.js @@ -1,5 +1,6 @@ // @flow +import { remote } from 'electron' import React, { Fragment, Component } from 'react' import { compose } from 'redux' import styled from 'styled-components' @@ -70,6 +71,8 @@ class Default extends Component { kbShortcut = event => { if (event.ctrlKey && event.key === 'l') { this.props.i18n.reloadResources() + } else if ((event.ctrlKey || event.metaKey) && event.key === 'r') { + remote.getCurrentWindow().webContents.reload() } }