-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
individuation page and pay modal amount (#27)
* feat: individuation page * team chat config * pay modal
- Loading branch information
Showing
14 changed files
with
133 additions
and
9 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
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
4 changes: 4 additions & 0 deletions
4
packages/web/components/common/Icon/icons/support/user/individuation.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
92 changes: 92 additions & 0 deletions
92
projects/app/src/pages/account/components/Individuation.tsx
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,92 @@ | ||
import { Box, Card, Flex, Select } from '@chakra-ui/react'; | ||
import React, { useCallback, useRef } from 'react'; | ||
import MyIcon from '@fastgpt/web/components/common/Icon'; | ||
import { useTranslation } from 'next-i18next'; | ||
import { timezoneList } from '@fastgpt/global/common/time/timezone'; | ||
import { useUserStore } from '@/web/support/user/useUserStore'; | ||
import { UserType } from '@fastgpt/global/support/user/type'; | ||
import { useToast } from '@fastgpt/web/hooks/useToast'; | ||
import { useForm } from 'react-hook-form'; | ||
import { UserUpdateParams } from '@/types/user'; | ||
import { langMap, setLngStore } from '@/web/common/utils/i18n'; | ||
import MySelect from '@/components/Select'; | ||
import { useRouter } from 'next/router'; | ||
|
||
const Individuation = () => { | ||
const { t, i18n } = useTranslation(); | ||
const timezones = useRef(timezoneList()); | ||
const { userInfo, updateUserInfo, initUserInfo } = useUserStore(); | ||
const { toast } = useToast(); | ||
const router = useRouter(); | ||
|
||
const { reset } = useForm<UserUpdateParams>({ | ||
defaultValues: userInfo as UserType | ||
}); | ||
|
||
const onclickSave = useCallback( | ||
async (data: UserType) => { | ||
await updateUserInfo({ | ||
timezone: data.timezone | ||
}); | ||
reset(data); | ||
toast({ | ||
title: t('dataset.data.Update Success Tip'), | ||
status: 'success' | ||
}); | ||
}, | ||
[reset, t, toast, updateUserInfo] | ||
); | ||
|
||
return ( | ||
<Box py={[3, '28px']} px={['5vw', '64px']}> | ||
<Flex alignItems={'center'} fontSize={'xl'} h={'30px'}> | ||
<MyIcon mr={2} name={'support/user/individuation'} w={'20px'} /> | ||
{t('support.account.Individuation')} | ||
</Flex> | ||
|
||
<Card mt={6} px={[3, 10]} py={[3, 7]}> | ||
<Flex alignItems={'center'} w={['85%', '350px']}> | ||
<Box flex={'0 0 80px'}>{t('user.Language')}: </Box> | ||
<Box flex={'1 0 0'}> | ||
<MySelect | ||
value={i18n.language} | ||
list={Object.entries(langMap).map(([key, lang]) => ({ | ||
label: lang.label, | ||
value: key | ||
}))} | ||
onchange={(val: any) => { | ||
const lang = val; | ||
setLngStore(lang); | ||
router.replace( | ||
{ | ||
query: router.query | ||
}, | ||
router.asPath, | ||
{ locale: lang } | ||
); | ||
}} | ||
/> | ||
</Box> | ||
</Flex> | ||
<Flex mt={6} alignItems={'center'} w={['85%', '350px']}> | ||
<Box flex={'0 0 80px'}>{t('user.Timezone')}: </Box> | ||
<Select | ||
value={userInfo?.timezone} | ||
onChange={(e) => { | ||
if (!userInfo) return; | ||
onclickSave({ ...userInfo, timezone: e.target.value }); | ||
}} | ||
> | ||
{timezones.current.map((item) => ( | ||
<option key={item.value} value={item.value}> | ||
{item.name} | ||
</option> | ||
))} | ||
</Select> | ||
</Flex> | ||
</Card> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default Individuation; |
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
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