fix: 首页出版效果

This commit is contained in:
2025-07-27 00:18:31 -07:00
parent a9108fd392
commit f534c101dd
20 changed files with 444 additions and 258 deletions
+48 -25
View File
@@ -49,15 +49,21 @@ export default function LoginForm({
return (
<>
<div className={'pb-9 pt-16 text-4xl font-bold'}></div>
<Form {...form}>
<form onSubmit={handleSubmit} className='grid gap-6'>
<form onSubmit={handleSubmit} className=''>
<FormField
control={form.control}
name='email'
render={({ field }) => (
<FormItem>
<FormItem className={'mb-5'}>
<FormControl>
<Input placeholder='Enter your email...' type='email' {...field} />
<Input
className={'h-[60px] text-xl'}
placeholder='Email'
type='email'
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
@@ -67,9 +73,14 @@ export default function LoginForm({
control={form.control}
name='password'
render={({ field }) => (
<FormItem>
<FormItem className={'mb-2'}>
<FormControl>
<Input placeholder='Enter your password...' type='password' {...field} />
<Input
className={'h-[60px] text-xl'}
placeholder='password'
type='password'
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
@@ -80,7 +91,7 @@ export default function LoginForm({
control={form.control}
name='cf_token'
render={({ field }) => (
<FormItem>
<FormItem className={'last:mb-0'}>
<FormControl>
<CloudFlareTurnstile id='login' {...field} ref={turnstile} />
</FormControl>
@@ -89,27 +100,39 @@ export default function LoginForm({
)}
/>
)}
<Button type='submit' disabled={loading}>
{loading && <Icon icon='mdi:loading' className='animate-spin' />}
{t('title')}
</Button>
<div className='flex w-full justify-between text-sm'>
<Button
variant='link'
type='button'
className='p-0'
onClick={() => onSwitchForm('reset')}
>
{t('forgotPassword')}
</Button>
<Button
variant='link'
className='p-0'
onClick={() => {
setInitialValues(undefined);
onSwitchForm('register');
}}
>
{t('registerAccount')}
</Button>
</div>
<div className='mt-6 flex justify-center'>
<Button
type='submit'
disabled={loading}
className='h-[64px] w-[219px] rounded-full border-[#0F2C53] bg-[#0F2C53] text-2xl font-bold hover:bg-[#225BA9] hover:text-white'
>
{loading && <Icon icon='mdi:loading' className='animate-spin' />}
{t('title')}
</Button>
</div>
</form>
</Form>
<div className='mt-4 flex w-full justify-between text-sm'>
<Button variant='link' type='button' className='p-0' onClick={() => onSwitchForm('reset')}>
{t('forgotPassword')}
</Button>
<Button
variant='link'
className='p-0'
onClick={() => {
setInitialValues(undefined);
onSwitchForm('register');
}}
>
{t('registerAccount')}
</Button>
</div>
</>
);
}
+123 -99
View File
@@ -87,132 +87,156 @@ export default function RegisterForm({
return (
<>
<div className={'pb-9 text-4xl font-bold'}></div>
{auth.register.stop_register ? (
<Markdown>{t('message')}</Markdown>
) : (
<Form {...form}>
<form onSubmit={handleSubmit} className='grid gap-6'>
<FormField
control={form.control}
name='email'
render={({ field }) => (
<FormItem>
<FormControl>
<Input placeholder='Enter your email...' type='email' {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name='password'
render={({ field }) => (
<FormItem>
<FormControl>
<Input placeholder='Enter your password...' type='password' {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name='repeat_password'
render={({ field }) => (
<FormItem>
<FormControl>
<Input
disabled={loading}
placeholder='Enter password again...'
type='password'
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
{auth.email.enable_verify && (
<form onSubmit={handleSubmit}>
<div className='grid gap-5'>
<FormField
control={form.control}
name='code'
name='email'
render={({ field }) => (
<FormItem>
<FormControl>
<div className='flex items-center gap-2'>
<Input
disabled={loading}
placeholder='Enter code...'
type='text'
{...field}
value={field.value as string}
/>
<SendCode
type='email'
params={{
...form.getValues(),
type: 1,
}}
/>
</div>
<Input
className={'h-[60px] text-xl'}
placeholder='Enter your email...'
type='email'
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
)}
<FormField
control={form.control}
name='invite'
render={({ field }) => (
<FormItem>
<FormControl>
<Input
disabled={loading || !!localStorage.getItem('invite')}
placeholder={t('invite')}
{...field}
value={field.value || ''}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
{verify.enable_register_verify && (
<FormField
control={form.control}
name='cf_token'
name='password'
render={({ field }) => (
<FormItem>
<FormControl>
<CloudFlareTurnstile id='register' {...field} ref={turnstile} />
<Input
className={'h-[60px] text-xl'}
placeholder='Enter your password...'
type='password'
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
)}
<Button type='submit' disabled={loading}>
{loading && <Icon icon='mdi:loading' className='animate-spin' />}
{t('title')}
</Button>
<FormField
control={form.control}
name='repeat_password'
render={({ field }) => (
<FormItem>
<FormControl>
<Input
className={'h-[60px] text-xl'}
disabled={loading}
placeholder='Enter password again...'
type='password'
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
{auth.email.enable_verify && (
<FormField
control={form.control}
name='code'
render={({ field }) => (
<FormItem>
<FormControl>
<div className='flex items-center gap-8'>
<Input
disabled={loading}
className={'h-[60px] flex-1 text-xl'}
placeholder='Enter code...'
type='text'
{...field}
value={field.value as string}
/>
<SendCode
type='email'
params={{
...form.getValues(),
type: 1,
}}
/>
</div>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
)}
<FormField
control={form.control}
name='invite'
render={({ field }) => (
<FormItem>
<FormControl>
<Input
className={'h-[60px] text-xl'}
disabled={loading || !!localStorage.getItem('invite')}
placeholder={t('invite')}
{...field}
value={field.value || ''}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
{verify.enable_register_verify && (
<FormField
control={form.control}
name='cf_token'
render={({ field }) => (
<FormItem>
<FormControl>
<CloudFlareTurnstile id='register' {...field} ref={turnstile} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
)}
</div>
<div className='text-right text-sm'>
{t('existingAccount')}&nbsp;
<Button
variant='link'
className='p-0'
onClick={() => {
setInitialValues(undefined);
onSwitchForm('login');
}}
>
{t('switchToLogin')}
</Button>
</div>
<div className='mt-6 flex justify-center'>
<Button
type='submit'
disabled={loading}
className='h-[64px] w-[219px] rounded-full border-[#0F2C53] bg-[#0F2C53] text-2xl font-bold hover:bg-[#225BA9] hover:text-white'
>
{loading && <Icon icon='mdi:loading' className='animate-spin' />}
{t('title')}
</Button>
</div>
</form>
</Form>
)}
<div className='mt-4 text-right text-sm'>
{t('existingAccount')}&nbsp;
<Button
variant='link'
className='p-0'
onClick={() => {
setInitialValues(undefined);
onSwitchForm('login');
}}
>
{t('switchToLogin')}
</Button>
</div>
</>
);
}
+93 -73
View File
@@ -54,92 +54,112 @@ export default function ResetForm({
return (
<>
<div className={'pb-9 pt-10 text-4xl font-bold'}></div>
<Form {...form}>
<form onSubmit={handleSubmit} className='grid gap-6'>
<FormField
control={form.control}
name='email'
render={({ field }) => (
<FormItem>
<FormControl>
<Input placeholder='Enter your email...' type='email' {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name='code'
render={({ field }) => (
<FormItem>
<FormControl>
<div className='flex items-center gap-2'>
<Input
disabled={loading}
placeholder='Enter code...'
type='text'
{...field}
value={field.value as string}
/>
<SendCode
type='email'
params={{
...form.getValues(),
type: 2,
}}
/>
</div>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name='password'
render={({ field }) => (
<FormItem>
<FormControl>
<Input placeholder='Enter your new password...' type='password' {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
{verify.enable_reset_password_verify && (
<form onSubmit={handleSubmit}>
<div className='grid gap-5'>
<FormField
control={form.control}
name='cf_token'
name='email'
render={({ field }) => (
<FormItem>
<FormControl>
<CloudFlareTurnstile id='reset' {...field} ref={turnstile} />
<Input
className={'h-[60px] text-xl'}
placeholder='Enter your email...'
type='email'
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
)}
<Button type='submit' disabled={loading}>
{loading && <Icon icon='mdi:loading' className='animate-spin' />}
{t('title')}
</Button>
<FormField
control={form.control}
name='code'
render={({ field }) => (
<FormItem>
<FormControl>
<div className='flex items-center gap-8'>
<Input
className={'h-[60px] flex-1 text-xl'}
disabled={loading}
placeholder='Enter code...'
type='text'
{...field}
value={field.value as string}
/>
<SendCode
type='email'
params={{
...form.getValues(),
type: 2,
}}
/>
</div>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name='password'
render={({ field }) => (
<FormItem>
<FormControl>
<Input
className={'h-[60px] text-xl'}
placeholder='Enter your new password...'
type='password'
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
{verify.enable_reset_password_verify && (
<FormField
control={form.control}
name='cf_token'
render={({ field }) => (
<FormItem>
<FormControl>
<CloudFlareTurnstile id='reset' {...field} ref={turnstile} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
)}
</div>
<div className='text-right text-sm'>
{t('existingAccount')}&nbsp;
<Button
variant='link'
className='p-0'
onClick={() => {
setInitialValues(undefined);
onSwitchForm('login');
}}
>
{t('switchToLogin')}
</Button>
</div>
<div className='mt-6 flex justify-center'>
<Button
type='submit'
disabled={loading}
className='h-[64px] w-[219px] rounded-full border-[#0F2C53] bg-[#0F2C53] text-2xl font-bold hover:bg-[#225BA9] hover:text-white'
>
{loading && <Icon icon='mdi:loading' className='animate-spin' />}
{t('title')}
</Button>
</div>
</form>
</Form>
<div className='mt-4 text-right text-sm'>
{t('existingAccount')}&nbsp;
<Button
variant='link'
className='p-0'
onClick={() => {
setInitialValues(undefined);
onSwitchForm('login');
}}
>
{t('switchToLogin')}
</Button>
</div>
</>
);
}