Browse Source

Drop unused Print and make Onboarding rendering from inside Default

master
Gaëtan Renaudeau 7 years ago
parent
commit
28f377bcb4
  1. 15
      src/components/App.js
  2. 5
      src/components/Onboarding/index.js
  3. 62
      src/components/layout/Default.js
  4. 47
      src/components/layout/Print.js

15
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 = ({
<I18nextProvider i18n={i18n} initialLanguage={language}>
<ThemeProvider theme={theme}>
<ThrowBlock>
<OnboardingOrElse>
<ConnectedRouter history={history}>
<Switch>
<Route path="/print" component={Print} />
<Route component={Default} />
</Switch>
</ConnectedRouter>
</OnboardingOrElse>
<ConnectedRouter history={history}>
<Switch>
<Route component={Default} />
</Switch>
</ConnectedRouter>
</ThrowBlock>
</ThemeProvider>
</I18nextProvider>

5
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<Props> {
return (
<Container>
<TriggerAppReady />
<ExportLogsBtn hookToShortcut />
{step.options.showBreadcrumb && <OnboardingBreadcrumb />}
<StepContainer>
<StepComponent {...stepProps} />

62
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<Props> {
{process.platform === 'darwin' && <AppRegionDrag />}
<ExportLogsBtn hookToShortcut />
<IsUnlocked>
{Object.entries(modals).map(([name, ModalComponent]: [string, any]) => (
<ModalComponent key={name} />
))}
<SyncContinuouslyPendingOperations priority={20} interval={SYNC_PENDING_INTERVAL} />
<div id="sticky-back-to-top-root" />
<Box grow horizontal bg="white">
<SideBar />
<Box shrink grow bg="lightGrey" color="grey" overflow="hidden" relative>
<TopBar />
<Main innerRef={n => (this._scrollContainer = n)} tabIndex={-1}>
<Route path="/" exact component={DashboardPage} />
<Route path="/settings" component={SettingsPage} />
<Route path="/manager" component={ManagerPage} />
<Route path="/exchange" component={ExchangePage} />
<Route path="/account/:id" component={AccountPage} />
</Main>
<OnboardingOrElse>
<IsUnlocked>
{Object.entries(modals).map(([name, ModalComponent]: [string, any]) => (
<ModalComponent key={name} />
))}
<SyncContinuouslyPendingOperations priority={20} interval={SYNC_PENDING_INTERVAL} />
<div id="sticky-back-to-top-root" />
<Box grow horizontal bg="white">
<SideBar />
<Box shrink grow bg="lightGrey" color="grey" overflow="hidden" relative>
<TopBar />
<Main innerRef={n => (this._scrollContainer = n)} tabIndex={-1}>
<Route path="/" exact component={DashboardPage} />
<Route path="/settings" component={SettingsPage} />
<Route path="/manager" component={ManagerPage} />
<Route path="/exchange" component={ExchangePage} />
<Route path="/account/:id" component={AccountPage} />
</Main>
</Box>
</Box>
</Box>
<LibcoreBusyIndicator />
<DeviceBusyIndicator />
<KeyboardContent sequence="BJBJBJ">
<PerfIndicator />
</KeyboardContent>
</IsUnlocked>
<LibcoreBusyIndicator />
<DeviceBusyIndicator />
<KeyboardContent sequence="BJBJBJ">
<PerfIndicator />
</KeyboardContent>
</IsUnlocked>
</OnboardingOrElse>
</Fragment>
)
}

47
src/components/layout/Print.js

@ -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<any> {
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 (
<CurrentAddress
accountName={accountName}
address={address}
amount={amount}
innerRef={n => (this._node = n)}
withQRCode
/>
)
}
}
export default Print
Loading…
Cancel
Save