mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-10 05:15:35 +08:00
feat: show provider expire message with i18n (#237)
This commit is contained in:
parent
9ed73a69e3
commit
b9e9a955f2
@ -1,3 +1,4 @@
|
|||||||
|
import { useI18n } from '@solid-primitives/i18n'
|
||||||
import byteSize from 'byte-size'
|
import byteSize from 'byte-size'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { toFinite } from 'lodash'
|
import { toFinite } from 'lodash'
|
||||||
@ -12,9 +13,17 @@ const getSubscriptionsInfo = (subscriptionInfo: ISubscriptionInfo) => {
|
|||||||
})
|
})
|
||||||
const percentage = toFinite((((Download + Upload) / Total) * 100).toFixed(2))
|
const percentage = toFinite((((Download + Upload) / Total) * 100).toFixed(2))
|
||||||
|
|
||||||
|
const expirePrefix = () => {
|
||||||
|
const [t] = useI18n()
|
||||||
|
|
||||||
|
return t('expire')
|
||||||
|
}
|
||||||
|
|
||||||
const expireStr = () => {
|
const expireStr = () => {
|
||||||
|
const [t] = useI18n()
|
||||||
|
|
||||||
if (Expire === 0) {
|
if (Expire === 0) {
|
||||||
return 'Null'
|
return t('noExpire')
|
||||||
}
|
}
|
||||||
|
|
||||||
return dayjs(Expire * 1000).format('YYYY-MM-DD')
|
return dayjs(Expire * 1000).format('YYYY-MM-DD')
|
||||||
@ -24,6 +33,7 @@ const getSubscriptionsInfo = (subscriptionInfo: ISubscriptionInfo) => {
|
|||||||
total,
|
total,
|
||||||
used,
|
used,
|
||||||
percentage,
|
percentage,
|
||||||
|
expirePrefix,
|
||||||
expireStr,
|
expireStr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -45,7 +55,9 @@ export const SubscriptionInfo = (props: {
|
|||||||
{`${info.used}`} / {`${info.total}`} ( {info.percentage}% )
|
{`${info.used}`} / {`${info.total}`} ( {info.percentage}% )
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-sm text-slate-500">Expire: {info.expireStr()} </div>
|
<div class="text-sm text-slate-500">
|
||||||
|
{info.expirePrefix()}: {info.expireStr()}
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -94,4 +94,6 @@ export default {
|
|||||||
coreConfig: 'Core Config',
|
coreConfig: 'Core Config',
|
||||||
xdConfig: 'XD Config',
|
xdConfig: 'XD Config',
|
||||||
version: 'Version',
|
version: 'Version',
|
||||||
|
expire: 'Expire',
|
||||||
|
noExpire: 'Null',
|
||||||
}
|
}
|
||||||
|
@ -94,4 +94,6 @@ export default {
|
|||||||
coreConfig: '核心配置',
|
coreConfig: '核心配置',
|
||||||
xdConfig: 'XD 配置',
|
xdConfig: 'XD 配置',
|
||||||
version: '版本',
|
version: '版本',
|
||||||
|
expire: '到期时间',
|
||||||
|
noExpire: '不限时',
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user