From 4a3426e04fc7e0dcf059c17612152f726a2102f7 Mon Sep 17 00:00:00 2001 From: shats Date: Sun, 7 Dec 2025 12:56:41 +0700 Subject: [PATCH] refactor: Update EasySwitchManager layout for improved community and gateway display, enhancing visual structure and user interaction with better card organization and positioning. --- frontend/src/EasySwitchManager.jsx | 103 +++++++++++++++++------------ 1 file changed, 61 insertions(+), 42 deletions(-) diff --git a/frontend/src/EasySwitchManager.jsx b/frontend/src/EasySwitchManager.jsx index c6dfbf7..5e20ce7 100644 --- a/frontend/src/EasySwitchManager.jsx +++ b/frontend/src/EasySwitchManager.jsx @@ -432,32 +432,34 @@ function EasySwitchManager() {
- {/* ВСЕ Communities для этого сервера */} - {filteredCommunitiesForServer.map((comm) => { - const activeKey = `${server.id}:${comm.value}`; - const activeGw = activeGateways[activeKey]; - const hasFilterForComm = server.filtersMap.has(comm.value); - - return ( -
- {/* Заголовок community */} -
- - {comm.value} - - {comm.name || comm.description || ''} - {hasFilterForComm && ( - - настроен - - )} - - ({server.gateways.length}) - -
- - {/* Сетка карточек ВСЕх шлюзов сервера */} -
+ {/* Сетка Communities для этого сервера */} +
+ {filteredCommunitiesForServer.map((comm) => { + const activeKey = `${server.id}:${comm.value}`; + const activeGw = activeGateways[activeKey]; + const hasFilterForComm = server.filtersMap.has(comm.value); + + return ( +
+
+ {/* Заголовок community */} +
+ + {comm.value} + + {comm.name || comm.description || ''} + {hasFilterForComm && ( + + настроен + + )} + + ({server.gateways.length}) + +
+ + {/* Сетка карточек шлюзов для этого community */} +
{server.gateways.map((gw, idx) => { const isActive = activeGw === gw.name; const isFastest = idx === 0; @@ -472,7 +474,8 @@ function EasySwitchManager() { transition: 'all 0.15s ease', border: isActive ? '2px solid var(--tblr-primary)' : '1px solid rgba(0,0,0,0.1)', borderRadius: '8px', - boxShadow: isActive ? '0 4px 12px rgba(32, 107, 196, 0.3)' : 'none' + boxShadow: isActive ? '0 4px 12px rgba(32, 107, 196, 0.3)' : 'none', + position: 'relative' }} onClick={() => handleGatewaySelect(server.id, comm.value, gw.name)} onMouseEnter={(e) => { @@ -489,30 +492,44 @@ function EasySwitchManager() { }} >
- {/* Галочка и метка Fastest */} -
+ {/* Галочка (абсолютное позиционирование) */} + {isActive && ( +
+ +
+ )} + + {/* Метка Fastest */} +
{isFastest && !isActive && ( Fast )} - {!isFastest && } - {isActive && ( -
- -
- )}
{/* Название шлюза */} -
+
{gw.name}
+ {/* Описание шлюза */} + {gw.comment && ( +
+ {gw.comment} +
+ )} + {/* Протокол */}
{serverMeta?.provider || 'vless / xudp'} @@ -527,10 +544,12 @@ function EasySwitchManager() {
); })} +
+
-
- ); - })} + ); + })} +
);