Skip to content

Commit

Permalink
fix: Don't have some statistic problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Elziy committed Jun 2, 2024
1 parent 06d983f commit c797346
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/components/home/TrafficNow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,18 @@ function TrafficNow({ apiConfig }) {
<div>{t('Download Total')}</div>
<div>{dlTotal}</div>
</div>
<div className={s0.sec}>
<div>{t('Proxy Upload Total')}</div>
<div>{proxyUpTotal}</div>
</div>
<div className={s0.sec}>
<div>{t('Proxy Download Total')}</div>
<div>{proxyDlTotal}</div>
</div>
{proxyUpTotal ?
<div className={s0.sec}>
<div>{t('Proxy Upload Total')}</div>
<div>{proxyUpTotal}</div>
</div> : null
}
{proxyDlTotal ?
<div className={s0.sec}>
<div>{t('Proxy Download Total')}</div>
<div>{proxyDlTotal}</div>
</div> : null
}
<div className={s0.sec}>
<div>{t('Active Connections')}</div>
<div>{connNumber}</div>
Expand Down
3 changes: 3 additions & 0 deletions src/misc/pretty-bytes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
const UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];

export default function prettyBytes(n: number) {
if (n === null || n === undefined || isNaN(n)) {
return '0 B';
}
if (n < 1000) {
return n + ' B';
}
Expand Down

0 comments on commit c797346

Please sign in to comment.