1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-21 23:32:35 +00:00

fix: utilize gigabyte per second to conserve space and upload arrow clipping fix (#7279)

* Update transmission-app.scss

* Update formatter.js

* Update formatter.js
This commit is contained in:
Rukario 2024-12-08 19:44:18 -08:00 committed by GitHub
parent 1bcc951001
commit 100e88826c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View file

@ -409,8 +409,8 @@ a {
align-items: inherit;
flex-direction: inherit;
&:not(:nth-child(1 of #mainwin-statusbar .speed-container)) {
width: 100px;
+ .speed-container {
min-width: 100px;
}
}

View file

@ -51,6 +51,11 @@ const fmt_MBps = new Intl.NumberFormat(current_locale, {
style: 'unit',
unit: 'megabyte-per-second',
});
const fmt_GBps = new Intl.NumberFormat(current_locale, {
maximumFractionDigits: 2,
style: 'unit',
unit: 'gigabyte-per-second',
});
export const Formatter = {
/** Round a string of a number to a specified number of decimal places */
@ -122,7 +127,12 @@ export const Formatter = {
},
speed(KBps) {
return KBps < 999.95 ? fmt_kBps.format(KBps) : fmt_MBps.format(KBps / 1000);
if (KBps < 999.95) {
return fmt_kBps.format(KBps);
} else if (KBps < 999_950) {
return fmt_MBps.format(KBps / 1000);
}
return fmt_GBps.format(KBps / 1_000_000);
},
speedBps(Bps) {