fix(ui): fix blank screen on app start #147

This commit is contained in:
Alexey Kasyanchuk
2021-07-12 14:20:28 +03:00
parent bceb070b74
commit 45bf73d012
3 changed files with 106 additions and 6800 deletions

6860
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -110,6 +110,7 @@
"bitfield": "^3.0.0", "bitfield": "^3.0.0",
"cheerio": "^1.0.0-rc.10", "cheerio": "^1.0.0-rc.10",
"compare-versions": "^3.6.0", "compare-versions": "^3.6.0",
"create-torrent": "3.33.0",
"debug": "^4.3.1", "debug": "^4.3.1",
"detect-onebyte-encoding": "^1.0.3", "detect-onebyte-encoding": "^1.0.3",
"electron-context-menu": "^3.1.1", "electron-context-menu": "^3.1.1",
@ -136,11 +137,10 @@
"react-dom": "17.0.2", "react-dom": "17.0.2",
"react-input-range": "^1.3.0", "react-input-range": "^1.3.0",
"react-markdown": "^6.0.2", "react-markdown": "^6.0.2",
"react-plotly.js": "^2.5.1", "react-minimal-pie-chart": "^8.2.0",
"simple-encryptor": "github:DEgITx/node-simple-encryptor", "simple-encryptor": "github:DEgITx/node-simple-encryptor",
"stun": "1.1.0", "stun": "1.1.0",
"webtorrent": "github:DEgITx/webtorrent", "webtorrent": "github:DEgITx/webtorrent"
"create-torrent": "3.33.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.14.3", "@babel/core": "^7.14.3",

View File

@ -22,7 +22,7 @@ import {contentIcon} from './torrent'
import TrackersImages from './trackers-images' import TrackersImages from './trackers-images'
import DownloadTorrentMenu from './download-torrent-menu' import DownloadTorrentMenu from './download-torrent-menu'
import {torrentTypeDetect, niceTypeColor} from './content'; import {torrentTypeDetect, niceTypeColor} from './content';
import Plot from 'react-plotly.js'; import { PieChart } from 'react-minimal-pie-chart';
let parseDescriptionText = (text) => { let parseDescriptionText = (text) => {
return text.split("\n").map(function(item) { return text.split("\n").map(function(item) {
@ -454,28 +454,20 @@ export default class TorrentPage extends Page {
{ {
this.torrent.filesTypesPriority && Object.keys(this.torrent.filesTypesPriority).length > 0 && Object.keys(this.torrent.filesTypesPriority).filter((key) => this.torrent.filesTypesPriority[key] > 0.0002).length > 1 this.torrent.filesTypesPriority && Object.keys(this.torrent.filesTypesPriority).length > 0 && Object.keys(this.torrent.filesTypesPriority).filter((key) => this.torrent.filesTypesPriority[key] > 0.0002).length > 1
&& &&
<Plot <PieChart
data={[ style={{height: 128, margin: 5}}
{ data={
values: Object.values(this.torrent.filesTypesPriority).map(val => (val * 100).toFixed(2)), Object.keys(this.torrent.filesTypesPriority).map(type => ({
labels: Object.keys(this.torrent.filesTypesPriority), title: type,
marker: { value: this.torrent.filesTypesPriority[type],
colors: Object.keys(this.torrent.filesTypesPriority).map(val => niceTypeColor(val)) color: niceTypeColor(type)
}, }))
type: 'pie', }
showlegend: false, label={({dataEntry}) => dataEntry.title }
hiddenlabels: true, labelStyle={{
textinfo: 'none', fontSize: '0.55em',
displayModeBar: false fill: '#fff'
}, }}
]}
layout={ {width: 120, height: 120, margin: {
l: 0,
r: 0,
b: 10,
t: 5,
pad: 0
}, autosize: false} }
/> />
} }
<RaisedButton <RaisedButton