|
|
@ -1,7 +1,7 @@ |
|
|
|
// @flow
|
|
|
|
/* eslint-disable react/jsx-no-literals */ // FIXME
|
|
|
|
|
|
|
|
import React, { PureComponent } from 'react' |
|
|
|
import React, { PureComponent, Fragment } from 'react' |
|
|
|
import styled from 'styled-components' |
|
|
|
import { translate } from 'react-i18next' |
|
|
|
|
|
|
@ -11,17 +11,18 @@ import type { LedgerScriptParams } from 'helpers/common' |
|
|
|
import listApps from 'commands/listApps' |
|
|
|
import installApp from 'commands/installApp' |
|
|
|
import uninstallApp from 'commands/uninstallApp' |
|
|
|
import TranslatedError from 'components/TranslatedError' |
|
|
|
|
|
|
|
import Box from 'components/base/Box' |
|
|
|
import Modal, { ModalBody } from 'components/base/Modal' |
|
|
|
import Modal, { ModalBody, ModalFooter, ModalTitle, ModalContent } from 'components/base/Modal' |
|
|
|
import Tooltip from 'components/base/Tooltip' |
|
|
|
import Text from 'components/base/Text' |
|
|
|
import Progress from 'components/base/Progress' |
|
|
|
import Spinner from 'components/base/Spinner' |
|
|
|
import Button from 'components/base/Button' |
|
|
|
import TranslatedError from 'components/TranslatedError' |
|
|
|
|
|
|
|
import ExclamationCircle from 'icons/ExclamationCircle' |
|
|
|
import ExclamationCircleThin from 'icons/ExclamationCircleThin' |
|
|
|
import Update from 'icons/Update' |
|
|
|
import Trash from 'icons/Trash' |
|
|
|
import CheckCircle from 'icons/CheckCircle' |
|
|
@ -133,41 +134,80 @@ class AppsList extends PureComponent<Props, State> { |
|
|
|
<Modal |
|
|
|
isOpened={status !== 'idle' && status !== 'loading'} |
|
|
|
render={() => ( |
|
|
|
<ModalBody p={6} align="center" justify="center" style={{ height: 300 }}> |
|
|
|
<ModalBody align="center" justify="center" style={{ height: 300 }}> |
|
|
|
{status === 'busy' || status === 'idle' ? ( |
|
|
|
<Box align="center" justify="center" flow={3}> |
|
|
|
{mode === 'installing' ? <Update size={30} /> : <Trash size={30} />} |
|
|
|
<Text ff="Museo Sans|Regular" fontSize={6} color="dark"> |
|
|
|
{t(`app:manager.apps.${mode}`, { app })} |
|
|
|
</Text> |
|
|
|
<Box my={5} style={{ width: 250 }}> |
|
|
|
<Progress style={{ width: '100%' }} infinite /> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
<Fragment> |
|
|
|
<ModalTitle> |
|
|
|
{mode === 'installing' ? ( |
|
|
|
<Box color="grey"> |
|
|
|
<Update size={30} /> |
|
|
|
</Box> |
|
|
|
) : ( |
|
|
|
<Box color="grey"> |
|
|
|
<Trash size={30} /> |
|
|
|
</Box> |
|
|
|
)} |
|
|
|
</ModalTitle> |
|
|
|
<ModalContent> |
|
|
|
<Text ff="Museo Sans|Regular" fontSize={6} color="dark"> |
|
|
|
{t(`app:manager.apps.${mode}`, { app })} |
|
|
|
</Text> |
|
|
|
<Box mt={6}> |
|
|
|
<Progress style={{ width: '100%' }} infinite /> |
|
|
|
</Box> |
|
|
|
</ModalContent> |
|
|
|
</Fragment> |
|
|
|
) : status === 'error' ? ( |
|
|
|
<Box align="center" justify="center" flow={3}> |
|
|
|
<TranslatedError error={error} /> |
|
|
|
<Button primary onClick={this.handleCloseModal}> |
|
|
|
close |
|
|
|
</Button> |
|
|
|
</Box> |
|
|
|
<Fragment> |
|
|
|
<ModalContent grow align="center" justify="center" mt={3}> |
|
|
|
<Box color="alertRed"> |
|
|
|
<ExclamationCircleThin size={44} /> |
|
|
|
</Box> |
|
|
|
<Box |
|
|
|
color="black" |
|
|
|
mt={4} |
|
|
|
fontSize={6} |
|
|
|
ff="Museo Sans|Regular" |
|
|
|
textAlign="center" |
|
|
|
style={{ maxWidth: 350 }} |
|
|
|
> |
|
|
|
<TranslatedError error={error} /> |
|
|
|
</Box> |
|
|
|
</ModalContent> |
|
|
|
<ModalFooter horizontal justifyContent="flex-end" style={{ width: '100%' }}> |
|
|
|
<Button primary padded onClick={this.handleCloseModal}> |
|
|
|
{t('app:common.close')} |
|
|
|
</Button> |
|
|
|
</ModalFooter> |
|
|
|
</Fragment> |
|
|
|
) : status === 'success' ? ( |
|
|
|
<Box align="center" justify="center" flow={3}> |
|
|
|
<Box color="positiveGreen"> |
|
|
|
<CheckCircle size={30} /> |
|
|
|
</Box> |
|
|
|
<Text ff="Museo Sans|Regular" fontSize={6} color="dark"> |
|
|
|
{t( |
|
|
|
`app:manager.apps.${ |
|
|
|
mode === 'installing' ? 'installSuccess' : 'uninstallSuccess' |
|
|
|
}`,
|
|
|
|
{ app }, |
|
|
|
)} |
|
|
|
</Text> |
|
|
|
<Button primary onClick={this.handleCloseModal}> |
|
|
|
close |
|
|
|
</Button> |
|
|
|
</Box> |
|
|
|
<Fragment> |
|
|
|
<ModalContent grow align="center" justify="center" mt={3}> |
|
|
|
<Box color="positiveGreen"> |
|
|
|
<CheckCircle size={44} /> |
|
|
|
</Box> |
|
|
|
<Box |
|
|
|
color="black" |
|
|
|
mt={4} |
|
|
|
fontSize={6} |
|
|
|
ff="Museo Sans|Regular" |
|
|
|
textAlign="center" |
|
|
|
style={{ maxWidth: 350 }} |
|
|
|
> |
|
|
|
{t( |
|
|
|
`app:manager.apps.${ |
|
|
|
mode === 'installing' ? 'installSuccess' : 'uninstallSuccess' |
|
|
|
}`,
|
|
|
|
{ app }, |
|
|
|
)} |
|
|
|
</Box> |
|
|
|
</ModalContent> |
|
|
|
<ModalFooter horizontal justifyContent="flex-end" style={{ width: '100%' }}> |
|
|
|
<Button primary padded onClick={this.handleCloseModal}> |
|
|
|
{t('app:common.close')} |
|
|
|
</Button> |
|
|
|
</ModalFooter> |
|
|
|
</Fragment> |
|
|
|
) : null} |
|
|
|
</ModalBody> |
|
|
|
)} |
|
|
|