From 70ea5ad60dd52130f6519c291f37262658da0287 Mon Sep 17 00:00:00 2001 From: fredodiable Date: Wed, 9 Aug 2023 01:49:43 +0200 Subject: [PATCH] Added status field for GameDig widget --- public/locales/en/common.json | 3 +++ src/widgets/gamedig/component.jsx | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 7dbd53d67..53e76bd98 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -685,6 +685,9 @@ "approved": "Approved" }, "gamedig": { + "status": "Status", + "online": "Online", + "offline": "Offline", "name": "Name", "map": "Map", "currentPlayers": "Current players", diff --git a/src/widgets/gamedig/component.jsx b/src/widgets/gamedig/component.jsx index 3ddf909aa..1acfc6e15 100644 --- a/src/widgets/gamedig/component.jsx +++ b/src/widgets/gamedig/component.jsx @@ -26,6 +26,7 @@ export default function Component({ service }) { if (!serverData) { return ( + @@ -37,23 +38,25 @@ export default function Component({ service }) { ); } + const status = serverData.online ? {t("gamedig.online")} : {t("gamedig.offline")}; const name = serverData.online ? serverData.name : "-"; const map = serverData.online ? serverData.map : "-"; const currentPlayers = serverData.online ? `${serverData.players} / ${serverData.maxplayers}` : "-"; const players = serverData.online ? `${serverData.players}` : "-"; const maxPlayers = serverData.online ? `${serverData.maxplayers}` : "-"; const bots = serverData.online ? `${serverData.bots}` : "-"; - const ping = serverData.online ? `${serverData.ping}` : 0; + const ping = serverData.online ? `${t("common.ms", { value: serverData.ping, style: "unit", unit: "millisecond" })}` : "-"; return ( + - + ); }