From fd059a6db19eaa85d48e2c5db7894519be52d1ba Mon Sep 17 00:00:00 2001 From: shuaiplus <2327005759@qq.com> Date: Sat, 31 May 2025 22:32:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=80=E4=BA=9B=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=9A=84=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/css/style.css | 57 ++++++++++++++---------------------------- client/js/chat.js | 5 ++-- client/js/room.js | 2 +- client/js/ui.js | 7 ++++++ client/js/util.i18n.js | 12 ++++++--- 5 files changed, 38 insertions(+), 45 deletions(-) diff --git a/client/css/style.css b/client/css/style.css index c105352..1efbbf2 100644 --- a/client/css/style.css +++ b/client/css/style.css @@ -139,7 +139,7 @@ body { } /* Language switcher specific styles */ -/* 语言切换器专用样式 */ +/* 语言切换器专用样式 */npx browserify ChatCrypt.cjs -o ChatCrypt.js .language-current { font-weight: 500; color: #30a8f7; @@ -183,7 +183,7 @@ body { .language-select:focus { border-color: #30a8f7; - box-shadow: 0 0 0 3px rgba(48, 168, 247, 0.1); + box-shadow: 0 0 0 3px rgba(48,168,247,0.1); } .language-select option { @@ -982,10 +982,8 @@ body { } .rightbar-header { - padding: 23.27px 18px 24px 18px; + padding: 20.27px 18px 24px 18px; border-bottom: 1px solid #dcdcdc; - background: #fff; - border-radius: 0 12px 0 0; } .rightbar-group { @@ -1071,6 +1069,20 @@ body { color: #30a8f7; } +.member-tip { + font-size: 13px; + color: #888; + padding: 4px 18px 2px 18px; + margin: 0 0 2px 0; + user-select: none; +} + +.member-tip-center { + text-align: center; + justify-content: center; + display: flex; +} + ::-webkit-scrollbar { width: 4px; background: #fff; @@ -1096,7 +1108,7 @@ body { .file-main-content { display: flex; align-items: center; - padding: 6px 6px; + padding: 3px 3px; gap: 12px; max-width: 200px; } @@ -1619,7 +1631,7 @@ body { } .file-main-content { - padding: 10px 14px; + padding: 3px 3px; gap: 10px; } @@ -1660,37 +1672,6 @@ body { } } -@media (max-width: 480px) { - .file-message { - max-width: 240px; - } - - .file-main-content { - padding: 8px 12px; - gap: 8px; - /* 保持水平布局,不改为垂直 */ - display: flex; - align-items: center; - } - - .file-info { - flex: 1; - min-width: 0; - } - - .file-download-btn { - width: 32px; - height: 32px; - padding: 6px; - flex-shrink: 0; - } - - .file-download-btn svg { - width: 16px; - height: 16px; - } -} - @keyframes fadeInUp { from { diff --git a/client/js/chat.js b/client/js/chat.js index 167c509..a95049c 100644 --- a/client/js/chat.js +++ b/client/js/chat.js @@ -361,8 +361,9 @@ function renderFileMessage(fileData, isSender) { // For archive files, show file count and total size let displayName, displayMeta; if (isArchive && fileCount) { - displayName = `${fileCount} files`; - displayMeta = `Total: ${formatFileSize(originalSize)}`; + // 使用 i18n,保持原格式 + displayName = `${fileCount}${t('file.files', ' files')}`; + displayMeta = `${t('file.total', 'Total')}: ${formatFileSize(originalSize)}`; } else { displayName = fileName; displayMeta = formatFileSize(originalSize); diff --git a/client/js/room.js b/client/js/room.js index a6169e7..0c931d0 100644 --- a/client/js/room.js +++ b/client/js/room.js @@ -217,7 +217,7 @@ export function handleClientLeft(idx, clientId) { } const user = rd.userMap[clientId]; const name = user ? (user.userName || user.username || user.name || 'Anonymous') : 'Anonymous'; - const msg = `${name} left`; + const msg = `${name} ${t('system.left', 'left the conversation')}`; rd.messages.push({ type: 'system', text: msg diff --git a/client/js/ui.js b/client/js/ui.js index 4dec30d..3d0dca8 100644 --- a/client/js/ui.js +++ b/client/js/ui.js @@ -264,6 +264,13 @@ export function renderUserList(updateHeader = false) { if (!rd) return; const me = rd.userList.find(u => u.clientId === rd.myId); const others = rd.userList.filter(u => u.clientId !== rd.myId); + // 新增:如有其他成员,顶部插入简洁提示 + if (others.length > 0) { + const tip = document.createElement('div'); + tip.className = 'member-tip member-tip-center'; + tip.textContent = t('ui.start_private_chat', '选择用户开始私信'); + userListEl.appendChild(tip); + } if (me) userListEl.appendChild(createUserItem(me, true)); others.forEach(u => userListEl.appendChild(createUserItem(u, false))); if (updateHeader) { diff --git a/client/js/util.i18n.js b/client/js/util.i18n.js index f07bf55..50c0885 100644 --- a/client/js/util.i18n.js +++ b/client/js/util.i18n.js @@ -24,6 +24,7 @@ const LANGUAGES = { 'ui.private_message_to': 'Private Message to', 'ui.me': ' (me)', 'ui.anonymous': 'Anonymous', + 'ui.start_private_chat': 'Select for private chat', // Settings panel 'settings.title': 'Settings', @@ -79,6 +80,7 @@ const LANGUAGES = { 'system.security_warning': '⚠️ This link uses an old format. Room data is not encrypted.', 'system.file_send_failed': 'Failed to send files:', 'system.joined': 'joined the conversation', + 'system.left': 'left the conversation', 'system.secured': 'connection secured', 'system.private_message_failed': 'Cannot send private message to', 'system.private_file_failed': 'Cannot send private file to', @@ -91,20 +93,21 @@ const LANGUAGES = { flag: '🇨🇳', translations: { // Login and main UI - 'ui.enter_node': '进入节点', + 'ui.enter_node': '进入新的节点', 'ui.username': '用户名', 'ui.node_name': '节点名称', 'ui.node_password': '节点密码', 'ui.optional': '(可选)', - 'ui.enter': '进入', + 'ui.enter': '确定', 'ui.connecting': '连接中...', - 'ui.node_exists': '节点已存在', + 'ui.node_exists': '此节点已存在', 'ui.my_name': '我的名字', - 'ui.members': '成员', + 'ui.members': '在线成员', 'ui.message': '消息', 'ui.private_message_to': '私信给', 'ui.me': '(我)', 'ui.anonymous': '匿名用户', + 'ui.start_private_chat': '选择用户开始私信', // Settings panel 'settings.title': '设置', @@ -160,6 +163,7 @@ const LANGUAGES = { 'system.security_warning': '⚠️ 此链接使用旧格式,房间数据未加密。', 'system.file_send_failed': '文件发送失败:', 'system.joined': '加入了对话', + 'system.left': '离开了对话', 'system.secured': '连接已安全', 'system.private_message_failed': '无法发送私信给', 'system.private_file_failed': '无法发送私密文件给',