feat(ott-62): added lexics to the user account (#69)

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Armen 5 years ago committed by GitHub
parent 2776f2fb0d
commit 8efce0066a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      src/config/lexics/userAccount.tsx
  2. 1
      src/features/Common/Input/styled.tsx
  3. 14
      src/features/Register/components/Price/index.tsx
  4. 5
      src/features/UserAccount/CardNumber/index.tsx
  5. 84
      src/features/UserAccount/index.tsx

@ -0,0 +1,18 @@
export const userAccountLexics = {
add_card: 8313,
change: 12614,
country: 835,
delete_card: 8692,
lastname: 858,
mail: 12912,
main: 13014,
month: 13019,
name: 645,
next_debit: 13018,
payment: 13015,
phone: 1656,
save_changes: 13017,
select_subscription: 12583,
subscriptions: 13016,
user_account: 12928,
}

@ -38,6 +38,7 @@ type LabelProps = {
export const Label = styled.label<LabelProps>` export const Label = styled.label<LabelProps>`
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
white-space: nowrap;
font-size: 16px; font-size: 16px;
line-height: 24px; line-height: 24px;
letter-spacing: -0.01em; letter-spacing: -0.01em;

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import { useLexicsStore } from 'features/LexicsStore'
import { import {
PriceWrapper, PriceWrapper,
@ -15,10 +16,17 @@ type TPrice = {
export const Price = ({ export const Price = ({
amount, amount,
currency = '₽', currency = '₽',
perPeriod = 'мес', perPeriod = 'month',
}: TPrice) => ( }: TPrice) => {
const { translate } = useLexicsStore()
const perPeriodTranslated = translate(perPeriod)
return (
<PriceWrapper> <PriceWrapper>
<PriceAmount>{amount}</PriceAmount> <PriceAmount>{amount}</PriceAmount>
<PriceDetails>{currency} / {perPeriod}</PriceDetails> <PriceDetails>
{currency} / {perPeriodTranslated}
</PriceDetails>
</PriceWrapper> </PriceWrapper>
) )
}

@ -1,6 +1,7 @@
import React from 'react' import React from 'react'
import { Radio } from 'features/Common/Radio' import { Radio } from 'features/Common/Radio'
import { T9n } from 'features/T9n'
import { VisaLogoWrapper } from '../VisaLogo' import { VisaLogoWrapper } from '../VisaLogo'
import { CardNumberWrapper, CardNumberTextWrapper } from './styled' import { CardNumberWrapper, CardNumberTextWrapper } from './styled'
@ -23,6 +24,8 @@ export const CardNumber = ({
onChange={() => {}} onChange={() => {}}
/> />
<VisaLogoWrapper visa={visa} /> <VisaLogoWrapper visa={visa} />
<CardNumberTextWrapper>Удалить карту</CardNumberTextWrapper> <CardNumberTextWrapper>
<T9n t='delete_card' />
</CardNumberTextWrapper>
</CardNumberWrapper> </CardNumberWrapper>
) )

@ -4,12 +4,17 @@ import { Background } from 'features/Background'
import { Combobox } from 'features/Combobox' import { Combobox } from 'features/Combobox'
import { Input } from 'features/Common' import { Input } from 'features/Common'
import { Form } from 'features/Login/styled' import { Form } from 'features/Login/styled'
import { T9n } from 'features/T9n'
import { useLexicsStore, useLexicsConfig } from 'features/LexicsStore'
import { userAccountLexics } from 'config/lexics/userAccount'
import { CardNumber } from './CardNumber' import { CardNumber } from './CardNumber'
import { UserAccountButton } from './UserAccountButton' import { UserAccountButton } from './UserAccountButton'
import { PageTitle } from './PageTitle' import { PageTitle } from './PageTitle'
import { UserAccountSubscription } from './UserAccountSubscription' import { UserAccountSubscription } from './UserAccountSubscription'
import { TextNoBorder } from './TextNoBorder' import { TextNoBorder } from './TextNoBorder'
import { import {
FormWrapper, FormWrapper,
OutlinedButton, OutlinedButton,
@ -21,34 +26,40 @@ import {
const labelWidth = 78 const labelWidth = 78
export const UserAccount = () => ( export const UserAccount = () => {
useLexicsConfig(userAccountLexics)
const { translate } = useLexicsStore()
return (
<UserAccountComponentWrapper> <UserAccountComponentWrapper>
<Background> <Background>
<UserAccountWrapper> <UserAccountWrapper>
<PageTitle titleText='Личный кабинет' /> <PageTitle titleText={translate('user_account')} />
<UserAccountFormWrapper> <UserAccountFormWrapper>
<FormWrapper> <FormWrapper>
<Form> <Form>
<UserAccountBlockTitle>Основное</UserAccountBlockTitle> <UserAccountBlockTitle>
<T9n t='main' />
</UserAccountBlockTitle>
<Input <Input
id='firstname' id='firstname'
label='Имя' label={translate('name')}
labelWidth={labelWidth} labelWidth={labelWidth}
/> />
<Input <Input
id='lastname' id='lastname'
label='Фамилия' label={translate('lastname')}
labelWidth={labelWidth} labelWidth={labelWidth}
/> />
<Input <Input
id='phone' id='phone'
label='Телефон' label={translate('phone')}
labelWidth={labelWidth} labelWidth={labelWidth}
/> />
<Input <Input
id='email' id='email'
type='email' type='email'
label='E-mail' label={translate('mail')}
labelWidth={labelWidth} labelWidth={labelWidth}
/> />
<Combobox <Combobox
@ -58,30 +69,36 @@ export const UserAccount = () => (
{ id: 2, name: 'Латвия' }, { id: 2, name: 'Латвия' },
{ id: 3, name: 'Россия' }, { id: 3, name: 'Россия' },
]} ]}
label='Страна' label={translate('country')}
labelWidth={labelWidth} labelWidth={labelWidth}
/> />
<OutlinedButton>Сохранить изменения</OutlinedButton> <OutlinedButton>
<T9n t='save_changes' />
</OutlinedButton>
</Form> </Form>
</FormWrapper> </FormWrapper>
<FormWrapper> <FormWrapper>
<Form> <Form>
<UserAccountBlockTitle>Оплата</UserAccountBlockTitle> <UserAccountBlockTitle>
<T9n t='payment' />
</UserAccountBlockTitle>
<CardNumber visa label='1234 1234 1234 1234' /> <CardNumber visa label='1234 1234 1234 1234' />
<CardNumber checked label='1234 1234 1234 1234' /> <CardNumber checked label='1234 1234 1234 1234' />
<CardNumber label='1234 1234 1234 1234' /> <CardNumber label='1234 1234 1234 1234' />
<UserAccountButton text='Добавить карту' /> <UserAccountButton text={translate('add_card')} />
</Form> </Form>
</FormWrapper> </FormWrapper>
<FormWrapper> <FormWrapper>
<Form> <Form>
<UserAccountBlockTitle>Подписки</UserAccountBlockTitle> <UserAccountBlockTitle>
<T9n t='subscriptions' />
</UserAccountBlockTitle>
<UserAccountSubscription <UserAccountSubscription
amount={1999} amount={1999}
checked checked
inputType='radio' inputType='radio'
packageName='Базовая' packageName='Базовая'
packageAction='Изменить' packageAction={translate('change')}
/> />
<UserAccountSubscription <UserAccountSubscription
amount={1999} amount={1999}
@ -101,9 +118,9 @@ export const UserAccount = () => (
inputType='checkbox' inputType='checkbox'
label='Manchester United' label='Manchester United'
/> />
<UserAccountButton text='Выбрать подписку' /> <UserAccountButton text={translate('select_subscription')} />
<TextNoBorder <TextNoBorder
text='Следующее списание 31.02.2020' text={`${translate('next_debit')} 31.02.2020`}
amount={4796} amount={4796}
/> />
</Form> </Form>
@ -113,30 +130,32 @@ export const UserAccount = () => (
</Background> </Background>
<Background> <Background>
<UserAccountWrapper> <UserAccountWrapper>
<PageTitle titleText='Личный кабинет' /> <PageTitle titleText={translate('user_account')} />
<UserAccountFormWrapper> <UserAccountFormWrapper>
<FormWrapper> <FormWrapper>
<Form> <Form>
<UserAccountBlockTitle>Основное</UserAccountBlockTitle> <UserAccountBlockTitle>
<T9n t='main' />
</UserAccountBlockTitle>
<Input <Input
id='firstname' id='firstname'
label='Имя' label={translate('name')}
labelWidth={labelWidth} labelWidth={labelWidth}
/> />
<Input <Input
id='lastname' id='lastname'
label='Фамилия' label={translate('lastname')}
labelWidth={labelWidth} labelWidth={labelWidth}
/> />
<Input <Input
id='phone' id='phone'
label='Телефон' label={translate('phone')}
labelWidth={labelWidth} labelWidth={labelWidth}
/> />
<Input <Input
id='email' id='email'
type='email' type='email'
label='E-mail' label={translate('mail')}
labelWidth={labelWidth} labelWidth={labelWidth}
/> />
<Combobox <Combobox
@ -146,30 +165,36 @@ export const UserAccount = () => (
{ id: 2, name: 'Латвия' }, { id: 2, name: 'Латвия' },
{ id: 3, name: 'Россия' }, { id: 3, name: 'Россия' },
]} ]}
label='Страна' label={translate('country')}
labelWidth={labelWidth} labelWidth={labelWidth}
/> />
<OutlinedButton>Сохранить изменения</OutlinedButton> <OutlinedButton>
<T9n t='save_changes' />
</OutlinedButton>
</Form> </Form>
</FormWrapper> </FormWrapper>
<FormWrapper> <FormWrapper>
<Form> <Form>
<UserAccountBlockTitle>Оплата</UserAccountBlockTitle> <UserAccountBlockTitle>
<T9n t='payment' />
</UserAccountBlockTitle>
<CardNumber visa label='1234 1234 1234 1234' /> <CardNumber visa label='1234 1234 1234 1234' />
<CardNumber checked label='1234 1234 1234 1234' /> <CardNumber checked label='1234 1234 1234 1234' />
<CardNumber label='1234 1234 1234 1234' /> <CardNumber label='1234 1234 1234 1234' />
<UserAccountButton text='Добавить карту' /> <UserAccountButton text={translate('add_card')} />
</Form> </Form>
</FormWrapper> </FormWrapper>
<FormWrapper> <FormWrapper>
<Form> <Form>
<UserAccountBlockTitle>Подписки</UserAccountBlockTitle> <UserAccountBlockTitle>
<T9n t='subscriptions' />
</UserAccountBlockTitle>
<UserAccountSubscription <UserAccountSubscription
amount={1999} amount={1999}
checked checked
inputType='radio' inputType='radio'
packageName='Базовая' packageName='Базовая'
packageAction='Изменить' packageAction={translate('add_card')}
/> />
<UserAccountSubscription <UserAccountSubscription
noMarginBottom noMarginBottom
@ -209,9 +234,9 @@ export const UserAccount = () => (
inputType='checkbox' inputType='checkbox'
label='Manchester United' label='Manchester United'
/> />
<UserAccountButton text='Выбрать подписку' /> <UserAccountButton text={translate('select_subscription')} />
<TextNoBorder <TextNoBorder
text='Следующее списание 31.02.2020' text={`${translate('next_debit')} 31.02.2020`}
amount={4796} amount={4796}
/> />
</Form> </Form>
@ -221,3 +246,4 @@ export const UserAccount = () => (
</Background> </Background>
</UserAccountComponentWrapper> </UserAccountComponentWrapper>
) )
}

Loading…
Cancel
Save