diff --git a/bun.lockb b/bun.lockb index d4480dc..c78ae3d 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 88d5d0e..524fa13 100644 --- a/package.json +++ b/package.json @@ -10,63 +10,63 @@ "preview": "vite preview" }, "dependencies": { - "@fontsource/inter": "^5.1.1", - "@heroicons/react": "^2.2.0", - "@number-flow/react": "^0.5.5", - "@radix-ui/react-accordion": "^1.2.3", - "@radix-ui/react-checkbox": "^1.1.4", - "@radix-ui/react-dialog": "^1.1.6", - "@radix-ui/react-dropdown-menu": "^2.1.6", - "@radix-ui/react-label": "^2.1.2", - "@radix-ui/react-popover": "^1.1.6", - "@radix-ui/react-progress": "^1.1.2", - "@radix-ui/react-select": "^2.1.6", - "@radix-ui/react-separator": "^1.1.2", - "@radix-ui/react-slot": "^1.1.2", - "@radix-ui/react-switch": "^1.1.3", - "@radix-ui/react-tooltip": "^1.1.8", - "@tanstack/react-query": "^5.66.7", - "@tanstack/react-query-devtools": "^5.66.7", - "@tanstack/react-table": "^8.21.2", - "@trivago/prettier-plugin-sort-imports": "^5.2.2", - "@types/d3-geo": "^3.1.0", - "@types/luxon": "^3.4.2", - "class-variance-authority": "^0.7.1", - "clsx": "^2.1.1", + "@fontsource/inter": "5.1.1", + "@heroicons/react": "2.2.0", + "@number-flow/react": "0.5.5", + "@radix-ui/react-accordion": "1.2.3", + "@radix-ui/react-checkbox": "1.1.4", + "@radix-ui/react-dialog": "1.1.6", + "@radix-ui/react-dropdown-menu": "2.1.6", + "@radix-ui/react-label": "2.1.2", + "@radix-ui/react-popover": "1.1.6", + "@radix-ui/react-progress": "1.1.2", + "@radix-ui/react-select": "2.1.6", + "@radix-ui/react-separator": "1.1.2", + "@radix-ui/react-slot": "1.1.2", + "@radix-ui/react-switch": "1.1.3", + "@radix-ui/react-tooltip": "1.1.8", + "@tanstack/react-query": "5.66.7", + "@tanstack/react-query-devtools": "5.66.7", + "@tanstack/react-table": "8.21.2", + "@trivago/prettier-plugin-sort-imports": "5.2.2", + "@types/d3-geo": "3.1.0", + "@types/luxon": "3.4.2", + "class-variance-authority": "0.7.1", + "clsx": "2.1.1", "cmdk": "1.0.0", - "country-flag-icons": "^1.5.18", - "d3-geo": "^3.1.1", - "dayjs": "^1.11.13", - "framer-motion": "^12.4.5", - "i18n-iso-countries": "^7.14.0", - "i18next": "^24.2.2", - "lucide-react": "^0.460.0", - "luxon": "^3.5.0", - "prettier-plugin-tailwindcss": "^0.6.11", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "react-i18next": "^15.4.1", - "react-router-dom": "^7.2.0", - "recharts": "^2.15.1", - "sonner": "^1.7.4", - "tailwind-merge": "^2.6.0", - "tailwindcss-animate": "^1.0.7" + "country-flag-icons": "1.5.18", + "d3-geo": "3.1.1", + "dayjs": "1.11.13", + "framer-motion": "12.4.5", + "i18n-iso-countries": "7.14.0", + "i18next": "24.2.2", + "lucide-react": "0.460.0", + "luxon": "3.5.0", + "prettier-plugin-tailwindcss": "0.6.11", + "react": "19.0.0", + "react-dom": "19.0.0", + "react-i18next": "15.4.1", + "react-router-dom": "7.2.0", + "recharts": "2.15.1", + "sonner": "1.7.4", + "tailwind-merge": "2.6.0", + "tailwindcss-animate": "1.0.7" }, "devDependencies": { - "@eslint/js": "^9.20.0", - "@types/node": "^22.13.4", - "@types/react": "^19.0.10", - "@types/react-dom": "^19.0.4", - "@vitejs/plugin-react-swc": "^3.8.0", - "autoprefixer": "^10.4.20", - "eslint": "^9.20.1", - "eslint-plugin-react-hooks": "^5.1.0", - "eslint-plugin-react-refresh": "^0.4.19", - "globals": "^15.15.0", - "postcss": "^8.5.3", - "tailwindcss": "^3.4.17", + "@eslint/js": "9.20.0", + "@types/node": "22.13.4", + "@types/react": "19.0.10", + "@types/react-dom": "19.0.4", + "@vitejs/plugin-react-swc": "3.8.0", + "autoprefixer": "10.4.20", + "eslint": "9.20.1", + "eslint-plugin-react-hooks": "5.1.0", + "eslint-plugin-react-refresh": "0.4.19", + "globals": "15.15.0", + "postcss": "8.5.3", + "tailwindcss": "3.4.17", "typescript": "~5.6.3", - "typescript-eslint": "^8.24.1", - "vite": "^6.1.1" + "typescript-eslint": "8.24.1", + "vite": "6.1.1" } } diff --git a/src/components/ServerDetailOverview.tsx b/src/components/ServerDetailOverview.tsx index 8f3d536..01ae7ae 100644 --- a/src/components/ServerDetailOverview.tsx +++ b/src/components/ServerDetailOverview.tsx @@ -74,6 +74,7 @@ export default function ServerDetailOverview({ server_id }: { server_id: string net_out_transfer, net_in_transfer, last_active_time_string, + boot_time_string, } = formatNezhaInfo(nezhaWsData.now, server) const customBackgroundImage = (window.CustomBackgroundImage as string) !== "" ? window.CustomBackgroundImage : undefined @@ -116,7 +117,9 @@ export default function ServerDetailOverview({ server_id }: { server_id: string

{t("serverDetail.uptime")}

{" "} - {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")}`}
@@ -285,6 +288,14 @@ export default function ServerDetailOverview({ server_id }: { server_id: string
+ + +
+

{t("serverDetail.bootTime")}

+
{boot_time_string ? boot_time_string : "N/A"}
+
+
+
diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 59248a7..7618c95 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -35,6 +35,7 @@ export function formatNezhaInfo(now: number, serverInfo: NezhaServer) { swap_total: serverInfo.host.swap_total || 0, disk_total: serverInfo.host.disk_total || 0, boot_time: serverInfo.host.boot_time || 0, + boot_time_string: serverInfo.host.boot_time ? dayjs(serverInfo.host.boot_time * 1000).format("YYYY-MM-DD HH:mm:ss") : "", platform_version: serverInfo.host.platform_version || "", cpu_info: serverInfo.host.cpu || [], gpu_info: serverInfo.host.gpu || [], diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 0d42f9c..6c06d71 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -55,6 +55,7 @@ "status": "Status", "online": "Online", "days": "Days", + "hours": "Hours", "offline": "Offline", "unknown": "Unknown", "uptime": "Uptime", @@ -67,7 +68,8 @@ "upload": "Upload", "download": "Download", "lastActive": "Last active time", - "temperature": "Temperature" + "temperature": "Temperature", + "bootTime": "Boot time" }, "serverDetailChart": { "process": "Process", diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json index ed3fd3a..9c3bd02 100644 --- a/src/locales/zh-CN/translation.json +++ b/src/locales/zh-CN/translation.json @@ -60,6 +60,7 @@ "status": "状态", "online": "在线", "days": "天", + "hours": "小时", "offline": "离线", "unknown": "未知", "uptime": "运行时间", @@ -72,7 +73,8 @@ "upload": "上传", "download": "下载", "lastActive": "最后上报时间", - "temperature": "温度" + "temperature": "温度", + "bootTime": "启动时间" }, "serverDetailChart": { "process": "进程数", diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json index 9f79200..d8d3955 100644 --- a/src/locales/zh-TW/translation.json +++ b/src/locales/zh-TW/translation.json @@ -55,6 +55,7 @@ "status": "狀態", "online": "線上", "days": "天", + "hours": "小時", "offline": "離線", "unknown": "未知", "uptime": "運行時間", @@ -67,7 +68,8 @@ "upload": "上傳", "download": "下載", "lastActive": "最後上報時間", - "temperature": "溫度" + "temperature": "溫度", + "bootTime": "啟動時間" }, "serverDetailChart": { "process": "進程數", diff --git a/src/pages/Server.tsx b/src/pages/Server.tsx index cc77b93..9da1650 100644 --- a/src/pages/Server.tsx +++ b/src/pages/Server.tsx @@ -62,11 +62,25 @@ export default function Servers() { }, []) useEffect(() => { - const inlineState = localStorage.getItem("inline") - if (window.ForceCardInline) { - setInline("1") - } else if (inlineState !== null) { - setInline(inlineState) + const checkInlineSettings = () => { + const isMobile = window.innerWidth < 768 + + if (!isMobile) { + const inlineState = localStorage.getItem("inline") + if (window.ForceCardInline) { + setInline("1") + } else if (inlineState !== null) { + setInline(inlineState) + } + } + } + + checkInlineSettings() + + window.addEventListener("resize", checkInlineSettings) + + return () => { + window.removeEventListener("resize", checkInlineSettings) } }, [])