Browse Source

Merge pull request #394 from MortalKastor/auto-update

Auto update polish
master
Thibaut 7 years ago
committed by GitHub
parent
commit
c777fce722
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      electron-builder.yml
  2. 1
      package.json
  3. 33
      src/components/SideBar/Item.js
  4. 8
      src/components/SideBar/index.js
  5. 18
      src/components/UpdateNotifier.js
  6. 16
      src/icons/Update.js
  7. 4
      static/i18n/en/update.yml

2
electron-builder.yml

@ -1,7 +1,5 @@
appId: com.ledger.live appId: com.ledger.live
buildDependenciesFromSource: true
protocols: protocols:
name: Ledger Live name: Ledger Live
schemes: schemes:

1
package.json

@ -92,6 +92,7 @@
"rxjs": "^6.2.0", "rxjs": "^6.2.0",
"rxjs-compat": "^6.1.0", "rxjs-compat": "^6.1.0",
"semaphore": "^1.1.0", "semaphore": "^1.1.0",
"secp256k1": "3.3.1",
"smooth-scrollbar": "^8.2.7", "smooth-scrollbar": "^8.2.7",
"source-map": "0.7.2", "source-map": "0.7.2",
"source-map-support": "^0.5.4", "source-map-support": "^0.5.4",

33
src/components/SideBar/Item.js

@ -32,18 +32,23 @@ const Container = styled(Tabbable).attrs({
ff: 'Open Sans|SemiBold', ff: 'Open Sans|SemiBold',
flow: 3, flow: 3,
horizontal: true, horizontal: true,
px: 3, pl: 3,
})` })`
cursor: pointer; cursor: pointer;
color: ${p => p.theme.colors.dark}; color: ${p => p.theme.colors.dark};
opacity: ${p => (p.isActive ? 1 : 0.4)};
background: ${p => (p.isActive ? p.theme.colors.lightGrey : '')}; background: ${p => (p.isActive ? p.theme.colors.lightGrey : '')};
height: ${p => (p.big ? 50 : 36)}px; height: ${p => (p.big ? 50 : 36)}px;
outline: none; outline: none;
.desaturate {
opacity: ${p => (p.isActive ? 1 : 0.4)};
}
&:hover, &:hover,
&:focus { &:focus {
opacity: 1; .desaturate {
opacity: 1;
}
svg { svg {
color: ${p => p.theme.colors[p.iconActiveColor] || p.iconActiveColor}; color: ${p => p.theme.colors[p.iconActiveColor] || p.iconActiveColor};
@ -51,6 +56,13 @@ const Container = styled(Tabbable).attrs({
} }
` `
const Bullet = styled.div`
background: ${p => p.theme.colors.wallet};
width: 8px;
height: 8px;
border-radius: 100%;
`
type Props = { type Props = {
iconActiveColor?: string, iconActiveColor?: string,
children: string, children: string,
@ -59,6 +71,7 @@ type Props = {
desc?: string | null, desc?: string | null,
icon?: Node | null, icon?: Node | null,
big?: boolean, big?: boolean,
highlight?: boolean,
location: Location, location: Location,
push: Function, push: Function,
openModal: Function, openModal: Function,
@ -75,6 +88,7 @@ function Item({
location, location,
modal, modal,
openModal, openModal,
highlight,
}: Props) { }: Props) {
const { pathname } = location const { pathname } = location
const isActive = linkTo const isActive = linkTo
@ -99,8 +113,12 @@ function Item({
: void 0 : void 0
} }
> >
{icon && <Box color={isActive ? iconActiveColor : void 0}>{icon}</Box>} {icon && (
<Box justifyContent="center"> <Box color={isActive ? iconActiveColor : void 0} className="desaturate">
{icon}
</Box>
)}
<Box justifyContent="center" className="desaturate">
<Text fontSize={4}>{children}</Text> <Text fontSize={4}>{children}</Text>
{desc && ( {desc && (
<Box color="graphite" fontSize={3}> <Box color="graphite" fontSize={3}>
@ -108,6 +126,11 @@ function Item({
</Box> </Box>
)} )}
</Box> </Box>
{highlight && (
<Box flex="1" align="flex-end" pr={2}>
<Bullet />
</Box>
)}
</Container> </Container>
) )
} }

8
src/components/SideBar/index.js

@ -14,6 +14,8 @@ import type { T } from 'types/common'
import { openModal } from 'reducers/modals' import { openModal } from 'reducers/modals'
import { getVisibleAccounts } from 'reducers/accounts' import { getVisibleAccounts } from 'reducers/accounts'
import { getUpdateStatus } from 'reducers/update'
import type { UpdateStatus } from 'reducers/update'
import IconManager from 'icons/Manager' import IconManager from 'icons/Manager'
import IconPieChart from 'icons/PieChart' import IconPieChart from 'icons/PieChart'
@ -56,10 +58,12 @@ type Props = {
t: T, t: T,
accounts: Account[], accounts: Account[],
openModal: Function, openModal: Function,
updateStatus: UpdateStatus,
} }
const mapStateToProps = state => ({ const mapStateToProps = state => ({
accounts: getVisibleAccounts(state), accounts: getVisibleAccounts(state),
updateStatus: getUpdateStatus(state),
}) })
const mapDispatchToProps: Object = { const mapDispatchToProps: Object = {
@ -68,7 +72,7 @@ const mapDispatchToProps: Object = {
class SideBar extends PureComponent<Props> { class SideBar extends PureComponent<Props> {
render() { render() {
const { t, accounts, openModal } = this.props const { t, accounts, openModal, updateStatus } = this.props
return ( return (
<Container bg="white"> <Container bg="white">
@ -76,7 +80,7 @@ class SideBar extends PureComponent<Props> {
<Box flow={4}> <Box flow={4}>
<CapsSubtitle>{t('sidebar:menu')}</CapsSubtitle> <CapsSubtitle>{t('sidebar:menu')}</CapsSubtitle>
<Box px={4} flow={2}> <Box px={4} flow={2}>
<Item icon={<IconPieChart size={16} />} linkTo="/"> <Item icon={<IconPieChart size={16} />} linkTo="/" highlight={updateStatus === 'downloaded'}>
{t('dashboard:title')} {t('dashboard:title')}
</Item> </Item>
<Item icon={<IconSend size={16} />} modal={MODAL_SEND}> <Item icon={<IconSend size={16} />} modal={MODAL_SEND}>

18
src/components/UpdateNotifier.js

@ -16,6 +16,8 @@ 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'
import UpdateIcon from 'icons/Update'
import type { T } from 'types/common' import type { T } from 'types/common'
type Props = { type Props = {
@ -29,7 +31,7 @@ const mapStateToProps = (state: State) => ({
}) })
const Container = styled(Box).attrs({ const Container = styled(Box).attrs({
py: 1, py: '8px',
px: 3, px: 3,
bg: 'wallet', bg: 'wallet',
color: 'white', color: 'white',
@ -40,6 +42,11 @@ const Container = styled(Box).attrs({
border-radius: ${radii[1]}px; border-radius: ${radii[1]}px;
` `
const NotifText = styled(Text).attrs({
ff: 'Open Sans|SemiBold',
fontSize: 4,
})``
class UpdateNotifier extends PureComponent<Props> { class UpdateNotifier extends PureComponent<Props> {
renderStatus() { renderStatus() {
const { updateStatus, t } = this.props const { updateStatus, t } = this.props
@ -53,15 +60,16 @@ class UpdateNotifier extends PureComponent<Props> {
return null return null
case 'downloaded': case 'downloaded':
return ( return (
<Box horizontal flow={2}> <Box horizontal flow={3}>
<Text fontWeight="bold">{t('update:newVersionReady')}</Text> <UpdateIcon size={16} />
<NotifText>{t('update:newVersionReady')}</NotifText>
<Box ml="auto"> <Box ml="auto">
<Text <NotifText
style={{ cursor: 'pointer', textDecoration: 'underline' }} style={{ cursor: 'pointer', textDecoration: 'underline' }}
onClick={() => sendEvent('msg', 'updater.quitAndInstall')} onClick={() => sendEvent('msg', 'updater.quitAndInstall')}
> >
{t('update:relaunch')} {t('update:relaunch')}
</Text> </NotifText>
</Box> </Box>
</Box> </Box>
) )

16
src/icons/Update.js

@ -0,0 +1,16 @@
// @flow
import React from 'react'
const path = (
<path
fill="currentColor"
d="M.583 8a.75.75 0 0 1 1.5 0v4.667c0 .23.187.416.417.416h11c.23 0 .417-.186.417-.416V8a.75.75 0 1 1 1.5 0v4.667a1.917 1.917 0 0 1-1.917 1.916h-11a1.917 1.917 0 0 1-1.917-1.916V8zM7.25 2.167a.75.75 0 1 1 1.5 0V9.75a.75.75 0 1 1-1.5 0V2.167zM9.806 6.84a.75.75 0 1 1 1.061 1.06l-2.333 2.334a.75.75 0 0 1-1.061 0L5.14 7.9A.75.75 0 1 1 6.2 6.84l1.803 1.803L9.806 6.84z"
/>
)
export default ({ size, ...p }: { size: number }) => (
<svg viewBox="0 0 16 16" height={size} width={size} {...p}>
{path}
</svg>
)

4
static/i18n/en/update.yml

@ -1,2 +1,2 @@
newVersionReady: A new version is ready to be installed. newVersionReady: A new update is available.
relaunch: Re-launch app now relaunch: Update now

Loading…
Cancel
Save