Browse Source

Merge branch 'master' into getAddressForCurrency

master
Gaëtan Renaudeau 7 years ago
committed by GitHub
parent
commit
3868e9e569
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      README.md
  2. 1
      electron-builder.yml
  3. 4
      package.json
  4. 2
      src/components/DashboardPage/index.js
  5. 1
      src/components/SettingsPage/sections/Display.js
  6. 9
      src/components/TopBar/ActivityIndicator.js
  7. 20
      src/components/TopBar/ItemContainer.js
  8. 31
      src/components/TopBar/index.js
  9. 42
      src/components/UpdateNotifier.js
  10. 2
      src/components/layout/Default.js
  11. 14
      src/main/autoUpdate.js

11
README.md

@ -9,7 +9,16 @@
#### Requirements #### Requirements
Project has been tested under [NodeJS](https://nodejs.org) v9.3.0, with [Yarn](https://yarnpkg.com) v1.3.0 and [Python](https://www.python.org/) v2.7.10 (used by [node-gyp](https://github.com/nodejs/node-gyp) to build native addons). You will also need a C++ compiler. Project has been tested with
- [NodeJS](https://nodejs.org) v9.3.0
- [Yarn](https://yarnpkg.com) v1.3.0
- [Python](https://www.python.org/) v2.7.10 (used by [node-gyp](https://github.com/nodejs/node-gyp) to build native addons)
- You will also need a C++ compiler
#### Optional
- `Museo Sans` font - for Ledger guys, [follow that link](https://drive.google.com/drive/folders/14R6kGFtx53DuqTyIOjnT7BGogzeyMSzN), download `museosans.zip` and extract it inside the `static/fonts/museosans` directory
#### Setup #### Setup

1
electron-builder.yml

@ -16,6 +16,7 @@ mac:
linux: linux:
artifactName: ${name}-${version}-${os}-${arch}.${ext} artifactName: ${name}-${version}-${os}-${arch}.${ext}
category: Finance
target: target:
- target: AppImage - target: AppImage
arch: arch:

4
package.json

@ -3,7 +3,7 @@
"productName": "Ledger Live", "productName": "Ledger Live",
"description": "Ledger Live - Desktop", "description": "Ledger Live - Desktop",
"repository": "https://github.com/LedgerHQ/ledger-live-desktop", "repository": "https://github.com/LedgerHQ/ledger-live-desktop",
"version": "0.1.0", "version": "0.1.0-alpha.1",
"author": "Ledger", "author": "Ledger",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
@ -16,7 +16,7 @@
"postinstall": "bash ./scripts/postinstall.sh", "postinstall": "bash ./scripts/postinstall.sh",
"prettier": "prettier --write \"{src,webpack,.storybook}/**/*.js\"", "prettier": "prettier --write \"{src,webpack,.storybook}/**/*.js\"",
"publish-storybook": "bash ./scripts/publish-storybook.sh", "publish-storybook": "bash ./scripts/publish-storybook.sh",
"release": "build", "release": "yarn compile && build -wml",
"start": "bash ./scripts/start.sh", "start": "bash ./scripts/start.sh",
"storybook": "NODE_ENV=development STORYBOOK_ENV=1 start-storybook -s ./static -p 4444", "storybook": "NODE_ENV=development STORYBOOK_ENV=1 start-storybook -s ./static -p 4444",
"trans": "node scripts/trans" "trans": "node scripts/trans"

2
src/components/DashboardPage/index.js

@ -24,6 +24,7 @@ import { getCounterValueCode, localeSelector } from 'reducers/settings'
import { updateOrderAccounts } from 'actions/accounts' import { updateOrderAccounts } from 'actions/accounts'
import { saveSettings } from 'actions/settings' import { saveSettings } from 'actions/settings'
import UpdateNotifier from 'components/UpdateNotifier'
import BalanceInfos from 'components/BalanceSummary/BalanceInfos' import BalanceInfos from 'components/BalanceSummary/BalanceInfos'
import BalanceSummary from 'components/BalanceSummary' import BalanceSummary from 'components/BalanceSummary'
import Box from 'components/base/Box' import Box from 'components/base/Box'
@ -139,6 +140,7 @@ class DashboardPage extends PureComponent<Props, State> {
return ( return (
<Box flow={7}> <Box flow={7}>
<UpdateNotifier mt={-5} />
<Box horizontal alignItems="flex-end"> <Box horizontal alignItems="flex-end">
<Box grow> <Box grow>
<Text color="dark" ff="Museo Sans" fontSize={7}> <Text color="dark" ff="Museo Sans" fontSize={7}>

1
src/components/SettingsPage/sections/Display.js

@ -165,6 +165,7 @@ class TabProfile extends PureComponent<Props, State> {
<Row title={t('settings:display.region')} desc={t('settings:display.regionDesc')}> <Row title={t('settings:display.region')} desc={t('settings:display.regionDesc')}>
<Select <Select
style={{ minWidth: 250 }} style={{ minWidth: 250 }}
small
onChange={this.handleChangeRegion} onChange={this.handleChangeRegion}
renderSelected={item => item && item.name} renderSelected={item => item && item.name}
value={currentRegion} value={currentRegion}

9
src/components/ActivityIndicator.js → src/components/TopBar/ActivityIndicator.js

@ -3,11 +3,12 @@ import React, { Component } from 'react'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import styled from 'styled-components' import styled from 'styled-components'
import { createStructuredSelector } from 'reselect' import { createStructuredSelector } from 'reselect'
import { globalSyncStateSelector } from 'reducers/bridgeSync' import { globalSyncStateSelector } from 'reducers/bridgeSync'
import { BridgeSyncConsumer } from 'bridge/BridgeSyncContext' import { BridgeSyncConsumer } from 'bridge/BridgeSyncContext'
import CounterValues from 'helpers/countervalues' import CounterValues from 'helpers/countervalues'
import IconActivity from 'icons/Activity' import IconActivity from 'icons/Activity'
import Box from './base/Box' import ItemContainer from './ItemContainer'
const Activity = styled.div` const Activity = styled.div`
background: ${p => background: ${p =>
@ -20,7 +21,7 @@ const Activity = styled.div`
bottom: 20px; bottom: 20px;
height: 4px; height: 4px;
position: absolute; position: absolute;
right: -2px; right: 8px;
width: 4px; width: 4px;
cursor: pointer; cursor: pointer;
` `
@ -31,10 +32,10 @@ class ActivityIndicatorUI extends Component<*> {
render() { render() {
const { pending, error, onClick } = this.props const { pending, error, onClick } = this.props
return ( return (
<Box justifyContent="center" relative cursor="pointer" onClick={onClick}> <ItemContainer relative onClick={onClick}>
<IconActivity size={16} /> <IconActivity size={16} />
<Activity pending={pending} error={error} /> <Activity pending={pending} error={error} />
</Box> </ItemContainer>
) )
} }
} }

20
src/components/TopBar/ItemContainer.js

@ -0,0 +1,20 @@
// @flow
import styled from 'styled-components'
import Box from 'components/base/Box'
export default styled(Box).attrs({
px: 2,
ml: 0,
justifyContent: 'center',
cursor: p => (p.interactive ? 'pointer' : 'default'),
})`
opacity: 0.7;
&:hover {
opacity: ${p => (p.interactive ? 0.85 : 0.7)};
}
&:active {
opacity: ${p => (p.interactive ? 1 : 0.7)};
}
`

31
src/components/TopBar.js → src/components/TopBar/index.js

@ -10,7 +10,7 @@ import { withRouter } from 'react-router'
import type { Location, RouterHistory } from 'react-router' import type { Location, RouterHistory } from 'react-router'
import type { T } from 'types/common' import type { T } from 'types/common'
import { rgba, darken } from 'styles/helpers' import { rgba } from 'styles/helpers'
import { lock } from 'reducers/application' import { lock } from 'reducers/application'
import { hasPassword } from 'reducers/settings' import { hasPassword } from 'reducers/settings'
@ -22,6 +22,7 @@ import Box from 'components/base/Box'
import GlobalSearch from 'components/GlobalSearch' import GlobalSearch from 'components/GlobalSearch'
import ActivityIndicator from './ActivityIndicator' import ActivityIndicator from './ActivityIndicator'
import ItemContainer from './ItemContainer'
const Container = styled(Box).attrs({ const Container = styled(Box).attrs({
px: 6, px: 6,
@ -43,23 +44,13 @@ const Inner = styled(Box).attrs({
` `
const Bar = styled.div` const Bar = styled.div`
margin-left: 5px;
margin-right: 5px;
height: 15px; height: 15px;
width: 1px; width: 1px;
background: ${p => p.theme.colors.fog}; background: ${p => p.theme.colors.fog};
` `
const SettingButtonContainer = styled(Box).attrs({
px: 4,
ml: 0,
justifyContent: 'center',
cursor: 'pointer',
})`
&:hover > * {
color: ${p => darken(p.theme.colors.graphite, 0.15)};
cursor: pointer;
}
`
const mapStateToProps = state => ({ const mapStateToProps = state => ({
hasPassword: hasPassword(state), hasPassword: hasPassword(state),
}) })
@ -93,26 +84,26 @@ class TopBar extends PureComponent<Props> {
return ( return (
<Container bg="lightGrey" color="graphite"> <Container bg="lightGrey" color="graphite">
<Inner> <Inner>
<Box grow horizontal flow={4}> <Box grow horizontal>
<GlobalSearch t={t} isHidden /> <GlobalSearch t={t} isHidden />
<Box justifyContent="center"> <ItemContainer justifyContent="center">
<IconDevices size={16} /> <IconDevices size={16} />
</Box> </ItemContainer>
<ActivityIndicator /> <ActivityIndicator />
<Box justifyContent="center"> <Box justifyContent="center">
<Bar /> <Bar />
</Box> </Box>
<SettingButtonContainer onClick={this.navigateToSettings}> <ItemContainer interactive onClick={this.navigateToSettings}>
<IconSettings size={16} /> <IconSettings size={16} />
</SettingButtonContainer> </ItemContainer>
{hasPassword && ( // FIXME this should be a dedicated component. therefore this component don't need to connect() {hasPassword && ( // FIXME this should be a dedicated component. therefore this component don't need to connect()
<Fragment> <Fragment>
<Box justifyContent="center"> <Box justifyContent="center">
<Bar /> <Bar />
</Box> </Box>
<Box justifyContent="center" onClick={this.handleLock}> <ItemContainer interactive justifyContent="center" onClick={this.handleLock}>
<IconLock size={16} /> <IconLock size={16} />
</Box> </ItemContainer>
</Fragment> </Fragment>
)} )}
</Box> </Box>

42
src/components/UpdateNotifier.js

@ -3,7 +3,6 @@
import React, { PureComponent } from 'react' import React, { PureComponent } from 'react'
import { translate } from 'react-i18next' import { translate } from 'react-i18next'
import { compose } from 'redux' import { compose } from 'redux'
import { Motion, spring } from 'react-motion'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import styled from 'styled-components' import styled from 'styled-components'
@ -12,6 +11,8 @@ import { sendEvent } from 'renderer/events'
import type { State } from 'reducers' import type { State } from 'reducers'
import type { UpdateStatus } from 'reducers/update' import type { UpdateStatus } from 'reducers/update'
import { radii } from 'styles/theme'
import Box from 'components/base/Box' import Box from 'components/base/Box'
import Text from 'components/base/Text' import Text from 'components/base/Text'
@ -28,18 +29,15 @@ const mapStateToProps = (state: State) => ({
}) })
const Container = styled(Box).attrs({ const Container = styled(Box).attrs({
p: 1, py: 1,
px: 3,
bg: 'wallet', bg: 'wallet',
color: 'white', color: 'white',
style: p => ({ style: p => ({
transform: `translate3d(0, ${p.offset}%, 0)`, transform: `translate3d(0, ${p.offset}%, 0)`,
}), }),
})` })`
position: absolute; border-radius: ${radii[1]}px;
top: 0;
left: 0;
right: 0;
z-index: 10;
` `
class UpdateNotifier extends PureComponent<Props> { class UpdateNotifier extends PureComponent<Props> {
@ -57,12 +55,14 @@ class UpdateNotifier extends PureComponent<Props> {
return ( return (
<Box horizontal flow={2}> <Box horizontal flow={2}>
<Text fontWeight="bold">{t('update:newVersionReady')}</Text> <Text fontWeight="bold">{t('update:newVersionReady')}</Text>
<Text <Box ml="auto">
style={{ cursor: 'pointer' }} <Text
onClick={() => sendEvent('msg', 'updater:quitAndInstall')} style={{ cursor: 'pointer', textDecoration: 'underline' }}
> onClick={() => sendEvent('msg', 'updater.quitAndInstall')}
{t('update:relaunch')} >
</Text> {t('update:relaunch')}
</Text>
</Box>
</Box> </Box>
) )
default: default:
@ -71,18 +71,14 @@ class UpdateNotifier extends PureComponent<Props> {
} }
render() { render() {
const { updateStatus } = this.props const { updateStatus, ...props } = this.props
const isToggled = updateStatus === 'downloaded' const isToggled = updateStatus === 'downloaded'
return (
<Motion if (!isToggled) {
style={{ return null
offset: spring(isToggled ? 0 : -100), }
}} return <Container {...props}>{this.renderStatus()}</Container>
>
{m => <Container offset={m.offset}>{this.renderStatus()}</Container>}
</Motion>
)
} }
} }

2
src/components/layout/Default.js

@ -23,7 +23,6 @@ import AppRegionDrag from 'components/AppRegionDrag'
import IsUnlocked from 'components/IsUnlocked' import IsUnlocked from 'components/IsUnlocked'
import SideBar from 'components/SideBar' import SideBar from 'components/SideBar'
import TopBar from 'components/TopBar' import TopBar from 'components/TopBar'
import UpdateNotifier from 'components/UpdateNotifier'
const Container = styled(GrowScroll).attrs({ const Container = styled(GrowScroll).attrs({
p: 6, p: 6,
@ -87,7 +86,6 @@ class Default extends Component<Props> {
<Box shrink grow bg="lightGrey" color="grey" relative> <Box shrink grow bg="lightGrey" color="grey" relative>
<TopBar /> <TopBar />
<UpdateNotifier />
<Container innerRef={n => (this._scrollContainer = n)} onScroll={this.handleScroll}> <Container innerRef={n => (this._scrollContainer = n)} onScroll={this.handleScroll}>
<Route path="/" exact component={DashboardPage} /> <Route path="/" exact component={DashboardPage} />
<Route path="/settings" component={SettingsPage} /> <Route path="/settings" component={SettingsPage} />

14
src/main/autoUpdate.js

@ -1,5 +1,6 @@
// @flow // @flow
import { app, BrowserWindow } from 'electron'
import { autoUpdater } from 'electron-updater' import { autoUpdater } from 'electron-updater'
type SendFunction = (type: string, data: *) => void type SendFunction = (type: string, data: *) => void
@ -16,5 +17,16 @@ export default (notify: SendFunction) => {
} }
export function quitAndInstall() { export function quitAndInstall() {
autoUpdater.quitAndInstall() setImmediate(() => {
const browserWindows = BrowserWindow.getAllWindows()
// Fixes quitAndInstall not quitting on macOS, as suggested on
// https://github.com/electron-userland/electron-builder/issues/1604#issuecomment-306709572
app.removeAllListeners('window-all-closed')
browserWindows.forEach(browserWindow => {
browserWindow.removeAllListeners('close')
})
autoUpdater.quitAndInstall(false)
})
} }

Loading…
Cancel
Save