diff --git a/js/src/ui/Actionbar/Export/export.js b/js/src/ui/Actionbar/Export/export.js index 64e153734..7f0ea3e15 100644 --- a/js/src/ui/Actionbar/Export/export.js +++ b/js/src/ui/Actionbar/Export/export.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; + import FileSaver from 'file-saver'; import FileDownloadIcon from 'material-ui/svg-icons/file/file-download'; @@ -38,19 +39,18 @@ class ActionbarExport extends Component { className={ className } icon={ } label='export' - onClick={ this.onDownloadBackup } /> + onClick={ this.handleExport } + /> ); } - onDownloadBackup = () => { + handleExport = () => { const { filename, content } = this.props; - const text = (typeof content === 'string') - ? content - : JSON.stringify(content, null, 4); + const text = JSON.stringify(content, null, 4); - const blob = new Blob([ text ], { type: 'text/plain;charset=utf-8' }); - FileSaver.saveAs(blob, filename); + const blob = new Blob([ text ], { type: 'application/json' }); + FileSaver.saveAs(blob, `${filename}.json`); } } diff --git a/js/src/views/Accounts/accounts.js b/js/src/views/Accounts/accounts.js index 8fd2a3982..0e7cd0500 100644 --- a/js/src/views/Accounts/accounts.js +++ b/js/src/views/Accounts/accounts.js @@ -22,7 +22,7 @@ import { uniq } from 'lodash'; import List from './List'; import { CreateAccount } from '../../modals'; -import { Actionbar, ActionbarSearch, ActionbarSort, Button, Page, Tooltip } from '../../ui'; +import { Actionbar, ActionbarExport, ActionbarSearch, ActionbarSort, Button, Page, Tooltip } from '../../ui'; import styles from './accounts.css'; @@ -97,6 +97,8 @@ class Accounts extends Component { } renderActionbar () { + const { accounts } = this.props; + const buttons = [