Skip to content

Commit 630e523

Browse files
authored
[UI] Improve download speed chart (#3244)
* update the amount of data points that avgdownloadspeed uses to represent the graph in downloads to be a higher number, changed the numbers to not jump around so much on the same row * style change to be compliant
1 parent fdaadf7 commit 630e523

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/frontend/screens/DownloadManager/components/ProgressHeader/index.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
.realtimeDownloadStat {
5555
white-space: nowrap;
5656
margin: 0px;
57+
width: 6em;
58+
text-align: start;
5759
}
5860

5961
.realtimeDownloadStatLabel {
@@ -66,7 +68,6 @@
6668
.realtimeDownloadStatContainer {
6769
align-self: center;
6870
margin: 1em;
69-
box-sizing: border-box;
7071
}
7172

7273
.downloadRateChart {

src/frontend/screens/DownloadManager/components/ProgressHeader/index.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,22 @@ export default function ProgressHeader(props: {
2020
appName: string
2121
state: DownloadManagerState
2222
}) {
23+
const sampleSize = 100
2324
const { t } = useTranslation()
2425
const [progress] = hasProgress(props.appName)
2526
const [avgSpeed, setAvgDownloadSpeed] = useState<Point[]>(
26-
Array<Point>(20).fill({ download: 0, disk: 0 })
27+
Array<Point>(sampleSize).fill({ download: 0, disk: 0 })
2728
)
2829

2930
useEffect(() => {
3031
if (props.state === 'idle') {
31-
setAvgDownloadSpeed(Array<Point>(20).fill({ download: 0, disk: 0 }))
32+
setAvgDownloadSpeed(
33+
Array<Point>(sampleSize).fill({ download: 0, disk: 0 })
34+
)
3235
return
3336
}
3437

35-
if (avgSpeed.length > 19) {
38+
if (avgSpeed.length > sampleSize - 1) {
3639
avgSpeed.shift()
3740
}
3841

0 commit comments

Comments
 (0)