Skip to content

Commit

Permalink
fix(proxy): wrap subscription info usage percentage with toFinite
Browse files Browse the repository at this point in the history
  • Loading branch information
kunish committed Sep 17, 2023
1 parent 5402fdb commit ed947f6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/components/SubscriptionInfo.tsx
Original file line number Diff line number Diff line change
@@ -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) => {
Expand All @@ -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'
}

Expand Down
1 change: 1 addition & 0 deletions src/pages/Connections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ export default () => {
{(cell) => {
return (
<td
class="py-2"
onContextMenu={(e) => {
e.preventDefault()

Expand Down
4 changes: 2 additions & 2 deletions src/pages/Logs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit ed947f6

Please sign in to comment.