@ -1,6 +1,7 @@
import React from 'react'
import { userAccountLexics } from 'config/lexics/userAccount'
import { formIds } from 'config/form'
import { Background } from 'features/Background'
import { Combobox } from 'features/Combobox'
@ -9,11 +10,11 @@ import { Form } from 'features/Login/styled'
import { T9n } from 'features/T9n'
import { Error } from 'features/Common/Input/styled'
import { useLexicsStore , useLexicsConfig } from 'features/LexicsStore'
import { CardNumber } from './CardNumber'
import { UserAccountButton } from './UserAccountButton'
import { PageTitle } from './PageTitle'
import { UserAccountSubscription } from './UserAccountSubscription'
import { formIds } from './config'
import { TextNoBorder } from './TextNoBorder'
import { useUserInfo } from './hooks'
@ -27,7 +28,7 @@ import {
ButtonWrapper ,
} from './styled'
const labelWidth = 78
const labelWidth = 110
export const UserAccount = ( ) = > {
useLexicsConfig ( userAccountLexics )
@ -35,9 +36,13 @@ export const UserAccount = () => {
const { translate } = useLexicsStore ( )
const {
cities ,
countries ,
handleSubmit ,
onCitySelect ,
onCountrySelect ,
onPhoneBlur ,
onRegionOrCityChange ,
readFormError ,
readFormValue ,
saveButton ,
@ -61,6 +66,8 @@ export const UserAccount = () => {
labelWidth = { labelWidth }
onChange = { updateFormValue ( formIds . firstname ) }
error = { readFormError ( formIds . firstname ) }
editIcon
maxLength = { 500 }
/ >
< Input
value = { readFormValue ( formIds . lastname ) }
@ -68,126 +75,94 @@ export const UserAccount = () => {
labelWidth = { labelWidth }
onChange = { updateFormValue ( formIds . lastname ) }
error = { readFormError ( formIds . lastname ) }
editIcon
maxLength = { 500 }
/ >
< Input
onBlur = { onPhoneBlur }
value = { readFormValue ( formIds . phone ) }
labelLexic = 'phone'
labelWidth = { labelWidth }
onChange = { updateFormValue ( formIds . phone ) }
error = { readFormError ( formIds . phone ) }
editIcon
maxLength = { 100 }
/ >
< Input
value = { readFormValue ( formIds . password ) }
error = { readFormError ( formIds . password ) }
type = 'password'
labelLexic = 'form_password'
labelWidth = { labelWidth }
onChange = { updateFormValue ( formIds . password ) }
editIcon
maxLength = { 500 }
/ >
< Combobox
value = { readFormValue ( formIds . country ) }
error = { readFormError ( formIds . country ) }
labelLexic = 'form_country'
options = { countries }
labelWidth = { labelWidth }
withArrow
onChange = { updateFormValue ( formIds . country ) }
value = { readFormValue ( formIds . country ) }
error = { readFormError ( formIds . country ) }
options = { countries }
onSelect = { onCountrySelect }
withArrow
/ >
< ButtonWrapper >
< OutlinedButton
type = 'button'
onClick = { handleSubmit }
ref = { saveButton }
>
< T9n t = 'save_changes' / >
< / OutlinedButton >
< Error t = { readFormError ( formIds . formError ) || '' } / >
< / ButtonWrapper >
< / Form >
< / FormWrapper >
< FormWrapper >
< Form >
< UserAccountBlockTitle >
< T9n t = 'payment' / >
< / UserAccountBlockTitle >
< CardNumber visa label = '1234 1234 1234 1234' / >
< CardNumber checked label = '1234 1234 1234 1234' / >
< CardNumber label = '1234 1234 1234 1234' / >
< UserAccountButton text = { translate ( 'add_card' ) } / >
< / Form >
< / FormWrapper >
< FormWrapper >
< Form >
< UserAccountBlockTitle >
< T9n t = 'subscriptions' / >
< / UserAccountBlockTitle >
< UserAccountSubscription
amount = { 1999 }
checked
inputType = 'radio'
packageName = 'Базовая'
packageAction = { translate ( 'change' ) }
/ >
< UserAccountSubscription
amount = { 1999 }
checked
inputType = 'checkbox'
label = 'Российская Премьер-Лига'
/ >
< UserAccountSubscription
amount = { 499 }
checked
inputType = 'checkbox'
label = 'Primera División'
/ >
< UserAccountSubscription
amount = { 299 }
checked
inputType = 'checkbox'
label = 'Manchester United'
/ >
< UserAccountButton text = { translate ( 'select_subscription' ) } / >
< TextNoBorder
text = { ` ${ translate ( 'next_debit' ) } 31.02.2020 ` }
amount = { 4796 }
/ >
< / Form >
< / FormWrapper >
< / UserAccountFormWrapper >
< / UserAccountWrapper >
< / Background >
< Background >
< UserAccountWrapper >
< PageTitle titleText = { translate ( 'user_account' ) } / >
< UserAccountFormWrapper >
< FormWrapper >
< Form >
< UserAccountBlockTitle >
< T9n t = 'main' / >
< / UserAccountBlockTitle >
< Input
labelLexic = 'name'
value = { readFormValue ( formIds . postalCode ) }
error = { readFormError ( formIds . postalCode ) }
labelLexic = 'form_postal_code'
labelWidth = { labelWidth }
onChange = { updateFormValue ( formIds . postalCode ) }
editIcon
/ >
< Input
labelLexic = 'lastname'
value = { readFormValue ( formIds . region ) }
error = { readFormError ( formIds . region ) }
labelLexic = 'form_region'
labelWidth = { labelWidth }
onChange = { onRegionOrCityChange ( formIds . region ) }
editIcon
maxLength = { 500 }
/ >
< Input
labelLexic = 'phone'
< Combobox
value = { readFormValue ( formIds . city ) }
error = { readFormError ( formIds . city ) }
labelLexic = 'form_city'
labelWidth = { labelWidth }
onChange = { onRegionOrCityChange ( formIds . city ) }
options = { cities }
onSelect = { onCitySelect }
maxLength = { 500 }
/ >
< Input
type = 'email'
labelLexic = 'mail'
value = { readFormValue ( formIds . address1 ) }
error = { readFormError ( formIds . address1 ) }
labelLexic = 'form_address1'
labelWidth = { labelWidth }
onChange = { updateFormValue ( formIds . address1 ) }
editIcon
maxLength = { 500 }
/ >
< Combobox
labelLexic = 'form_country'
options = { countries }
< Input
value = { readFormValue ( formIds . address2 ) }
error = { readFormError ( formIds . address2 ) }
labelLexic = 'form_address2'
labelWidth = { labelWidth }
withArrow
onChange = { updateFormValue ( formIds . country ) }
value = { readFormValue ( formIds . country ) }
error = { readFormError ( formIds . country ) }
onSelect = { onCountrySelect }
onChange = { updateFormValue ( formIds . address2 ) }
editIcon
maxLength = { 500 }
/ >
< OutlinedButton >
< ButtonWrapper >
< OutlinedButton
type = 'button'
onClick = { handleSubmit }
ref = { saveButton }
>
< T9n t = 'save_changes' / >
< / OutlinedButton >
< Error t = { readFormError ( formIds . formError ) || '' } / >
< / ButtonWrapper >
< / Form >
< / FormWrapper >
< FormWrapper >