From e64bce1d9739289ea8351123b2580fde78cf481b Mon Sep 17 00:00:00 2001 From: gujiangjiang Date: Fri, 17 Oct 2025 23:37:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=A8=A1=E6=80=81=E6=A1=86=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/MailList.tsx | 29 ++++++++++++++++-------- frontend/src/components/icons/Expand.tsx | 21 +++++++++++++++++ frontend/src/pages/Home.tsx | 14 ++++++++++++ 3 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 frontend/src/components/icons/Expand.tsx diff --git a/frontend/src/components/MailList.tsx b/frontend/src/components/MailList.tsx index 185c99e..cfafb8a 100644 --- a/frontend/src/components/MailList.tsx +++ b/frontend/src/components/MailList.tsx @@ -16,6 +16,7 @@ import PasswordIcon from './icons/Password.tsx'; // feat: 导入密码图标 // feat: 导入新组件 import { MailDetail } from '../pages/MailDetail.tsx'; import ArrowUturnLeft from './icons/ArrowUturnLeft.tsx'; +import Expand from './icons/Expand.tsx'; // feat: 导入 Expand 图标 interface MailListProps { emails: Email[]; @@ -33,9 +34,10 @@ interface MailListProps { // feat: 新增 props,用于接收当前选中的邮件和关闭详情页的回调 selectedEmail: Email | null; onCloseDetail: () => void; + onExpand: () => void; // feat: 新增 onExpand 回调 } -export function MailList({ emails, isLoading, isFetching, onDelete, isDeleting, onRefresh, selectedIds, setSelectedIds, isAddressCreated, onSelectEmail, showViewPasswordButton, onShowPassword, selectedEmail, onCloseDetail }: MailListProps) { +export function MailList({ emails, isLoading, isFetching, onDelete, isDeleting, onRefresh, selectedIds, setSelectedIds, isAddressCreated, onSelectEmail, showViewPasswordButton, onShowPassword, selectedEmail, onCloseDetail, onExpand }: MailListProps) { const { t } = useTranslation(); const handleSelect = (id: string) => { @@ -154,14 +156,23 @@ export function MailList({ emails, isLoading, isFetching, onDelete, isDeleting,
{/* feat: 详情页模式下的操作按钮 */} {selectedEmail ? ( - + <> + + + ) : ( <> {/* 列表页模式下的操作按钮 */} diff --git a/frontend/src/components/icons/Expand.tsx b/frontend/src/components/icons/Expand.tsx new file mode 100644 index 0000000..a5c7310 --- /dev/null +++ b/frontend/src/components/icons/Expand.tsx @@ -0,0 +1,21 @@ +// feat: 新增 Expand 图标,用于在模态框中打开邮件 +import { SVGProps } from "react"; + +export default function Expand(props: SVGProps) { + return ( + + + + ); +} \ No newline at end of file diff --git a/frontend/src/pages/Home.tsx b/frontend/src/pages/Home.tsx index 0d6c68e..438e925 100644 --- a/frontend/src/pages/Home.tsx +++ b/frontend/src/pages/Home.tsx @@ -28,6 +28,8 @@ import Info from "../components/icons/Info.tsx"; // refactor: 将导入从 'database' 包更改为本地的类型定义文件 import type { Email } from '../database_types.ts'; +import { InfoModal } from '../components/InfoModal.tsx'; +import { MailDetail } from './MailDetail.tsx'; export function Home() { const config = useConfig(); @@ -41,6 +43,7 @@ export function Home() { const [isTurnstileVerified, setIsTurnstileVerified] = useState(false); const [selectedEmail, setSelectedEmail] = useState(null); // 新增状态,用于存储当前选中的邮件 const [selectedDomain, setSelectedDomain] = useState(config.emailDomain[0]); // feat: 新增状态,用于存储当前选中的域名 + const [showEmailModal, setShowEmailModal] = useState(false); // feat: 新增状态,用于控制邮件详情模态框的显示 // feat: 初始化密码模态框 const { PasswordModal, setShowPasswordModal } = usePasswordModal(); @@ -230,9 +233,19 @@ export function Home() { setSelectedEmail(null); }; + // feat: 新增处理函数,用于在模态框中显示邮件 + const handleExpandEmail = () => { + setShowEmailModal(true); + }; + return (
+ {selectedEmail && ( + + setShowEmailModal(false)} /> + + )}
{/* 左侧信息面板 */}
@@ -325,6 +338,7 @@ export function Home() { // feat: 传递当前选中的邮件和关闭详情页的回调 selectedEmail={selectedEmail} onCloseDetail={handleCloseDetail} + onExpand={handleExpandEmail} // feat: 传递展开邮件的回调 />