fix popup ui

This commit is contained in:
go0p
2025-04-15 15:10:02 +08:00
parent ab69b18d6c
commit 80a60d4aff
2 changed files with 17 additions and 3 deletions
+9
View File
@@ -129,6 +129,7 @@ body {
display: flex !important; display: flex !important;
align-items: center !important; align-items: center !important;
border-radius: 6px !important; border-radius: 6px !important;
transition: all 0.2s ease-in-out !important;
} }
.ant-menu-item:hover { .ant-menu-item:hover {
@@ -150,6 +151,7 @@ body {
.ant-menu-item img { .ant-menu-item img {
font-size: 16px; font-size: 16px;
margin-right: 8px; margin-right: 8px;
transition: all 0.2s ease-in-out !important;
} }
.ant-menu-item.ant-menu-item-selected .anticon, .ant-menu-item.ant-menu-item-selected .anticon,
@@ -190,6 +192,13 @@ body {
z-index: 10; z-index: 10;
font-size: 14px; font-size: 14px;
color: var(--yakit-primary); color: var(--yakit-primary);
opacity: 0;
animation: fadeIn 0.2s ease-in-out forwards;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
} }
/* Remove conflicting styles */ /* Remove conflicting styles */
+8 -3
View File
@@ -168,10 +168,14 @@ export const ProxySwitch: React.FC = () => {
return; return;
} }
// 如果当前已经是选中的模式,不做任何操作
if (mode === currentMode) return;
try { try {
// 更新UI状态,避免闪烁 // 立即更新UI状态,避免闪烁
setCurrentMode(mode); setCurrentMode(mode);
setIsLoading(true); // 显示加载状态但不阻塞UI
setTimeout(() => setIsLoading(true), 0);
// 发送切换代理请求 // 发送切换代理请求
const response = await browser.runtime.sendMessage({ const response = await browser.runtime.sendMessage({
@@ -219,7 +223,8 @@ export const ProxySwitch: React.FC = () => {
style={{ style={{
width: 20, width: 20,
height: 20, height: 20,
filter: currentMode === proxy.key ? 'brightness(0) invert(1)' : 'none' filter: currentMode === proxy.key ? 'brightness(0) invert(1)' : 'none',
transition: 'filter 0.2s ease-in-out'
}} }}
/>, />,
className: `${currentMode === proxy.key ? 'active-item' : ''} menu-id-${proxy.key}`, className: `${currentMode === proxy.key ? 'active-item' : ''} menu-id-${proxy.key}`,