From c1aa73815421c71eb1c20738af58493238f77d9e Mon Sep 17 00:00:00 2001 From: speakeloudest Date: Wed, 30 Jul 2025 21:09:25 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../(user)/profile/change-password.tsx | 100 +++++++++++------- .../(user)/profile/notify-settings.tsx | 93 +++++++++------- .../(main)/(content)/(user)/profile/page.tsx | 6 +- .../(user)/profile/third-party-accounts.tsx | 96 +++++------------ apps/user/app/auth/email/login-form.tsx | 8 +- apps/user/app/auth/email/register-form.tsx | 18 +++- apps/user/app/auth/email/reset-form.tsx | 12 ++- packages/ui/src/components/switch.tsx | 38 ++++--- 8 files changed, 192 insertions(+), 179 deletions(-) diff --git a/apps/user/app/(main)/(content)/(user)/profile/change-password.tsx b/apps/user/app/(main)/(content)/(user)/profile/change-password.tsx index 31ce872..bdb3dd1 100644 --- a/apps/user/app/(main)/(content)/(user)/profile/change-password.tsx +++ b/apps/user/app/(main)/(content)/(user)/profile/change-password.tsx @@ -3,7 +3,7 @@ import { updateUserPassword } from '@/services/user/user'; import { zodResolver } from '@hookform/resolvers/zod'; import { Button } from '@workspace/ui/components/button'; -import { Card, CardContent, CardHeader, CardTitle } from '@workspace/ui/components/card'; +import { Card } from '@workspace/ui/components/card'; import { Form, FormControl, FormField, FormItem, FormMessage } from '@workspace/ui/components/form'; import { Input } from '@workspace/ui/components/input'; import { useTranslations } from 'next-intl'; @@ -34,45 +34,65 @@ export default function ChangePassword() { } return ( - - - - {t('accountSettings')} - - - - -
- - ( - - - - - - - )} - /> - ( - - - - - - - )} - /> - - -
+ +
+
{t('accountSettings')}
+
修改登录密码
+
+
+ + ( + + + + + + + )} + /> + ( + + + + + + + )} + /> + + +
+ +
); } diff --git a/apps/user/app/(main)/(content)/(user)/profile/notify-settings.tsx b/apps/user/app/(main)/(content)/(user)/profile/notify-settings.tsx index 0699048..f5d3276 100644 --- a/apps/user/app/(main)/(content)/(user)/profile/notify-settings.tsx +++ b/apps/user/app/(main)/(content)/(user)/profile/notify-settings.tsx @@ -4,7 +4,7 @@ import useGlobalStore from '@/config/use-global'; import { updateUserNotify } from '@/services/user/user'; import { zodResolver } from '@hookform/resolvers/zod'; import { Button } from '@workspace/ui/components/button'; -import { Card, CardContent, CardHeader, CardTitle } from '@workspace/ui/components/card'; +import { Card } from '@workspace/ui/components/card'; import { Form, FormControl, FormField, FormItem, FormLabel } from '@workspace/ui/components/form'; import { Switch } from '@workspace/ui/components/switch'; import { useTranslations } from 'next-intl'; @@ -39,45 +39,58 @@ export default function NotifySettings() { } return ( - - - - {t('notify.notificationSettings')} - - - - -
- -
- {[ - { name: 'enable_balance_notify', label: 'balanceChange' }, - { name: 'enable_login_notify', label: 'login' }, - { name: 'enable_subscribe_notify', label: 'subscribe' }, - { name: 'enable_trade_notify', label: 'finance' }, - ].map(({ name, label }) => ( - ( - - - {t(`notify.${label}`)} - - - - - - )} - /> - ))} -
-
- -
+ +
+
{t('notify.notificationSettings')}
+
是否邮箱通知推送
+
+
+ +
+ {[ + { name: 'enable_balance_notify', label: 'balanceChange' }, + { name: 'enable_login_notify', label: 'login' }, + { name: 'enable_subscribe_notify', label: 'subscribe' }, + { name: 'enable_trade_notify', label: 'finance' }, + ].map(({ name, label }) => ( + ( + + + {t(`notify.${label}`)} + + + + + + )} + /> + ))} +
+
+ +
+ +
); } diff --git a/apps/user/app/(main)/(content)/(user)/profile/page.tsx b/apps/user/app/(main)/(content)/(user)/profile/page.tsx index e5896e9..c389987 100644 --- a/apps/user/app/(main)/(content)/(user)/profile/page.tsx +++ b/apps/user/app/(main)/(content)/(user)/profile/page.tsx @@ -5,9 +5,11 @@ import ThirdPartyAccounts from './third-party-accounts'; export default function Page() { return (
- +
+ + +
-
); } diff --git a/apps/user/app/(main)/(content)/(user)/profile/third-party-accounts.tsx b/apps/user/app/(main)/(content)/(user)/profile/third-party-accounts.tsx index d7802e5..078159e 100644 --- a/apps/user/app/(main)/(content)/(user)/profile/third-party-accounts.tsx +++ b/apps/user/app/(main)/(content)/(user)/profile/third-party-accounts.tsx @@ -5,7 +5,7 @@ import useGlobalStore from '@/config/use-global'; import { bindOAuth, unbindOAuth, updateBindEmail, updateBindMobile } from '@/services/user/user'; import { zodResolver } from '@hookform/resolvers/zod'; import { Button } from '@workspace/ui/components/button'; -import { Card, CardContent, CardHeader, CardTitle } from '@workspace/ui/components/card'; +import { Card } from '@workspace/ui/components/card'; import { Dialog, DialogContent, @@ -16,7 +16,6 @@ import { import { Form, FormControl, FormField, FormItem, FormMessage } from '@workspace/ui/components/form'; import { Input } from '@workspace/ui/components/input'; import { AreaCodeSelect } from '@workspace/ui/custom-components/area-code-select'; -import { Icon } from '@workspace/ui/custom-components/icon'; import { useTranslations } from 'next-intl'; import { useState } from 'react'; import { useForm } from 'react-hook-form'; @@ -234,75 +233,32 @@ export default function ThirdPartyAccounts() { return ( <> - - - {t('title')} - - -
- {accounts.map((account) => { - const method = user?.auth_methods?.find((auth) => auth.auth_type === account.id); - const isEditing = account.id === 'email'; - const currentValue = method?.auth_identifier || editValues[account.id]; - let displayValue = ''; - - switch (account.id) { - case 'email': - displayValue = isEditing ? currentValue : method?.auth_identifier || ''; - break; - default: - displayValue = method?.auth_identifier || t(`${account.id}.description`); - } - - return ( -
- - - {account.name} - -
- - isEditing && - setEditValues((prev) => ({ ...prev, [account.id]: e.target.value })) - } - onKeyDown={(e) => { - if (e.key === 'Enter' && isEditing) { - handleBasicAccountUpdate(account, currentValue); - } - }} - /> - {account.id === 'mobile' ? ( - - - - ) : ( - - )} -
-
- ); - })} + +
{t('title')}
+
+ {user?.auth_methods?.[0]?.auth_identifier} +
+
Email
+
+
+ {user?.auth_methods?.[0]?.auth_identifier}
- +
+ 保存 +
+
); diff --git a/apps/user/app/auth/email/login-form.tsx b/apps/user/app/auth/email/login-form.tsx index 32fbb33..ba35c26 100644 --- a/apps/user/app/auth/email/login-form.tsx +++ b/apps/user/app/auth/email/login-form.tsx @@ -59,7 +59,9 @@ export default function LoginForm({
, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - - { + thumbClassName?: string; +} + +const Switch = React.forwardRef, SwitchProps>( + ({ className, thumbClassName, ...props }, ref) => ( + - -)); + {...props} + ref={ref} + > + + + ), +); Switch.displayName = SwitchPrimitives.Root.displayName; export { Switch };