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
2 changed files with 13 additions and 3 deletions

View File

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

View File

@@ -51,6 +51,11 @@ const fmt_MBps = new Intl.NumberFormat(current_locale, {
style: 'unit', style: 'unit',
unit: 'megabyte-per-second', unit: 'megabyte-per-second',
}); });
const fmt_GBps = new Intl.NumberFormat(current_locale, {
maximumFractionDigits: 2,
style: 'unit',
unit: 'gigabyte-per-second',
});
export const Formatter = { export const Formatter = {
/** Round a string of a number to a specified number of decimal places */ /** Round a string of a number to a specified number of decimal places */
@@ -122,7 +127,12 @@ export const Formatter = {
}, },
speed(KBps) { 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) { speedBps(Bps) {