-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78f21f5
commit 01ef6fa
Showing
8 changed files
with
96 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
'use client'; | ||
|
||
import { Form, type ItemGroup } from '@lobehub/ui'; | ||
import { memo } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { FORM_STYLE } from '@/const/layoutTokens'; | ||
import AvatarWithUpload from '@/features/AvatarWithUpload'; | ||
import UserAvatar from '@/features/User/UserAvatar'; | ||
import { useUserStore } from '@/store/user'; | ||
import { authSelectors, userProfileSelectors } from '@/store/user/selectors'; | ||
|
||
type SettingItemGroup = ItemGroup; | ||
|
||
const Client = memo<{ mobile?: boolean }>(() => { | ||
const [enableAuth, isLoginWithNextAuth] = useUserStore((s) => [ | ||
authSelectors.enabledAuth(s), | ||
authSelectors.isLoginWithNextAuth(s), | ||
]); | ||
const [nickname, username, userProfile] = useUserStore((s) => [ | ||
userProfileSelectors.nickName(s), | ||
userProfileSelectors.username(s), | ||
userProfileSelectors.userProfile(s), | ||
]); | ||
|
||
const [form] = Form.useForm(); | ||
const { t } = useTranslation('auth'); | ||
|
||
const profile: SettingItemGroup = { | ||
children: [ | ||
{ | ||
children: enableAuth && isLoginWithNextAuth ? <UserAvatar /> : <AvatarWithUpload />, | ||
label: t('profile.avatar'), | ||
minWidth: undefined, | ||
}, | ||
{ | ||
children: nickname || username, | ||
label: t('profile.username'), | ||
minWidth: undefined, | ||
}, | ||
{ | ||
children: userProfile?.email || '--', | ||
hidden: !isLoginWithNextAuth, | ||
label: t('profile.email'), | ||
}, | ||
], | ||
title: t('tab.profile'), | ||
}; | ||
return ( | ||
<Form form={form} items={[profile]} itemsType={'group'} variant={'pure'} {...FORM_STYLE} /> | ||
); | ||
}); | ||
|
||
export default Client; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use client'; | ||
|
||
import { Form, type ItemGroup } from '@lobehub/ui'; | ||
import { memo } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { FORM_STYLE } from '@/const/layoutTokens'; | ||
|
||
type SettingItemGroup = ItemGroup; | ||
|
||
const Client = memo<{ mobile?: boolean }>(() => { | ||
const [form] = Form.useForm(); | ||
const { t } = useTranslation('auth'); | ||
|
||
const overview: SettingItemGroup = { | ||
children: [], | ||
title: t('tab.stats'), | ||
}; | ||
|
||
return ( | ||
<Form form={form} items={[overview]} itemsType={'group'} variant={'pure'} {...FORM_STYLE} /> | ||
); | ||
}); | ||
|
||
export default Client; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters