diff --git a/src/app/article/components/Comment/index.tsx b/src/app/article/components/Comment/index.tsx index ea91191..354881d 100755 --- a/src/app/article/components/Comment/index.tsx +++ b/src/app/article/components/Comment/index.tsx @@ -3,7 +3,7 @@ import { useState, useEffect, useRef } from 'react'; import { useForm } from 'react-hook-form'; import { addCommentDataAPI } from '@/api/comment'; -import { ToastContainer, toast } from 'react-toastify'; +import { Bounce, ToastOptions, toast } from 'react-toastify'; import { Spinner } from '@heroui/react'; import HCaptchaType from '@hcaptcha/react-hcaptcha'; import List from './components/List'; @@ -24,6 +24,18 @@ interface CommentForm { avatar: string; } +const toastConfig: ToastOptions = { + position: 'top-right', + autoClose: 5000, + hideProgressBar: false, + closeOnClick: true, + pauseOnHover: true, + draggable: true, + progress: undefined, + theme: 'colored', + transition: Bounce, +}; + const CommentForm = ({ articleId }: Props) => { const contentRef = useRef(null); const [commentId, setCommentId] = useState(articleId); @@ -80,10 +92,10 @@ const CommentForm = ({ articleId }: Props) => { if (code !== 200) { captchaRef.current?.resetCaptcha(); - return toast.error('发布评论失败:' + message); + return toast.error('发布评论失败:' + message, toastConfig); } - toast('🎉 提交成功, 请等待审核!'); + toast.success('🎉 提交成功, 请等待审核!', toastConfig); // 发布成功后初始化表单 setCommentId(articleId); @@ -171,7 +183,6 @@ const CommentForm = ({ articleId }: Props) => { - ); }; diff --git a/src/app/article/components/MD/index.tsx b/src/app/article/components/MD/index.tsx index 99bf63e..52fe24e 100755 --- a/src/app/article/components/MD/index.tsx +++ b/src/app/article/components/MD/index.tsx @@ -226,7 +226,7 @@ const ContentMD = ({ data }: Props) => { return (
- +
diff --git a/src/app/error.tsx b/src/app/error.tsx index ac0640c..d981493 100755 --- a/src/app/error.tsx +++ b/src/app/error.tsx @@ -6,17 +6,15 @@ interface Props { error: Error & { digest?: string }; } -function NotFoundPage({ error }: Props) { +function ErrorPage({ error }: Props) { return ( - - -
- -

{error.message}

-
- - +
+
+ +

{error.message}

+
+
); } -export default NotFoundPage; +export default ErrorPage; diff --git a/src/app/resume/resume.tsx b/src/app/resume/resume.tsx index a4a64e6..bb8dc33 100644 --- a/src/app/resume/resume.tsx +++ b/src/app/resume/resume.tsx @@ -212,7 +212,7 @@ export default ({ data }: { data: Resume }) => {
{workExperience?.map((job, index) => (
-
+

{job.company}

{job.period} diff --git a/src/components/Encrypt/index.tsx b/src/components/Encrypt/index.tsx index 2f2a369..19b87f5 100755 --- a/src/components/Encrypt/index.tsx +++ b/src/components/Encrypt/index.tsx @@ -32,7 +32,7 @@ export default function Encrypt({ id }: Props) { // 验证访问密码 const handleVerifyPassword = async () => { const res = await getArticleDataAPI(id, password); - + if (res?.code === 200) { router.push(`${pathname}?password=${password}`); } else { @@ -71,8 +71,12 @@ export default function Encrypt({ id }: Props) { - - + + )} diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index 4191e8e..ef8d746 100755 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -70,15 +70,14 @@ const Header = () => { // 手动切换主题 const toTheme = () => { - const html = document.querySelector('html'); - if (html) { - setIsDark(html.classList.toggle('dark')); - } + setIsDark(!isDark); }; // 判断当前主题 useEffect(() => { const html = document.querySelector('html'); - html?.classList.toggle('dark', isDark); + if (html && html.classList) { + html?.classList?.toggle('dark', isDark); + } }, [isDark]); // 是否打开侧边栏导航