This commit is contained in:
ditiqi 2025-02-18 10:56:42 +08:00
parent 1f79e3275f
commit 2a52a7ed96
3 changed files with 109 additions and 131 deletions

View File

@ -11,130 +11,117 @@ import { env } from "@web/src/env";
const { Title, Text, Paragraph } = Typography;
const AuthPage: React.FC = () => {
const {
showLogin,
isLoading,
toggleForm,
handleLogin,
handleRegister
} = useAuthForm();
const { isAuthenticated } = useAuth();
const location = useLocation();
const navigate = useNavigate();
const { showLogin, isLoading, toggleForm, handleLogin, handleRegister } =
useAuthForm();
const { isAuthenticated } = useAuth();
const location = useLocation();
const navigate = useNavigate();
useEffect(() => {
if (isAuthenticated) {
const params = new URLSearchParams(location.search);
const redirectUrl = params.get("redirect_url") || "/";
navigate(redirectUrl, { replace: true });
}
}, [isAuthenticated, location]);
useEffect(() => {
if (isAuthenticated) {
const params = new URLSearchParams(location.search);
const redirectUrl = params.get("redirect_url") || "/";
navigate(redirectUrl, { replace: true });
}
}, [isAuthenticated, location]);
return (
<div className="min-h-screen flex items-center justify-center p-4">
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.5 }}
>
<div
className="w-full max-w-5xl shadow-elegant border-2 border-white rounded-xl overflow-hidden transition-all duration-300 relative"
>
<div className="flex flex-col md:flex-row min-h-[650px]">
{/* Left Panel - Welcome Section */}
<div className="w-full md:w-1/2 p-12 bg-gradient-to-br from-primary to-primary-600 text-white flex flex-col justify-center relative overflow-hidden">
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.2, duration: 0.5 }}
>
<div className="text-4xl text-white mb-4 font-serif">
{env.APP_NAME || '信箱'}
</div>
<Paragraph className="text-lg mb-8 text-blue-100 leading-relaxed text-justify">
</Paragraph>
{showLogin && (
<Button
type="default"
ghost
size="large"
onClick={toggleForm}
className="w-fit hover:bg-white hover:text-blue-700 transition-all"
>
</Button>
)}
</motion.div>
</div>
return (
<div className="min-h-screen flex items-center justify-center p-4">
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.5 }}>
<div className="w-full max-w-5xl shadow-elegant border-2 border-white rounded-xl overflow-hidden transition-all duration-300 relative">
<div className="flex flex-col md:flex-row min-h-[650px]">
{/* Left Panel - Welcome Section */}
<div className="w-full md:w-1/2 p-12 bg-gradient-to-br from-primary to-primary-600 text-white flex flex-col justify-center relative overflow-hidden">
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.2, duration: 0.5 }}>
<div className="text-4xl text-white mb-4 font-serif">
{env.APP_NAME || "信箱"}
</div>
<Paragraph className="text-lg mb-8 text-blue-100 leading-relaxed text-justify">
<br></br>
</Paragraph>
{showLogin && (
<Button
type="default"
ghost
size="large"
onClick={toggleForm}
className="w-fit hover:bg-white hover:text-blue-700 transition-all">
</Button>
)}
</motion.div>
</div>
{/* Right Panel - Form Section */}
<div className="w-full md:w-1/2 p-10 lg:p-16 bg-white relative rounded-xl">
<AnimatePresence mode="wait">
{showLogin ? (
<motion.div
key="login"
initial={{ opacity: 0, x: 50 }}
animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: -50 }}
transition={{ duration: 0.3 }}
>
<motion.div className="mb-8">
<Title level={3} className="mb-2"></Title>
<Text type="secondary">
使{' '}
<Button
type="link"
onClick={toggleForm}
className="p-0 font-medium"
>
</Button>
</Text>
</motion.div>
<LoginForm
onSubmit={handleLogin}
isLoading={isLoading}
/>
</motion.div>
) : (
<motion.div
key="register"
initial={{ opacity: 0, x: 50 }}
animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: -50 }}
transition={{ duration: 0.3 }}
>
<motion.div className="mb-8">
<Title level={3} className="mb-2"></Title>
<Text type="secondary">
{' '}
<Button
type="link"
onClick={toggleForm}
className="p-0 font-medium"
>
</Button>
</Text>
</motion.div>
<RegisterForm
onSubmit={handleRegister}
isLoading={isLoading}
/>
</motion.div>
)}
</AnimatePresence>
</div>
</div>
</div>
</motion.div>
</div>
);
{/* Right Panel - Form Section */}
<div className="w-full md:w-1/2 p-10 lg:p-16 bg-white relative rounded-xl">
<AnimatePresence mode="wait">
{showLogin ? (
<motion.div
key="login"
initial={{ opacity: 0, x: 50 }}
animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: -50 }}
transition={{ duration: 0.3 }}>
<motion.div className="mb-8">
<Title level={3} className="mb-2">
</Title>
<Text type="secondary">
使{" "}
<Button
type="link"
onClick={toggleForm}
className="p-0 font-medium">
</Button>
</Text>
</motion.div>
<LoginForm
onSubmit={handleLogin}
isLoading={isLoading}
/>
</motion.div>
) : (
<motion.div
key="register"
initial={{ opacity: 0, x: 50 }}
animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: -50 }}
transition={{ duration: 0.3 }}>
<motion.div className="mb-8">
<Title level={3} className="mb-2">
</Title>
<Text type="secondary">
{" "}
<Button
type="link"
onClick={toggleForm}
className="p-0 font-medium">
</Button>
</Text>
</motion.div>
<RegisterForm
onSubmit={handleRegister}
isLoading={isLoading}
/>
</motion.div>
)}
</AnimatePresence>
</div>
</div>
</div>
</motion.div>
</div>
);
};
export default AuthPage;

View File

@ -17,7 +17,7 @@ export function Footer() {
{/* 开发组织信息 */}
<div className="text-center md:text-left space-y-2">
<h3 className="text-white font-semibold text-sm flex items-center justify-center md:justify-start">
</h3>
<p className="text-white text-xs italic">

View File

@ -1,9 +0,0 @@
module.exports = async ({ page, context }) => {
await page.setViewport({ width: 1920, height: 1080 });
await page.goto("http://192.168.139.239:8090", {
waitUntil: "networkidle0",
});
await page.evaluate(() => {
document.documentElement.requestFullscreen();
});
};