chore: 统一代码格式并配置开发工具

- 添加 ESLint 和 Prettier 配置以统一代码风格
- 配置项目级 TypeScript 设置
- 更新前后端依赖版本
- 修复代码格式问题(引号、分号、尾随逗号等)
- 优化文件结构和导入路径
This commit is contained in:
2026-03-10 18:24:19 +08:00
parent 58373a15a9
commit 35d835f68c
58 changed files with 14240 additions and 922 deletions

View File

@@ -1,42 +1,57 @@
import { useState } from 'react';
import { useNavigate, Link } from 'react-router-dom';
import { Card, Input, Button, Form, toast, TextField, Label, FieldError } from '@heroui/react';
import { signUp } from '../../lib/auth-client';
import { useState } from 'react'
import { useNavigate, Link as RouterLink } from 'react-router-dom'
import {
Card,
Input,
Button,
Form,
toast,
TextField,
Label,
FieldError,
} from '@heroui/react'
import { buttonVariants } from '@heroui/styles'
import { signUp } from '../../lib/auth-client'
export default function RegisterPage() {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [loading, setLoading] = useState(false);
const navigate = useNavigate();
const [email, setEmail] = useState('')
const [password, setPassword] = useState('')
const [loading, setLoading] = useState(false)
const navigate = useNavigate()
const handleRegister = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
setLoading(true);
e.preventDefault()
setLoading(true)
try {
await signUp.email({
email,
password,
name: email.split('@')[0], // Default name
}, {
onSuccess: () => {
navigate('/');
await signUp.email(
{
email,
password,
name: email.split('@')[0], // Default name
},
onError: (ctx) => {
toast.danger(ctx.error.message);
}
});
{
onSuccess: () => {
navigate('/')
},
onError: (ctx) => {
toast.danger(ctx.error.message)
},
},
)
} catch (err) {
console.error(err);
console.error(err)
} finally {
setLoading(false);
setLoading(false)
}
};
}
return (
<div className="flex flex-col items-center justify-center min-h-[calc(100vh-64px)] p-4">
<div className="flex min-h-[calc(100vh-64px)] flex-col items-center justify-center p-4">
<Card className="w-full max-w-md">
<Card.Header>
<Card.Title className="text-2xl font-bold text-center w-full"> HLAE </Card.Title>
<Card.Title className="w-full text-center text-2xl font-bold">
HLAE
</Card.Title>
</Card.Header>
<Form validationBehavior="native" onSubmit={handleRegister}>
<Card.Content className="flex flex-col gap-6">
@@ -64,21 +79,42 @@ export default function RegisterPage() {
<FieldError />
</TextField>
</Card.Content>
<Card.Footer className="flex flex-col gap-3 mt-2">
<Button type="submit" isPending={loading} fullWidth className="font-bold">
<Card.Footer className="mt-2 flex flex-col gap-3">
<Button
type="submit"
isPending={loading}
fullWidth
className="font-bold"
>
</Button>
<Button as={Link} to="/login" variant="tertiary" fullWidth className="font-bold">
<RouterLink
to="/login"
className={buttonVariants({
variant: 'tertiary',
fullWidth: true,
className: 'font-bold',
})}
>
</Button>
<div className="flex justify-center mt-2">
<Link to="/" className="text-sm text-default-500 hover:text-primary transition-colors flex items-center gap-1">
<span> </span>
</Link>
</RouterLink>
<div className="mt-2 flex justify-center">
<RouterLink
to="/"
className="text-default-500 hover:text-foreground text-sm"
>
</RouterLink>
</div>
</Card.Footer>
</Form>
</Card>
<p className="mt-4 text-sm text-gray-500">
{' '}
<RouterLink to="/login" className="text-primary hover:underline">
</RouterLink>
</p>
</div>
);
)
}