From 02a45fce71d02dd4edbb232368b5fefe07b05ddd Mon Sep 17 00:00:00 2001 From: shats Date: Tue, 24 Feb 2026 11:46:30 +0700 Subject: [PATCH] feat(EasySwitch): enhance Easy Switch UI with new styles and layout adjustments for improved user experience --- frontend/src/App.css | 76 +++++++++++ frontend/src/EasySwitchManager.jsx | 203 ++++++----------------------- 2 files changed, 119 insertions(+), 160 deletions(-) diff --git a/frontend/src/App.css b/frontend/src/App.css index 1fe739c..988f9fc 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -697,6 +697,82 @@ body.sidebar-overlay-open { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); } +/* Easy Switch: bring visuals in line with Tabler pages */ +.easy-switch-page .card-tabs .nav-link { + font-weight: 500; +} + +.easy-switch-server-header { + background-color: rgba(32, 107, 196, 0.05); + cursor: pointer; + user-select: none; +} + +.easy-switch-flag { + font-size: 1.5rem; + line-height: 1; +} + +.easy-switch-gateway-card { + cursor: pointer; + transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; + border: 1px solid var(--tblr-border-color); + position: relative; +} + +.easy-switch-gateway-card:hover { + transform: translateY(-1px); + box-shadow: 0 0.125rem 0.375rem rgba(32, 41, 57, 0.1); +} + +.easy-switch-gateway-card-active { + border: 1px solid var(--tblr-primary) !important; + box-shadow: 0 0.25rem 0.75rem rgba(32, 107, 196, 0.25); +} + +.easy-switch-active-check { + width: 20px; + height: 20px; + position: absolute; + top: 8px; + right: 8px; +} + +.easy-switch-fast-slot { + min-height: 18px; +} + +.easy-switch-fast-badge { + font-size: 0.65rem; + padding: 2px 6px; +} + +.easy-switch-gateway-flag { + width: 28px; + height: 28px; + font-size: 1.25rem; + line-height: 1; + background-color: rgba(0, 0, 0, 0.06); +} + +.easy-switch-gateway-flag-active { + background-color: rgba(255, 255, 255, 0.25); +} + +.easy-switch-gateway-title { + font-size: 0.85rem; + line-height: 1.2; + word-break: break-word; +} + +.easy-switch-gateway-ip { + font-size: 0.75rem; +} + +.easy-switch-gateway-ping { + font-size: 1.1rem; +} + /* Ripple effect для кнопок */ @keyframes ripple { to { diff --git a/frontend/src/EasySwitchManager.jsx b/frontend/src/EasySwitchManager.jsx index 6ebb9a6..437fdeb 100644 --- a/frontend/src/EasySwitchManager.jsx +++ b/frontend/src/EasySwitchManager.jsx @@ -505,7 +505,7 @@ function EasySwitchManager() { if (loading && servers.length === 0) { return ( -
+
} @@ -525,7 +525,7 @@ function EasySwitchManager() { } return ( -
+
} @@ -554,7 +554,7 @@ function EasySwitchManager() { /> {/* Вкладки */} -
+
-
-
+
{/* Список серверов с communities и шлюзами */} {filteredServers.length === 0 ? ( @@ -726,12 +728,7 @@ function EasySwitchManager() {
{/* Заголовок сервера (кликабельный) */}
toggleServerExpanded(server.id)} >
@@ -742,7 +739,7 @@ function EasySwitchManager() { )} - {flag && {flag}} + {flag && {flag}}

{server.name}

{server.description && ( @@ -793,7 +790,7 @@ function EasySwitchManager() {
{/* Заголовок группы тегов */}
- + {tag} @@ -813,12 +810,12 @@ function EasySwitchManager() {
{/* Заголовок community */}
- + {comm.value} {comm.name || comm.description || ''} {hasFilterForComm && ( - + настроен )} @@ -842,50 +839,21 @@ function EasySwitchManager() { return (
handleGatewaySelect(server.id, comm.value, gw.name)} - onMouseEnter={(e) => { - if (!isActive) { - e.currentTarget.style.boxShadow = '0 2px 6px rgba(0,0,0,0.1)'; - e.currentTarget.style.transform = 'translateY(-1px)'; - } - }} - onMouseLeave={(e) => { - if (!isActive) { - e.currentTarget.style.boxShadow = 'none'; - e.currentTarget.style.transform = 'translateY(0)'; - } - }} >
{/* Галочка (абсолютное позиционирование) */} {isActive && ( -
+
)} {/* Метка Fastest */} -
+
{isFastest && !isActive && ( - + Fast @@ -895,22 +863,14 @@ function EasySwitchManager() { {/* Флаг и название (комментарий) шлюза */}
{countryToFlag(gw.country || country || '') || '🌐'}
{gw.comment || gw.name}
@@ -919,17 +879,16 @@ function EasySwitchManager() { {/* IP шлюза ниже */} {gw.ip && (
{gw.ip}
)} {/* Метрика (пинг) */} -
+
{ping != null ? ping : '—'}
@@ -952,7 +911,7 @@ function EasySwitchManager() {
{/* Заголовок группы без тегов */}
- + Без тегов @@ -972,12 +931,12 @@ function EasySwitchManager() {
{/* Заголовок community */}
- + {comm.value} {comm.name || comm.description || ''} {hasFilterForComm && ( - + настроен )} @@ -1001,50 +960,21 @@ function EasySwitchManager() { return (
handleGatewaySelect(server.id, comm.value, gw.name)} - onMouseEnter={(e) => { - if (!isActive) { - e.currentTarget.style.boxShadow = '0 2px 6px rgba(0,0,0,0.1)'; - e.currentTarget.style.transform = 'translateY(-1px)'; - } - }} - onMouseLeave={(e) => { - if (!isActive) { - e.currentTarget.style.boxShadow = 'none'; - e.currentTarget.style.transform = 'translateY(0)'; - } - }} >
{/* Галочка (абсолютное позиционирование) */} {isActive && ( -
+
)} {/* Метка Fastest */} -
+
{isFastest && !isActive && ( - + Fast @@ -1054,22 +984,14 @@ function EasySwitchManager() { {/* Флаг и название (комментарий) шлюза */}
{countryToFlag(gw.country || country || '') || '🌐'}
{gw.comment || gw.name}
@@ -1078,17 +1000,16 @@ function EasySwitchManager() { {/* IP шлюза ниже */} {gw.ip && (
{gw.ip}
)} {/* Метрика (пинг) */} -
+
{ping != null ? ping : '—'}
@@ -1120,12 +1041,12 @@ function EasySwitchManager() {
{/* Заголовок community */}
- + {comm.value} {comm.name || comm.description || ''} {hasFilterForComm && ( - + настроен )} @@ -1149,50 +1070,21 @@ function EasySwitchManager() { return (
handleGatewaySelect(server.id, comm.value, gw.name)} - onMouseEnter={(e) => { - if (!isActive) { - e.currentTarget.style.boxShadow = '0 2px 6px rgba(0,0,0,0.1)'; - e.currentTarget.style.transform = 'translateY(-1px)'; - } - }} - onMouseLeave={(e) => { - if (!isActive) { - e.currentTarget.style.boxShadow = 'none'; - e.currentTarget.style.transform = 'translateY(0)'; - } - }} >
{/* Галочка (абсолютное позиционирование) */} {isActive && ( -
+
)} {/* Метка Fastest */} -
+
{isFastest && !isActive && ( - + Fast @@ -1202,22 +1094,14 @@ function EasySwitchManager() { {/* Флаг и название (комментарий) шлюза */}
{countryToFlag(gw.country || country || '') || '🌐'}
{gw.comment || gw.name}
@@ -1226,15 +1110,14 @@ function EasySwitchManager() { {/* IP шлюза ниже */} {gw.ip && (
{gw.ip}
)} {/* Метрика (пинг) */} -
+
{ping != null ? ping : '—'}