diff --git a/apps/web/src/components/settings/SystemInfoPanel.tsx b/apps/web/src/components/settings/SystemInfoPanel.tsx index 8f8315a2..80e8de82 100644 --- a/apps/web/src/components/settings/SystemInfoPanel.tsx +++ b/apps/web/src/components/settings/SystemInfoPanel.tsx @@ -17,7 +17,13 @@ import { cn } from "@/lib/utils"; import { getReleaseTagForVersion } from "@/lib/version-check"; import { copyTextToClipboard } from "./settings-utils"; -export type SystemInfoItem = { label: string; value: string }; +export type SystemInfoItem = { + label: string; + value: string; + mono?: boolean; + colSpan?: "full" | "two" | "double-sm"; + status?: "connected" | "connecting" | "failed" | "warning" | "error" | "default"; +}; type InstanceSystemDiagnostics = Pick & { runtime?: string | null; @@ -56,6 +62,13 @@ const getDeploymentDescription = (t: (key: string) => string) => { return `${trigger} ยท ${method}`; }; +const getColSpanClass = (colSpan?: SystemInfoItem["colSpan"]) => { + if (colSpan === "full") return "sm:col-span-2 lg:col-span-3"; + if (colSpan === "two") return "sm:col-span-2 lg:col-span-2"; + if (colSpan === "double-sm") return "sm:col-span-2 lg:col-span-1"; + return "col-span-1"; +}; + const getWebSystemInfoGroups = ( t: (key: string) => string, language: string, @@ -88,9 +101,10 @@ const getWebSystemInfoGroups = ( : clientKind === "desktopApp" ? t("systemInfo.unknown") : `v${__EDGEEVER_APP_VERSION__}`, + mono: true, }, - { label: t("systemInfo.instanceBuild"), value: diagnostics.instance?.build ?? t("systemInfo.unknown") }, - { label: t("systemInfo.databaseMigration"), value: diagnostics.instance?.migration ?? t("systemInfo.unknown") }, + { label: t("systemInfo.instanceBuild"), value: diagnostics.instance?.build ?? t("systemInfo.unknown"), mono: true }, + { label: t("systemInfo.databaseMigration"), value: diagnostics.instance?.migration ?? t("systemInfo.unknown"), mono: true }, { label: t("systemInfo.databaseBackend"), value: diagnostics.instance?.storage?.database @@ -115,7 +129,7 @@ const getWebSystemInfoGroups = ( label: t("systemInfo.deploymentPlatform"), value: t(`systemInfo.deploymentPlatforms.${resolveDeploymentPlatform(diagnostics.instance?.runtime)}`), }, - { label: t("systemInfo.deployment"), value: getDeploymentDescription(t) }, + { label: t("systemInfo.deployment"), value: getDeploymentDescription(t), colSpan: "full" }, ], }, { @@ -126,6 +140,7 @@ const getWebSystemInfoGroups = ( { label: t("systemInfo.clientVersion"), value: `v${diagnostics.clientRuntime?.appVersion ?? __EDGEEVER_APP_VERSION__}`, + mono: true, }, { label: t("systemInfo.releaseTime"), @@ -133,7 +148,7 @@ const getWebSystemInfoGroups = ( ? new Intl.DateTimeFormat(language, { dateStyle: "medium", timeStyle: "short" }).format(new Date(__EDGEEVER_RELEASED_AT__)) : t("systemInfo.unknown"), }, - { label: t("systemInfo.build"), value: __EDGEEVER_BUILD_LABEL__ }, + { label: t("systemInfo.build"), value: __EDGEEVER_BUILD_LABEL__, mono: true }, { label: t("systemInfo.client"), value: t(`systemInfo.clients.${clientKind}`) }, { label: t("systemInfo.os"), @@ -144,14 +159,15 @@ const getWebSystemInfoGroups = ( { label: t("systemInfo.architecture"), value: diagnostics.clientRuntime?.architecture ?? t("systemInfo.unknown"), + mono: true, }, { label: t("systemInfo.runtimeEngine"), value: diagnostics.clientRuntime?.engine ?? (clientKind === "desktopApp" ? t("systemInfo.unknown") : detectBrowser(userAgent) ?? t("systemInfo.unknown")), }, - { label: t("systemInfo.language"), value: navigator.language || language }, - { label: t("systemInfo.timeZone"), value: timeZone }, + { label: t("systemInfo.language"), value: navigator.language || language, mono: true }, + { label: t("systemInfo.timeZone"), value: timeZone, mono: true, colSpan: "double-sm" }, ], }, ]; @@ -232,6 +248,13 @@ export const SystemInfoPanel = ({ active = true }: { active?: boolean }) => { : lastSyncedDate && Number.isFinite(lastSyncedDate.getTime()) ? new Intl.DateTimeFormat(i18n.language, { dateStyle: "medium", timeStyle: "short" }).format(lastSyncedDate) : t("systemInfo.neverSynced"); + const pendingCount = syncDiagnosticsQuery.data + ? syncDiagnosticsQuery.data.pending + syncDiagnosticsQuery.data.syncing + : null; + const failedCount = syncDiagnosticsQuery.data + ? syncDiagnosticsQuery.data.error + syncDiagnosticsQuery.data.conflict + : null; + groups.push({ id: "connection", title: t("systemInfo.connectionSection"), @@ -244,23 +267,26 @@ export const SystemInfoPanel = ({ active = true }: { active?: boolean }) => { : healthQuery.isSuccess ? t("systemInfo.connectionConnected") : t("systemInfo.connectionChecking"), + colSpan: "two", + status: healthQuery.isError ? "failed" : healthQuery.isSuccess ? "connected" : "connecting", }, { label: t("systemInfo.requestLatency"), value: healthQuery.data ? `${healthQuery.data.latencyMs} ms` : t("systemInfo.unknown"), + mono: true, }, { label: t("systemInfo.lastSuccessfulSync"), value: formattedLastSync }, { label: t("systemInfo.pendingSync"), - value: syncDiagnosticsQuery.data - ? String(syncDiagnosticsQuery.data.pending + syncDiagnosticsQuery.data.syncing) - : t("systemInfo.unknown"), + value: pendingCount !== null ? String(pendingCount) : t("systemInfo.unknown"), + mono: true, + status: (pendingCount ?? 0) > 0 ? "warning" : "default", }, { label: t("systemInfo.failedSync"), - value: syncDiagnosticsQuery.data - ? String(syncDiagnosticsQuery.data.error + syncDiagnosticsQuery.data.conflict) - : t("systemInfo.unknown"), + value: failedCount !== null ? String(failedCount) : t("systemInfo.unknown"), + mono: true, + status: (failedCount ?? 0) > 0 ? "error" : "default", }, ], }); @@ -311,11 +337,19 @@ export const SystemInfoPanel = ({ active = true }: { active?: boolean }) => { }; return ( -
-
-
{infoGroups.map((group) => { @@ -323,24 +357,25 @@ export const SystemInfoPanel = ({ active = true }: { active?: boolean }) => { const isClient = group.id === "client"; const headingId = `system-info-${group.id}-heading`; return ( -
-
-
- {isCloud - ? - : isClient - ? - : } +
+
+
+
+ {isCloud + ? + : isClient + ? + : } +
-

{group.title}

-

{group.description}

+

{group.title}

{isClient && desktopAvailable ? (
{isCloud && active && release ? ( -
); })}