mirror of
https://github.com/woodchen-ink/nezha-dash-v1.git
synced 2025-07-18 01:21:56 +08:00
更新 i18n.js 文件,移除不再使用的语言翻译,简化资源配置。同时在 ServerCard 组件中增加大数值格式化功能,优化连接数和进程数的显示方式,提升信息展示的清晰度和可读性。
This commit is contained in:
parent
807743aaf9
commit
a491e2ad54
@ -181,6 +181,16 @@ export default function ServerCard({ now, serverInfo, cycleStats }: ServerCardPr
|
||||
return "bg-emerald-500"
|
||||
}
|
||||
|
||||
// 格式化大数值,超过1000显示为k格式
|
||||
const formatLargeNumber = (num: number) => {
|
||||
if (num >= 10000) {
|
||||
return `${Math.floor(num / 1000)}k+`
|
||||
} else if (num >= 1000) {
|
||||
return `${(num / 1000).toFixed(1)}k`
|
||||
}
|
||||
return num.toString()
|
||||
}
|
||||
|
||||
if (!online) {
|
||||
return (
|
||||
<Card
|
||||
@ -429,19 +439,21 @@ export default function ServerCard({ now, serverInfo, cycleStats }: ServerCardPr
|
||||
</div>
|
||||
|
||||
{/* 连接数与进程数 */}
|
||||
<div className="bg-muted/40 rounded-lg p-2 grid grid-cols-2 gap-2">
|
||||
<div className="flex items-center">
|
||||
<Server className="size-[14px] text-indigo-500 mr-1" />
|
||||
<span className="text-xs">T: {tcp}</span>
|
||||
<div className="bg-muted/40 rounded-lg p-2">
|
||||
<div className="flex justify-between items-center">
|
||||
<div className="flex items-center min-w-0 flex-1">
|
||||
<Server className="size-[14px] text-indigo-500 mr-1 flex-shrink-0" />
|
||||
<span className="text-xs truncate" title={`TCP连接: ${tcp}`}>T: {formatLargeNumber(tcp)}</span>
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<Server className="size-[14px] text-pink-500 mr-1" />
|
||||
<span className="text-xs">U: {udp}</span>
|
||||
<div className="flex items-center min-w-0 flex-1 justify-center">
|
||||
<Server className="size-[14px] text-pink-500 mr-1 flex-shrink-0" />
|
||||
<span className="text-xs truncate" title={`UDP连接: ${udp}`}>U: {formatLargeNumber(udp)}</span>
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<Activity className="size-[14px] text-orange-500 mr-1" />
|
||||
<span className="text-xs">P: {process}</span>
|
||||
<div className="flex items-center min-w-0 flex-1 justify-end">
|
||||
<Activity className="size-[14px] text-orange-500 mr-1 flex-shrink-0" />
|
||||
<span className="text-xs truncate" title={`进程数: ${process}`}>P: {formatLargeNumber(process)}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
16
src/i18n.js
16
src/i18n.js
@ -1,11 +1,7 @@
|
||||
import i18n from "i18next"
|
||||
import { initReactI18next } from "react-i18next"
|
||||
|
||||
import deTranslation from "./locales/de/translation.json"
|
||||
import enTranslation from "./locales/en/translation.json"
|
||||
import esTranslation from "./locales/es/translation.json"
|
||||
import ruTranslation from "./locales/ru/translation.json"
|
||||
import taTranslation from "./locales/ta/translation.json"
|
||||
import zhCNTranslation from "./locales/zh-CN/translation.json"
|
||||
import zhTWTranslation from "./locales/zh-TW/translation.json"
|
||||
|
||||
@ -19,18 +15,6 @@ const resources = {
|
||||
"zh-TW": {
|
||||
translation: zhTWTranslation,
|
||||
},
|
||||
"de-DE": {
|
||||
translation: deTranslation,
|
||||
},
|
||||
"es-ES": {
|
||||
translation: esTranslation,
|
||||
},
|
||||
"ru-RU": {
|
||||
translation: ruTranslation,
|
||||
},
|
||||
"ta-IN": {
|
||||
translation: taTranslation,
|
||||
},
|
||||
}
|
||||
|
||||
const getStoredLanguage = () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user