diff --git a/src/components/SubscriptionInfo.tsx b/src/components/SubscriptionInfo.tsx
new file mode 100644
index 0000000..8eb9405
--- /dev/null
+++ b/src/components/SubscriptionInfo.tsx
@@ -0,0 +1,43 @@
+import byteSize from 'byte-size'
+import dayjs from 'dayjs'
+import type { SubscriptionInfo } from '~/types'
+
+const getSubscriptionsInfo = (subscriptionInfo: SubscriptionInfo) => {
+ const total = byteSize(subscriptionInfo.Total)
+ const used = byteSize(subscriptionInfo.Download + subscriptionInfo.Upload)
+ const percentage = (
+ ((subscriptionInfo.Download + subscriptionInfo.Upload) /
+ subscriptionInfo.Total) *
+ 100
+ ).toFixed(2)
+ const expireStr = () => {
+ if (subscriptionInfo.Expire === 0) {
+ return 'Null'
+ }
+
+ return dayjs(subscriptionInfo.Expire * 1000).format('YYYY-MM-DD')
+ }
+
+ return {
+ total,
+ used,
+ percentage,
+ expireStr,
+ }
+}
+
+export default (props: { subscriptionInfo: SubscriptionInfo }) => {
+ if (!props.subscriptionInfo) {
+ return
+ }
+ const info = getSubscriptionsInfo(props.subscriptionInfo)
+
+ return (
+ <>
+
+ {`${info.used}`} / {`${info.total}`} ( {info.percentage}% )
+
+ Expire: {info.expireStr()}
+ >
+ )
+}
diff --git a/src/pages/Proxies.tsx b/src/pages/Proxies.tsx
index 10a5275..1896ec9 100644
--- a/src/pages/Proxies.tsx
+++ b/src/pages/Proxies.tsx
@@ -2,6 +2,7 @@ import { IconBrandSpeedtest, IconReload } from '@tabler/icons-solidjs'
import { For, Show, createSignal, onMount } from 'solid-js'
import Collapse from '~/components/Collpase'
import ProxyNodeCard from '~/components/ProxyNodeCard'
+import SubscriptionInfo from '~/components/SubscriptionInfo'
import { useProxies } from '~/signals/proxies'
import type { Proxy } from '~/types'
import { formatTimeFromNow } from '~/utils/date'
@@ -125,7 +126,9 @@ export default () => {
{proxyProvider.name}
-
+
{proxyProvider.vehicleType} :: Updated{' '}
{formatTimeFromNow(proxyProvider.updatedAt)}
diff --git a/src/types.d.ts b/src/types.d.ts
index 0393ba8..fda796a 100644
--- a/src/types.d.ts
+++ b/src/types.d.ts
@@ -35,8 +35,15 @@ export type ProxyNode = {
delay: number
}[]
}
+export type SubscriptionInfo = {
+ Download: number
+ Upload: number
+ Total: number
+ Expire: number
+}
export type ProxyProvider = {
+ subscriptionInfo: SubscriptionInfo
name: string
proxies: ProxyNode[]
testUrl: string