diff --git a/src/renderer/src/components/DatabaseConnectionPage.tsx b/src/renderer/src/components/DatabaseConnectionPage.tsx index 8e4ad2b..f21a179 100644 --- a/src/renderer/src/components/DatabaseConnectionPage.tsx +++ b/src/renderer/src/components/DatabaseConnectionPage.tsx @@ -1,6 +1,7 @@ import React from 'react' import type { DatabaseKeyEnvironment, WechatAccountCandidate } from '../../../shared/database-key' import { WINDOWS_VC_RUNTIME_DOWNLOAD_URL } from '../../../shared/windows-runtime' +import { Button, IconButton, Input, Tabs, TabsList, TabsTrigger } from './ui' const GUIDE_URL = 'https://github.com/Wxw-Gu/WechatExplorer/blob/main/docs/user-guide/getting-started.md' @@ -207,366 +208,360 @@ export function DatabaseConnectionPage({ 查看 5 分钟上手教程 → -
- - -
+ 开始连接 + 高级用户:已有数据库密钥?手动连接 + - {mode === 'automatic' ? ( -
-
- {Array.from({ length: 6 }, (_, index) => ( - - ))} -
-
-
- - - -
- - {statusKind === 'error' - ? '当前步骤未完成' - : [ - '检查本机环境', - '让微信停在登录页面', - '确认开始准备', - `正在完成 ${isMac ? 'macOS' : 'Windows'} 授权`, - '获取成功, 现在可以重新登录微信了', - '验证数据库连接' - ][guideStep - 1]} - -

- {statusKind === 'error' - ? status - : status || - [ - '确认下方检测结果;没有找到目录时可以手动选择。', - '请退出当前微信账号,让微信停留在登录页面,然后点击“我已准备好”。', - '开始后请按页面提示完成系统授权。', - '正在准备连接组件,请不要关闭微信或 TraceMemo。', - '请回到微信完成登录,登录成功后再回来验证。', - '正在验证密钥和本地数据库,请稍候。' - ][guideStep - 1]} -

-
+ {mode === 'automatic' ? ( +
+
+ {Array.from({ length: 6 }, (_, index) => ( + + ))}
- {guideStep === 1 && ( - <> -
-
-
操作系统
-
{environment?.osVersion || (isMac ? 'macOS' : 'Windows')}
-
-
-
微信版本
-
{environment?.wechatVersion || '未检测到'}
-
-
-
数据结构
-
{environment?.dataStructureVersion || '未检测到'}
-
-
-
- 存储路径 - -
-
- - onDbRootChange(event.target.value)} - placeholder={defaultPath} - title={dbRoot || defaultPath} - aria-label="微信数据存储路径" - spellCheck={false} - onFocus={(event) => event.currentTarget.select()} - /> - - {dbRoot || defaultPath} +
+
+ + + +
+ + {statusKind === 'error' + ? '当前步骤未完成' + : [ + '检查本机环境', + '让微信停在登录页面', + '确认开始准备', + `正在完成 ${isMac ? 'macOS' : 'Windows'} 授权`, + '获取成功, 现在可以重新登录微信了', + '验证数据库连接' + ][guideStep - 1]} + +

+ {statusKind === 'error' + ? status + : status || + [ + '确认下方检测结果;没有找到目录时可以手动选择。', + '请退出当前微信账号,让微信停留在登录页面,然后点击“我已准备好”。', + '开始后请按页面提示完成系统授权。', + '正在准备连接组件,请不要关闭微信或 TraceMemo。', + '请回到微信完成登录,登录成功后再回来验证。', + '正在验证密钥和本地数据库,请稍候。' + ][guideStep - 1]} +

+
+
+ {guideStep === 1 && ( + <> +
+
+
操作系统
+
{environment?.osVersion || (isMac ? 'macOS' : 'Windows')}
+
+
+
微信版本
+
{environment?.wechatVersion || '未检测到'}
+
+
+
数据结构
+
{environment?.dataStructureVersion || '未检测到'}
+
+
+
+ 存储路径 + +
+
+ + onDbRootChange(event.target.value)} + placeholder={defaultPath} + title={dbRoot || defaultPath} + aria-label="微信数据存储路径" + spellCheck={false} + onFocus={(event) => event.currentTarget.select()} + /> + + {dbRoot || defaultPath} + - - +
+
+
+
微信状态
+
{environment?.wechatRunning ? '运行中' : '未检测到'}
+
+
+ {accounts.length > 0 && ( +
+

选择微信账号

+ {accounts.map((account) => ( + + ))} + -
-
-
-
微信状态
-
{environment?.wechatRunning ? '运行中' : '未检测到'}
-
-
- {accounts.length > 0 && ( -
-

选择微信账号

- {accounts.map((account) => ( - - ))} - -
- )} + 选择其他账号 + + + )} + + )} +
+ {guideStep === 1 && ( + <> + + + )} -
- {guideStep === 1 && ( - <> - + )} + {guideStep === 3 && ( + + )} + {guideStep === 4 && ( + + )} + {guideStep === 5 && ( + - - + )} + {guideStep > 1 && !isFetching && !isConnecting && ( +
+ + +
+ )} + {(isFetching || isConnecting) && ( + - - )} - {guideStep === 2 && ( - - )} - {guideStep === 3 && ( - - )} - {guideStep === 4 && ( - - )} - {guideStep === 5 && ( - - )} - {guideStep === 6 && ( - - )} - {guideStep > 1 && !isFetching && !isConnecting && ( -
- - + 取消 + + )} +

+ {isMac ? ( + <> + macOS 首次获取密钥需要关闭 SIP。{' '} + + 查看说明 + + + ) : ( + <> + Windows 需要 Microsoft Visual C++ 2015-2022 x64 运行库。{' '} + + 下载运行库 + + + )} +

+ {showMacKeyFaq && isMac && ( + + 获取失败?查看连接排查 + + )} +
+ ) : ( +
+

+ 仅适用于已经通过其他方式获得当前微信账号数据库密钥的高级用户。第一次使用请返回“开始连接”。 +

+
+ +
+ onDbKeyChange(event.target.value)} + placeholder="输入或粘贴 64 位数据库密钥" + autoComplete="off" + spellCheck={false} + /> + + + +
+ 密钥通过系统安全存储加密保存在当前设备。
- )} - {(isFetching || isConnecting) && ( - - )} -

- {isMac ? ( - <> - macOS 首次获取密钥需要关闭 SIP。{' '} - - 查看说明 - - - ) : ( - <> - Windows 需要 Microsoft Visual C++ 2015-2022 x64 运行库。{' '} + {platform === 'win32' && ( +

+ +
+ onDbRootChange(event.target.value)} + placeholder={defaultPath} + title={dbRoot || defaultPath} + spellCheck={false} + onFocus={(event) => event.currentTarget.select()} + /> + +
+
+ )} + {status &&
{status}
} + {platform === 'win32' && ( +

+ 无法加载数据库组件时,请安装 Microsoft Visual C++ 2015-2022 x64 运行库。{' '} 下载运行库 - +

)} -

- {showMacKeyFaq && isMac && ( - - 获取失败?查看连接排查 - - )} -
- ) : ( -
-

- 仅适用于已经通过其他方式获得当前微信账号数据库密钥的高级用户。第一次使用请返回“开始连接”。 -

-
- -
- onDbKeyChange(event.target.value)} - placeholder="输入或粘贴 64 位数据库密钥" - autoComplete="off" - spellCheck={false} - /> - -
- 密钥通过系统安全存储加密保存在当前设备。 -
- {platform === 'win32' && ( -
- -
- onDbRootChange(event.target.value)} - placeholder={defaultPath} - title={dbRoot || defaultPath} - spellCheck={false} - onFocus={(event) => event.currentTarget.select()} - /> - -
-
- )} - {status &&
{status}
} - {platform === 'win32' && ( -

- 无法加载数据库组件时,请安装 Microsoft Visual C++ 2015-2022 x64 运行库。{' '} - - 下载运行库 - -

- )} - - {isConnecting && ( - - )} - -
- )} + {isConnecting ? '正在连接…' : '连接数据库'} + + {isConnecting && ( + + )} + +
+ )} +
- + TraceMemo
diff --git a/src/renderer/src/components/chat/ChatHeader.tsx b/src/renderer/src/components/chat/ChatHeader.tsx index 8a0d5f8..3ece724 100644 --- a/src/renderer/src/components/chat/ChatHeader.tsx +++ b/src/renderer/src/components/chat/ChatHeader.tsx @@ -1,6 +1,16 @@ import React, { useState } from 'react' import { Contact } from '../../../../shared/types' -import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '../ui' +import { + Button, + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, + IconButton, + Tooltip, + TooltipContent, + TooltipTrigger +} from '../ui' import { ConversationContentSearch } from './ConversationContentSearch' import { AiIcon, MoreIcon, RefreshIcon, SearchIcon, SendIcon } from './icons' import { supportsPersonalWechatSend } from '../../utils/runtime-environment' @@ -43,7 +53,7 @@ export function ChatHeader({ } return ( -
+
{contact.avatar ? ( @@ -69,54 +79,72 @@ export function ChatHeader({ onClose={handleCloseSearch} /> ) : ( - + )} - + - + onRefreshData?.()}>刷新数据 - - - - + + + 仅支持 macOS + + )} + +
) diff --git a/src/renderer/src/components/chat/ChatStatusBar.tsx b/src/renderer/src/components/chat/ChatStatusBar.tsx index 235a7ec..a9f80a7 100644 --- a/src/renderer/src/components/chat/ChatStatusBar.tsx +++ b/src/renderer/src/components/chat/ChatStatusBar.tsx @@ -1,4 +1,5 @@ import React from 'react' +import { Button, Switch } from '../ui' import { RefreshIcon } from './icons' interface ChatStatusBarProps { @@ -27,11 +28,7 @@ export function ChatStatusBar({
已显示当前范围 {count} 条消息
头像或名称缺失时,请先在微信中进入该聊天 - + - +
) diff --git a/src/renderer/src/components/chat/ConversationContentSearch.tsx b/src/renderer/src/components/chat/ConversationContentSearch.tsx index ac4a29b..ec7f926 100644 --- a/src/renderer/src/components/chat/ConversationContentSearch.tsx +++ b/src/renderer/src/components/chat/ConversationContentSearch.tsx @@ -1,4 +1,5 @@ import React from 'react' +import { IconButton, Input } from '../ui' import { CloseIcon, SearchIcon } from './icons' interface ConversationContentSearchProps { @@ -16,22 +17,30 @@ export function ConversationContentSearch({ }: ConversationContentSearchProps): React.ReactElement { return (
- + - onChange(event.target.value)} + className="h-9 pr-10 pl-9 text-xs min-[901px]:pr-[7.5rem]" autoFocus /> - + {value ? `${resultCount} 条结果` : '输入关键词'} - +
) } diff --git a/src/renderer/src/components/chat/ExportMenu.tsx b/src/renderer/src/components/chat/ExportMenu.tsx index 4b7f7fb..dbca64d 100644 --- a/src/renderer/src/components/chat/ExportMenu.tsx +++ b/src/renderer/src/components/chat/ExportMenu.tsx @@ -1,5 +1,11 @@ import React from 'react' -import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '../ui' +import { + Button, + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger +} from '../ui' import { ArrowDownIcon, ExportIcon } from './icons' export type ExportRange = number | 'all' @@ -22,16 +28,16 @@ export function ExportMenu({ disabled, onExport }: ExportMenuProps): React.React return ( - + {EXPORT_OPTIONS.map((option, index) => ( diff --git a/src/renderer/src/components/chat/PersonalWechatSendDialog.tsx b/src/renderer/src/components/chat/PersonalWechatSendDialog.tsx index 5ca12c4..4d4ef3e 100644 --- a/src/renderer/src/components/chat/PersonalWechatSendDialog.tsx +++ b/src/renderer/src/components/chat/PersonalWechatSendDialog.tsx @@ -2,7 +2,17 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react' import type { Contact } from '../../../../shared/types' import type { PersonalWechatSenderStatus } from '../../../../shared/personal-wechat' import type { TextToSpeechSettings, TextToSpeechVoice } from '../../../../shared/text-to-speech' -import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '../ui' +import { + Button, + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, + SegmentedControl, + SegmentedControlItem, + Textarea +} from '../ui' type SendMode = 'image' | 'voice' type VoiceSource = 'generated' | 'file' @@ -440,22 +450,36 @@ export function PersonalWechatSendDialog({
{(status?.state === 'unsupported_version' || status?.state === 'runtime_missing') && onOpenTextToSpeechSettings ? ( - + ) : null} - - + +
@@ -468,35 +492,32 @@ export function PersonalWechatSendDialog({ ))} -
- - -
+ + {mode === 'image' ? (
图片 - + {image ? (
{image.name} @@ -508,28 +529,20 @@ export function PersonalWechatSendDialog({
) : (
-
- - -
+ + {voiceSource === 'generated' ? (
@@ -539,14 +552,18 @@ export function PersonalWechatSendDialog({ {selectedTtsVoice?.name || '尚未选择音色'}
{onOpenTextToSpeechSettings ? ( - + ) : null}