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,
icon: string,
app: Object,
bolos_version: {
min: number,
max: number,
},
}
type Props = {
@ -120,7 +124,7 @@ class AppsList extends PureComponent<Props, State> {
<List>
{this.state.appsList.map(c => (
<ManagerApp
key={c.name}
key={`${c.name}_${c.version}_${c.bolos_version.min}`}
name={c.name}
version={`Version ${c.version}`}
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 { memoryInfos, isLoading } = this.state
if (!device) {
return <Box py={5}>{'You dont have any device connected'}</Box>
}
const title = (
<Text>
{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 Box from 'components/base/Box'
import Pills from 'components/base/Pills'
import AppsList from './AppsList'
@ -37,6 +36,14 @@ class ManagerPage extends PureComponent<Props, State> {
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 })
render() {
@ -45,19 +52,18 @@ class ManagerPage extends PureComponent<Props, State> {
const tabs = TABS.map(i => {
let label = t(`manager:tabs.${i.key}`)
if (i.key === 'device') {
if (!device) {
return null
}
label += ` (${nbDevices})`
}
return { ...i, label }
})
}).filter(Boolean)
return (
<Fragment>
<Pills items={tabs} activeKey={currentTab} onChange={this.handleTabChange} mb={6} />
{currentTab === 'apps' && <AppsList device={device} />}
{currentTab === 'device' && (
<Box flow={4}>
<DeviceInfos device={device} />
</Box>
)}
{currentTab === 'device' && <DeviceInfos device={device} />}
</Fragment>
)
}

3
src/components/SettingsPage/PasswordModal.js

@ -94,9 +94,9 @@ class PasswordModal extends PureComponent<Props, State> {
{t('settings:profile.passwordModalPasswordInput')}
</Label>
<InputPassword
autoFocus
type="password"
placeholder={t('settings:profile.passwordModalPasswordInput')}
autoFocus
id="password"
onChange={this.handleInputChange('currentPassword')}
value={currentPassword}
@ -110,6 +110,7 @@ class PasswordModal extends PureComponent<Props, State> {
</Label>
)}
<InputPassword
autoFocus={!isPasswordEnabled}
placeholder={t('settings:profile.passwordModalNewPasswordInput')}
id="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 })
handleImportAccount = () => {
const { archivedAccounts, updateAccount } = this.props
const { archivedAccounts, updateAccount, closeModal } = this.props
const { selectedAccounts } = this.state
const accounts = archivedAccounts.filter(a => selectedAccounts.includes(a.id))
accounts.forEach(a =>
updateAccount({
...a,
archived: false,
}),
)
this.setState({
selectedAccounts: [],
})
accounts.forEach(a => updateAccount({ ...a, archived: false }))
this.setState({ selectedAccounts: [] })
closeModal(MODAL_ADD_ACCOUNT)
}
handleNextStep = () => {

Loading…
Cancel
Save