Browse Source

Design update of the update notifier banner

master
meriadec 7 years ago
committed by Thibaut Boustany
parent
commit
7db1696d7c
  1. 2
      src/components/DashboardPage/index.js
  2. 32
      src/components/UpdateNotifier.js
  3. 2
      src/components/layout/Default.js

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}>

32
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,13 +55,15 @@ 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>
<Box ml="auto">
<Text <Text
style={{ cursor: 'pointer' }} style={{ cursor: 'pointer', textDecoration: 'underline' }}
onClick={() => sendEvent('msg', 'updater:quitAndInstall')} onClick={() => sendEvent('msg', 'updater:quitAndInstall')}
> >
{t('update:relaunch')} {t('update:relaunch')}
</Text> </Text>
</Box> </Box>
</Box>
) )
default: default:
return null return null
@ -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} />

Loading…
Cancel
Save