Browse Source

Merge pull request #297 from meriadec/master

A few fixes, before the demo
master
Meriadec Pillet 7 years ago
committed by GitHub
parent
commit
e700dd66f1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/components/ManagerPage/AppsList.js
  2. 4
      src/components/ManagerPage/DeviceInfos.js
  3. 20
      src/components/ManagerPage/index.js
  4. 3
      src/components/SettingsPage/PasswordModal.js
  5. 17
      src/components/modals/AddAccount/index.js

6
src/components/ManagerPage/AppsList.js

@ -39,6 +39,10 @@ type LedgerApp = {
version: string, version: string,
icon: string, icon: string,
app: Object, app: Object,
bolos_version: {
min: number,
max: number,
},
} }
type Props = { type Props = {
@ -120,7 +124,7 @@ class AppsList extends PureComponent<Props, State> {
<List> <List>
{this.state.appsList.map(c => ( {this.state.appsList.map(c => (
<ManagerApp <ManagerApp
key={c.name} key={`${c.name}_${c.version}_${c.bolos_version.min}`}
name={c.name} name={c.name}
version={`Version ${c.version}`} version={`Version ${c.version}`}
icon={ICONS_FALLBACK[c.icon] || c.icon} icon={ICONS_FALLBACK[c.icon] || c.icon}

4
src/components/ManagerPage/DeviceInfos.js

@ -49,6 +49,10 @@ class DeviceInfos extends PureComponent<Props, State> {
const { device } = this.props const { device } = this.props
const { memoryInfos, isLoading } = this.state const { memoryInfos, isLoading } = this.state
if (!device) {
return <Box py={5}>{'You dont have any device connected'}</Box>
}
const title = ( const title = (
<Text> <Text>
{device.manufacturer} {device.manufacturer}

20
src/components/ManagerPage/index.js

@ -9,7 +9,6 @@ import type { Device, T } from 'types/common'
import { getCurrentDevice, getDevices } from 'reducers/devices' import { getCurrentDevice, getDevices } from 'reducers/devices'
import Box from 'components/base/Box'
import Pills from 'components/base/Pills' import Pills from 'components/base/Pills'
import AppsList from './AppsList' import AppsList from './AppsList'
@ -37,6 +36,14 @@ class ManagerPage extends PureComponent<Props, State> {
currentTab: 'apps', currentTab: 'apps',
} }
componentWillReceiveProps(nextProps) {
const { device } = this.props
const { currentTab } = this.state
if (device && !nextProps.device && currentTab === 'device') {
this.setState({ currentTab: 'apps' })
}
}
handleTabChange = t => this.setState({ currentTab: t.value }) handleTabChange = t => this.setState({ currentTab: t.value })
render() { render() {
@ -45,19 +52,18 @@ class ManagerPage extends PureComponent<Props, State> {
const tabs = TABS.map(i => { const tabs = TABS.map(i => {
let label = t(`manager:tabs.${i.key}`) let label = t(`manager:tabs.${i.key}`)
if (i.key === 'device') { if (i.key === 'device') {
if (!device) {
return null
}
label += ` (${nbDevices})` label += ` (${nbDevices})`
} }
return { ...i, label } return { ...i, label }
}) }).filter(Boolean)
return ( return (
<Fragment> <Fragment>
<Pills items={tabs} activeKey={currentTab} onChange={this.handleTabChange} mb={6} /> <Pills items={tabs} activeKey={currentTab} onChange={this.handleTabChange} mb={6} />
{currentTab === 'apps' && <AppsList device={device} />} {currentTab === 'apps' && <AppsList device={device} />}
{currentTab === 'device' && ( {currentTab === 'device' && <DeviceInfos device={device} />}
<Box flow={4}>
<DeviceInfos device={device} />
</Box>
)}
</Fragment> </Fragment>
) )
} }

3
src/components/SettingsPage/PasswordModal.js

@ -94,9 +94,9 @@ class PasswordModal extends PureComponent<Props, State> {
{t('settings:profile.passwordModalPasswordInput')} {t('settings:profile.passwordModalPasswordInput')}
</Label> </Label>
<InputPassword <InputPassword
autoFocus
type="password" type="password"
placeholder={t('settings:profile.passwordModalPasswordInput')} placeholder={t('settings:profile.passwordModalPasswordInput')}
autoFocus
id="password" id="password"
onChange={this.handleInputChange('currentPassword')} onChange={this.handleInputChange('currentPassword')}
value={currentPassword} value={currentPassword}
@ -110,6 +110,7 @@ class PasswordModal extends PureComponent<Props, State> {
</Label> </Label>
)} )}
<InputPassword <InputPassword
autoFocus={!isPasswordEnabled}
placeholder={t('settings:profile.passwordModalNewPasswordInput')} placeholder={t('settings:profile.passwordModalNewPasswordInput')}
id="newPassword" id="newPassword"
onChange={this.handleInputChange('newPassword')} onChange={this.handleInputChange('newPassword')}

17
src/components/modals/AddAccount/index.js

@ -228,21 +228,12 @@ class AddAccountModal extends PureComponent<Props, State> {
handleChangeStatus = (deviceStatus, appStatus) => this.setState({ appStatus }) handleChangeStatus = (deviceStatus, appStatus) => this.setState({ appStatus })
handleImportAccount = () => { handleImportAccount = () => {
const { archivedAccounts, updateAccount } = this.props const { archivedAccounts, updateAccount, closeModal } = this.props
const { selectedAccounts } = this.state const { selectedAccounts } = this.state
const accounts = archivedAccounts.filter(a => selectedAccounts.includes(a.id)) const accounts = archivedAccounts.filter(a => selectedAccounts.includes(a.id))
accounts.forEach(a => updateAccount({ ...a, archived: false }))
accounts.forEach(a => this.setState({ selectedAccounts: [] })
updateAccount({ closeModal(MODAL_ADD_ACCOUNT)
...a,
archived: false,
}),
)
this.setState({
selectedAccounts: [],
})
} }
handleNextStep = () => { handleNextStep = () => {

Loading…
Cancel
Save