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 i18n from 'renderer/i18n/electron'
import OnboardingOrElse from 'components/OnboardingOrElse'
import ThrowBlock from 'components/ThrowBlock' import ThrowBlock from 'components/ThrowBlock'
import Default from 'components/layout/Default' import Default from 'components/layout/Default'
import Print from 'components/layout/Print'
import CounterValues from 'helpers/countervalues' import CounterValues from 'helpers/countervalues'
import { BridgeSyncProvider } from 'bridge/BridgeSyncContext' import { BridgeSyncProvider } from 'bridge/BridgeSyncContext'
@ -34,14 +32,11 @@ const App = ({
<I18nextProvider i18n={i18n} initialLanguage={language}> <I18nextProvider i18n={i18n} initialLanguage={language}>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<ThrowBlock> <ThrowBlock>
<OnboardingOrElse> <ConnectedRouter history={history}>
<ConnectedRouter history={history}> <Switch>
<Switch> <Route component={Default} />
<Route path="/print" component={Print} /> </Switch>
<Route component={Default} /> </ConnectedRouter>
</Switch>
</ConnectedRouter>
</OnboardingOrElse>
</ThrowBlock> </ThrowBlock>
</ThemeProvider> </ThemeProvider>
</I18nextProvider> </I18nextProvider>

5
src/components/Onboarding/index.js

@ -25,9 +25,7 @@ import { getCurrentDevice } from 'reducers/devices'
import { unlock } from 'reducers/application' import { unlock } from 'reducers/application'
import ExportLogsBtn from 'components/ExportLogsBtn'
import Box from 'components/base/Box' import Box from 'components/base/Box'
import TriggerAppReady from '../TriggerAppReady'
import Start from './steps/Start' import Start from './steps/Start'
import InitStep from './steps/Init' import InitStep from './steps/Init'
@ -160,9 +158,6 @@ class Onboarding extends PureComponent<Props> {
return ( return (
<Container> <Container>
<TriggerAppReady />
<ExportLogsBtn hookToShortcut />
{step.options.showBreadcrumb && <OnboardingBreadcrumb />} {step.options.showBreadcrumb && <OnboardingBreadcrumb />}
<StepContainer> <StepContainer>
<StepComponent {...stepProps} /> <StepComponent {...stepProps} />

62
src/components/layout/Default.js

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