fix(proxy): wrap subscription info usage percentage with toFinite

This commit is contained in:
kunish 2023-09-17 21:18:23 +08:00
parent 5402fdb9cb
commit ed947f62a2
No known key found for this signature in database
GPG Key ID: 647A12B4F782C430
3 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,6 @@
import byteSize from 'byte-size'
import dayjs from 'dayjs'
import { toFinite } from 'lodash'
import type { SubscriptionInfo as ISubscriptionInfo } from '~/types'
const getSubscriptionsInfo = (subscriptionInfo: ISubscriptionInfo) => {
@ -9,10 +10,10 @@ const getSubscriptionsInfo = (subscriptionInfo: ISubscriptionInfo) => {
const used = byteSize(Download + Upload, {
units: 'iec',
})
const percentage = (((Download + Upload) / Total) * 100).toFixed(2)
const percentage = toFinite((((Download + Upload) / Total) * 100).toFixed(2))
const expireStr = () => {
if (subscriptionInfo.Expire === 0) {
if (Expire === 0) {
return 'Null'
}

View File

@ -422,6 +422,7 @@ export default () => {
{(cell) => {
return (
<td
class="py-2"
onContextMenu={(e) => {
e.preventDefault()

View File

@ -204,10 +204,10 @@ export default () => {
<tbody>
<For each={table.getRowModel().rows}>
{(row) => (
<tr class="hover">
<tr class="hover:!bg-primary hover:text-primary-content">
<For each={row.getVisibleCells()}>
{(cell) => (
<td>
<td class="py-2">
{flexRender(
cell.column.columnDef.cell,
cell.getContext(),