diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index 5930c99..b69e927 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -3,9 +3,6 @@ import { Routes, Route } from 'react-router-dom';
import Layout from './components/Layout';
import HomePage from './pages/HomePage';
import NotFoundPage from './pages/NotFoundPage';
-import PrivacyPolicyPage from './pages/PrivacyPolicyPage';
-import TermsPage from './pages/TermsPage';
-import AboutPage from './pages/AboutPage';
import { MailboxProvider } from './contexts/MailboxContext';
const App: React.FC = () => {
@@ -16,9 +13,7 @@ const App: React.FC = () => {
}>
} />
- } />
- } />
- } />
+ {/* 移除了 privacy-policy, terms, 和 about 的路由 */}
} />
diff --git a/frontend/src/components/Footer.tsx b/frontend/src/components/Footer.tsx
index d058036..973251f 100644
--- a/frontend/src/components/Footer.tsx
+++ b/frontend/src/components/Footer.tsx
@@ -1,9 +1,13 @@
import React from "react";
import { useTranslation } from "react-i18next";
import Container from "./Container";
-import { Link } from "react-router-dom";
-const Footer: React.FC = () => {
+// 定义 props 类型,允许父组件传递控制弹窗显示的函数
+interface FooterProps {
+ onShowInfo: (infoType: 'privacy' | 'terms' | 'about') => void;
+}
+
+const Footer: React.FC = ({ onShowInfo }) => {
const { t } = useTranslation();
const year = new Date().getFullYear();
@@ -15,18 +19,25 @@ const Footer: React.FC = () => {
© {year} {t("app.title")}
- onShowInfo('privacy')}
className="hover:text-primary transition-colors"
>
{t("common.privacyPolicy", "隐私政策")}
-
-
+
+
+
void;
+ type: 'privacy' | 'terms' | 'about' | null;
+}
+
+const InfoModal: React.FC = ({ isOpen, onClose, type }) => {
+ const { t } = useTranslation();
+
+ if (!isOpen || !type) {
+ return null;
+ }
+
+ // 根据类型获取标题和内容组件
+ const getContent = () => {
+ switch (type) {
+ case 'privacy':
+ return {
+ title: t('common.privacyPolicy'),
+ content: ,
+ };
+ case 'terms':
+ return {
+ title: t('common.terms'),
+ content: ,
+ };
+ case 'about':
+ return {
+ title: t('common.about'),
+ content: ,
+ };
+ default:
+ return {
+ title: '',
+ content: null,
+ };
+ }
+ };
+
+ const { title, content } = getContent();
+
+ return (
+
+
+ {/* 弹窗头部 */}
+
+
{title}
+
+
+ {/* 弹窗内容 */}
+
+ {content}
+
+
+
+ );
+};
+
+export default InfoModal;
\ No newline at end of file
diff --git a/frontend/src/components/Layout.tsx b/frontend/src/components/Layout.tsx
index 66d7073..b16334b 100644
--- a/frontend/src/components/Layout.tsx
+++ b/frontend/src/components/Layout.tsx
@@ -1,16 +1,33 @@
-import React, { useContext } from 'react';
+import React, { useContext, useState } from 'react'; // 导入 useState
import { Outlet, useLocation } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import Header from './Header';
import Footer from './Footer';
import SEO from './SEO';
import { MailboxContext } from '../contexts/MailboxContext';
+import InfoModal from './InfoModal'; // 导入弹窗组件
const Layout: React.FC = () => {
const { t } = useTranslation();
const { mailbox, setMailbox, isLoading } = useContext(MailboxContext);
const location = useLocation();
+ // 添加状态来管理弹窗的显示和内容
+ const [infoModal, setInfoModal] = useState<{
+ isOpen: boolean;
+ type: 'privacy' | 'terms' | 'about' | null;
+ }>({ isOpen: false, type: null });
+
+ // 打开弹窗的函数
+ const handleShowInfo = (type: 'privacy' | 'terms' | 'about') => {
+ setInfoModal({ isOpen: true, type });
+ };
+
+ // 关闭弹窗的函数
+ const handleCloseInfo = () => {
+ setInfoModal({ isOpen: false, type: null });
+ };
+
// 根据当前路径设置不同的SEO信息
const getSEOProps = () => {
const path = location.pathname;
@@ -27,7 +44,7 @@ const Layout: React.FC = () => {
return {
...defaultProps,
title: `ZMAIL-24小时匿名邮箱`,
- description: `查看 ${mailbox} 的临时邮箱收件箱,接收邮件,无需注册,保护您的隐私安全`,
+ description: `查看 ${mailbox.address} 的临时邮箱收件箱,接收邮件,无需注册,保护您的隐私安全`,
};
}
@@ -45,7 +62,14 @@ const Layout: React.FC = () => {
-
+ {/* 传递 onShowInfo 函数给 Footer 组件 */}
+
+ {/* 渲染弹窗组件 */}
+
);
};