From 375814da273cd2548c30fc56a86dd74ef5f009c9 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Mon, 4 Dec 2023 23:51:14 +0330 Subject: [PATCH] [bug] fix status colors in pages Co-Authored-By: Alireza Ahmadi --- web/assets/js/util/common.js | 13 ++++ web/html/xui/client_modal.html | 3 - web/html/xui/form/client.html | 2 +- web/html/xui/inbound_client_table.html | 4 +- web/html/xui/inbound_info_modal.html | 87 ++++++++++++++------------ web/html/xui/inbounds.html | 15 +---- 6 files changed, 65 insertions(+), 59 deletions(-) diff --git a/web/assets/js/util/common.js b/web/assets/js/util/common.js index b2f15fb2..38a2c37e 100644 --- a/web/assets/js/util/common.js +++ b/web/assets/js/util/common.js @@ -131,6 +131,19 @@ function usageColor(data, threshold, total) { } } +function clientUsageColor(clientStats, trafficDiff) { + switch (true) { + case !clientStats || clientStats.total == 0: + return "#7a316f"; + case clientStats.up + clientStats.down < clientStats.total - trafficDiff: + return "#0e49b5"; + case clientStats.up + clientStats.down < clientStats.total: + return "#FFA031"; + default: + return "#E04141"; + } +} + function userExpiryColor(threshold, client, isDark = false) { if (!client.enable) { return isDark ? '#2c3950' : '#bcbcbc'; diff --git a/web/html/xui/client_modal.html b/web/html/xui/client_modal.html index d9e9a0a2..265a2cac 100644 --- a/web/html/xui/client_modal.html +++ b/web/html/xui/client_modal.html @@ -112,9 +112,6 @@ get isExpiry() { return this.clientModal.isEdit && this.client.expiryTime >0 ? (this.client.expiryTime < new Date().getTime()) : false; }, - get statsColor() { - return usageColor(clientStats.up + clientStats.down, app.trafficDiff, this.client.totalGB); - }, get delayedStart() { return this.clientModal.delayedStart; }, diff --git a/web/html/xui/form/client.html b/web/html/xui/form/client.html index 63080ab7..724f067b 100644 --- a/web/html/xui/form/client.html +++ b/web/html/xui/form/client.html @@ -117,7 +117,7 @@ - diff --git a/web/html/xui/inbound_info_modal.html b/web/html/xui/inbound_info_modal.html index ba4ec980..e1f11b45 100644 --- a/web/html/xui/inbound_info_modal.html +++ b/web/html/xui/inbound_info_modal.html @@ -10,38 +10,43 @@ @@ -64,13 +69,13 @@
- - - + + +
{{ i18n "protocol" }}[[ dbInbound.protocol ]]
{{ i18n "pages.inbounds.address" }}[[ dbInbound.address ]]
{{ i18n "pages.inbounds.port" }}[[ dbInbound.port ]]
{{ i18n "protocol" }}[[ dbInbound.protocol ]]
{{ i18n "pages.inbounds.address" }}[[ dbInbound.address ]]
{{ i18n "pages.inbounds.port" }}[[ dbInbound.port ]]
- + - + - +
{{ i18n "transmission" }}[[ inbound.network ]]{{ i18n "transmission" }}[[ inbound.network ]]
- + - + - +
{{ i18n "encryption" }}[[ inbound.settings.method ]][[ inbound.settings.method ]]
{{ i18n "password" }}[[ inbound.settings.password ]][[ inbound.settings.password ]]
{{ i18n "pages.inbounds.network" }}[[ inbound.settings.network ]][[ inbound.settings.network ]]