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
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>