From 21d5e29a3dfbee1229a76f355680648ce5c5a953 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Wed, 21 Feb 2024 08:35:41 -0800 Subject: [PATCH] Gauges? --- .../tgui/interfaces/PingRelaysPanel.jsx | 44 ++++++++----------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/tgui/packages/tgui/interfaces/PingRelaysPanel.jsx b/tgui/packages/tgui/interfaces/PingRelaysPanel.jsx index ae301ea3833f..4fc528e97258 100644 --- a/tgui/packages/tgui/interfaces/PingRelaysPanel.jsx +++ b/tgui/packages/tgui/interfaces/PingRelaysPanel.jsx @@ -1,34 +1,18 @@ import { useBackend } from '../backend'; -import { Box, Stack, Button, Icon } from '../components'; +import { Box, Stack, Button, Icon, RoundGauge } from '../components'; import { Window } from '../layouts'; import { Color } from 'common/color'; import { Ping } from 'common/ping'; import { Component } from 'react'; const RELAY_COUNT = 8; - -const COLORS = [ - new Color(220, 40, 40), // red - new Color(220, 200, 40), // yellow - new Color(60, 220, 40), // green -]; - -const getPingColor = function (ping) { - if (ping < 200) { - return COLORS[2]; - } - if (ping < 500) { - return COLORS[1]; - } - return COLORS[0]; -}; +const RED = new Color(220, 40, 40); export class PingResult { - constructor(desc = 'Loading...', url = '', ping = -1, color = COLORS[0]) { + constructor(desc = 'Loading...', url = '', ping = -1) { this.desc = desc; this.url = url; this.ping = ping; - this.color = color; this.error = null; } @@ -36,7 +20,6 @@ export class PingResult { this.desc = desc; this.url = url; this.ping = ping; - this.color = getPingColor(ping); this.error = error; }; } @@ -130,17 +113,28 @@ class PingApp extends Component { {result.ping > -1 && result.error === null && ( <> - {result.desc} - - {' (' + result.ping + ')'} + + {result.desc + ' '} + ' ' + x + 'ms'} + inline + /> )} {result.error !== null && ( <> - + {result.desc} - + {' (' + result.error + ')'}