feat: implement UI privacy and aesthetic refinements (hidden usernames, random icons, compact layout)

This commit is contained in:
jason
2026-03-04 00:19:56 +08:00
parent 2c5462951d
commit 0f9809b064
3 changed files with 88 additions and 20 deletions

View File

@@ -215,13 +215,15 @@ button {
background: var(--panel-bg); background: var(--panel-bg);
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
border-radius: 12px; border-radius: 12px;
padding: 10px 12px; padding: 8px 12px;
/* 减少高度,从 10px 降到 8px */
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s; transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
box-shadow: var(--shadow-sm); box-shadow: var(--shadow-sm);
cursor: grab; margin-bottom: 8px;
/* 紧凑间距 */
} }
.rule-item:active { .rule-item:active {
@@ -273,22 +275,38 @@ button {
background: rgba(59, 130, 246, 0.1); background: rgba(59, 130, 246, 0.1);
} }
.rule-icon-box {
width: 28px;
height: 28px;
background: rgba(59, 130, 246, 0.08);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
color: var(--accent-color);
margin-right: 10px;
flex-shrink: 0;
}
.rule-domain { .rule-domain {
font-size: 13px; font-size: 13px;
font-weight: 600; font-weight: 500;
margin-bottom: 2px; color: var(--text-primary);
display: flex;
align-items: center;
gap: 6px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
color: var(--text-primary);
} }
.rule-env { .rule-env {
display: inline-block; display: inline-block;
padding: 2px 6px; padding: 1px 6px;
border-radius: 4px; border-radius: 4px;
font-size: 10px; font-size: 10px;
font-weight: 500; font-weight: 600;
text-transform: uppercase;
margin-left: 6px; margin-left: 6px;
vertical-align: middle; vertical-align: middle;
} }
@@ -317,14 +335,6 @@ button {
border: 1px solid #FBCFE8; border: 1px solid #FBCFE8;
} }
.rule-acc {
font-size: 11px;
color: var(--text-secondary);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.rule-actions { .rule-actions {
display: flex; display: flex;
gap: 4px; gap: 4px;
@@ -374,12 +384,21 @@ button {
opacity: 0.85; opacity: 0.85;
background: rgba(248, 250, 252, 0.6); background: rgba(248, 250, 252, 0.6);
border-style: dashed; border-style: dashed;
padding-left: 8px; /* 移除拖拽手柄留下的空白 */ padding: 8px 12px !important;
width: 100% !important;
box-sizing: border-box !important;
margin-bottom: 8px;
margin-left: 0 !important;
} }
#archive-list .rule-info { #archive-list .rule-info {
filter: grayscale(0.4); filter: grayscale(0.4);
padding-left: 4px; /* 让文字更靠左 */ flex: 1;
}
#archive-list .rule-icon-box {
background: rgba(100, 116, 139, 0.1);
color: var(--text-secondary);
} }
#archive-list .rule-item:hover { #archive-list .rule-item:hover {

29
popup.css.tmp Normal file
View File

@@ -0,0 +1,29 @@
/* Archived Items Polish */
#archive-list {
list-style: none;
padding: 0;
margin: 0;
width: 100%;
}
#archive-list .rule-item {
opacity: 0.85;
background: rgba(248, 250, 252, 0.6);
border-style: dashed;
padding: 10px 12px !important;
width: 100% !important;
box-sizing: border-box !important;
margin-bottom: 10px;
margin-left: 0 !important;
}
#archive-list .rule-info {
filter: grayscale(0.4);
flex: 1;
}
#archive-list .rule-item:hover {
opacity: 1;
background: #ffffff;
border-style: solid;
}

View File

@@ -70,6 +70,26 @@ document.addEventListener('DOMContentLoaded', () => {
return /[\u4E00-\u9FA5]/.test(str); return /[\u4E00-\u9FA5]/.test(str);
} }
const ICON_SET = [
'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>', // User
'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="4" y="2" width="16" height="20" rx="2" ry="2"/><line x1="9" y1="22" x2="9" y2="22"/><line x1="15" y1="22" x2="15" y2="22"/><line x1="12" y1="18" x2="12" y2="18"/><line x1="9" y1="14" x2="9" y2="14"/><line x1="15" y1="14" x2="15" y2="14"/><line x1="9" y1="10" x2="9" y2="10"/><line x1="15" y1="10" x2="15" y2="10"/><line x1="9" y1="6" x2="9" y2="6"/><line x1="15" y1="6" x2="15" y2="6"/></svg>', // Building
'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg>', // Shield
'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3m-3-3l-2.5-2.5"/></svg>', // Key
'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>', // Globe
'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="7" width="20" height="14" rx="2" ry="2"/><path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"/></svg>', // Briefcase
'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>', // Zap
'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/><path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/></svg>' // Database
];
function getRandomIcon(seed) {
// Use a simple hash of the seed (rule ID) to pick a stable icon
let hash = 0;
for (let i = 0; i < seed.length; i++) {
hash = seed.charCodeAt(i) + ((hash << 5) - hash);
}
return ICON_SET[Math.abs(hash) % ICON_SET.length];
}
// --- Auth View Controllers --- // --- Auth View Controllers ---
function showView(viewName) { function showView(viewName) {
if (loginView) loginView.classList.add('hidden'); if (loginView) loginView.classList.add('hidden');
@@ -324,12 +344,12 @@ document.addEventListener('DOMContentLoaded', () => {
<div class="drag-handle" title="拖拽排序"> <div class="drag-handle" title="拖拽排序">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M8 9h8M8 15h8" /></svg> <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M8 9h8M8 15h8" /></svg>
</div> </div>
<div class="rule-icon-box">${getRandomIcon(rule.id)}</div>
<div class="rule-info" data-id="${rule.id}" title="点击执行一键登录"> <div class="rule-info" data-id="${rule.id}" title="点击执行一键登录">
<div class="rule-domain"> <div class="rule-domain">
${rule.clientName} ${rule.clientName}
<span class="rule-env env-${rule.env.toLowerCase().replace('_', '-')}">${rule.env.replace('_', ' ')}</span> <span class="rule-env env-${rule.env.toLowerCase().replace('_', '-')}">${rule.env.replace('_', ' ')}</span>
</div> </div>
<div class="rule-acc">帐号: ${rule.username}</div>
</div> </div>
<div class="rule-actions"> <div class="rule-actions">
<button class="icon-btn btn-edit" data-id="${rule.id}" title="编辑此配置"> <button class="icon-btn btn-edit" data-id="${rule.id}" title="编辑此配置">
@@ -365,9 +385,9 @@ document.addEventListener('DOMContentLoaded', () => {
const li = document.createElement('li'); const li = document.createElement('li');
li.className = 'rule-item'; li.className = 'rule-item';
li.innerHTML = ` li.innerHTML = `
<div class="rule-icon-box">${getRandomIcon(rule.id)}</div>
<div class="rule-info"> <div class="rule-info">
<div class="rule-domain">${rule.clientName} <span class="rule-env env-${rule.env.toLowerCase().replace('_', '-')}">${rule.env.replace('_', ' ')}</span></div> <div class="rule-domain">${rule.clientName} <span class="rule-env env-${rule.env.toLowerCase().replace('_', '-')}">${rule.env.replace('_', ' ')}</span></div>
<div class="rule-acc">帐号: ${rule.username}</div>
</div> </div>
<div class="rule-actions"> <div class="rule-actions">
<button class="icon-btn btn-restore" data-id="${rule.id}" title="恢复到主列表"> <button class="icon-btn btn-restore" data-id="${rule.id}" title="恢复到主列表">