diff --git a/CHANGELOG.md b/CHANGELOG.md index bbd2f81f3..8029eec1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Japanese, Afrikaans, Filipino, Thai and Vietnamese language support ([#5684](https://github.com/lbryio/lbry-desktop/issues/5684)) - Highlight comments made by content owner _community pr!_ ([#5744](https://github.com/lbryio/lbry-desktop/pull/5744)) -- Ability to report infringing content directly from the application ([#5808](https://github.com/lbryio/lbry-desktop/pull/5808)) +- Ability to report infringing content directly from the application ([#5808](https://github.com/lbryio/lbry-desktop/pull/5808)) +- Re-added ability to export wallet transactions ([#5899](https://github.com/lbryio/lbry-desktop/pull/5899)) ### Changed diff --git a/package.json b/package.json index 729ba5843..11622cf9f 100644 --- a/package.json +++ b/package.json @@ -142,7 +142,7 @@ "imagesloaded": "^4.1.4", "json-loader": "^0.5.4", "lbry-format": "https://github.com/lbryio/lbry-format.git", - "lbry-redux": "lbryio/lbry-redux#3ca0c8d20466a695acfd7a9c20f8f580afa02206", + "lbry-redux": "lbryio/lbry-redux#eb37009a987410a60e9f2ba79708049c9904687c", "lbryinc": "lbryio/lbryinc#8f9a58bfc8312a65614fd7327661cdcc502c4e59", "lint-staged": "^7.0.2", "localforage": "^1.7.1", diff --git a/static/app-strings.json b/static/app-strings.json index 62a2b72e2..6faa0899a 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -1859,6 +1859,11 @@ "Learn more and sign petition": "Learn more and sign petition", "Publishing...": "Publishing...", "Collection": "Collection", + "Fetch transaction data for export": "Fetch transaction data for export", + "Fetching data": "Fetching data", + "Download fetched file": "Download fetched file", + "No data to export": "No data to export", + "Failed to process fetched data.": "Failed to process fetched data.", "More from %claim_name%": "More from %claim_name%", "Upload that unlabeled video you found behind the TV in 1991": "Upload that unlabeled video you found behind the TV in 1991", "Select Replay": "Select Replay", diff --git a/ui/component/common/file-exporter.jsx b/ui/component/common/file-exporter.jsx index 2969bc90c..7cabf008a 100644 --- a/ui/component/common/file-exporter.jsx +++ b/ui/component/common/file-exporter.jsx @@ -3,92 +3,86 @@ import * as ICONS from 'constants/icons'; import React from 'react'; import Button from 'component/button'; -import parseData from 'util/parse-data'; -import { remote } from 'electron'; -import path from 'path'; -// @if TARGET='app' -import fs from 'fs'; -// @endif +import Spinner from 'component/spinner'; type Props = { - data: Array, - title: string, + data: any, label: string, - defaultPath?: string, - filters: Array, - onFileCreated?: string => void, - disabled: boolean, + tooltip?: string, + defaultFileName?: string, + filters?: Array, + onFetch?: () => void, + progressMsg?: string, + disabled?: boolean, }; class FileExporter extends React.PureComponent { - static defaultProps = { - filters: [], - }; - constructor() { super(); - (this: any).handleButtonClick = this.handleButtonClick.bind(this); + (this: any).handleDownload = this.handleDownload.bind(this); } - handleFileCreation(filename: string, data: any) { - const { onFileCreated } = this.props; - // @if TARGET='app' - fs.writeFile(filename, data, err => { - if (err) throw err; - // Do something after creation + handleDownload() { + const { data, defaultFileName } = this.props; - if (onFileCreated) { - onFileCreated(filename); - } - }); - // @endif - } - - handleButtonClick() { - const { title, data, defaultPath, filters } = this.props; - - const options = { - title, - defaultPath, - filters: [ - { - name: 'CSV', - extensions: ['csv'], - }, - { - name: 'JSON', - extensions: ['json'], - }, - ], - }; - - remote.dialog.showSaveDialog(remote.getCurrentWindow(), options, filename => { - // User hit cancel so do nothing: - if (!filename) return; - // Get extension and remove initial dot - // @if TARGET='app' - const format = path.extname(filename).replace(/\./g, ''); - // @endif - // Parse data to string with the chosen format - const parsed = parseData(data, format, filters); - // Write file - if (parsed) { - this.handleFileCreation(filename, parsed); - } - }); + const element = document.createElement('a'); + const file = new Blob([data], { type: 'text/plain' }); + element.href = URL.createObjectURL(file); + element.download = defaultFileName || 'file.txt'; + // $FlowFixMe + document.body.appendChild(element); + element.click(); + // $FlowFixMe + document.body.removeChild(element); } render() { - const { label, disabled } = this.props; - return ( -