From ebfc5a9fab74ee93d32372862842f1b6f19c96b3 Mon Sep 17 00:00:00 2001 From: Denis Shatskiy Date: Fri, 8 Aug 2025 12:03:20 +0700 Subject: [PATCH] feat: Add favicon display functionality in BillingManager for improved visual identification of providers --- frontend/src/BillingManager.jsx | 92 +++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 40 deletions(-) diff --git a/frontend/src/BillingManager.jsx b/frontend/src/BillingManager.jsx index 5fdbe4f..89581d2 100644 --- a/frontend/src/BillingManager.jsx +++ b/frontend/src/BillingManager.jsx @@ -325,6 +325,30 @@ function BillingManager() { return String.fromCodePoint(...codePoints); } + // Favicon для провайдера по ссылке входа + function normalizeToUrl(value) { + if (!value) return ''; + try { + const hasProtocol = /^https?:\/\//i.test(value); + const url = new URL(hasProtocol ? value : `https://${value}`); + return url.toString(); + } catch { + return ''; + } + } + + function getFaviconUrl(loginUrl) { + const normalized = normalizeToUrl(loginUrl); + if (!normalized) return ''; + try { + const { hostname } = new URL(normalized); + // DuckDuckGo Icons API: быстрая выдача favicon по домену + return `https://icons.duckduckgo.com/ip3/${hostname}.ico`; + } catch { + return ''; + } + } + function getCountryFlag(countryRaw) { if (!countryRaw) return ''; const value = String(countryRaw).trim(); @@ -717,9 +741,19 @@ function BillingManager() { - - {item.provider} - +
+ {item.loginUrl && ( + { e.currentTarget.style.display = 'none'; }} + /> + )} + {item.provider} +
@@ -880,7 +914,19 @@ function BillingManager() {
{r.server.hostName}
-
{r.server.provider}
+
+ {r.server.loginUrl && ( + { e.currentTarget.style.display = 'none'; }} + /> + )} + {r.server.provider} +
{formatDate(r.date)} @@ -1318,42 +1364,8 @@ function EditBillingModal({ show, item, onItemChange, onSubmit, onClose }) { />
- {/* Исторические платежи */} -
-
Исторические платежи
-
-
- - onItemChange({ ...item, lastPaymentDate: e.target.value })} - /> -
-
- - onItemChange({ ...item, lastPaymentAmount: parseFloat(e.target.value) || 0 })} - /> -
-
- - -
-
+ {/* Дополнительно */} +