feat: enhance uptime display with hours (#36)

* feat: enhance uptime display with hours and update translations for hours

* chore: auto-fix linting and formatting issues
This commit is contained in:
仓鼠 2025-03-16 11:10:59 +08:00 committed by GitHub
parent 7ffef91d2d
commit 5d7c07850a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 1 deletions

View File

@ -117,7 +117,9 @@ export default function ServerDetailOverview({ server_id }: { server_id: string
<p className="text-xs text-muted-foreground">{t("serverDetail.uptime")}</p>
<div className="text-xs">
{" "}
{online ? (uptime / 86400).toFixed(0) : "N/A"} {t("serverDetail.days")}
{uptime / 86400 >= 1
? `${Math.floor(uptime / 86400)} ${t("serverDetail.days")} ${Math.floor((uptime % 86400) / 3600)} ${t("serverDetail.hours")}`
: `${Math.floor(uptime / 3600)} ${t("serverDetail.hours")}`}
</div>
</section>
</CardContent>

View File

@ -55,6 +55,7 @@
"status": "Status",
"online": "Online",
"days": "Days",
"hours": "Hours",
"offline": "Offline",
"unknown": "Unknown",
"uptime": "Uptime",

View File

@ -55,6 +55,7 @@
"status": "状态",
"online": "在线",
"days": "天",
"hours": "小时",
"offline": "离线",
"unknown": "未知",
"uptime": "运行时间",

View File

@ -55,6 +55,7 @@
"status": "狀態",
"online": "線上",
"days": "天",
"hours": "小時",
"offline": "離線",
"unknown": "未知",
"uptime": "運行時間",