Skip to content

Commit

Permalink
fix(i18n): replace title,desc missed earlier (#7940)
Browse files Browse the repository at this point in the history
fix(i18n): replace title,desc labels missed earlier
  • Loading branch information
LoneRifle authored Dec 11, 2024
1 parent 71be05a commit a2a04bd
Show file tree
Hide file tree
Showing 17 changed files with 145 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const EditAttachment = ({ field }: EditAttachmentProps): JSX.Element => {
)
},
}),
[maxTotalSizeMb, otherAttachmentsSize],
[maxTotalSizeMb, otherAttachmentsSize, t],
)

const validateAttachmentSize = useCallback(() => {
Expand All @@ -154,12 +154,18 @@ export const EditAttachment = ({ field }: EditAttachmentProps): JSX.Element => {
return (
<CreatePageDrawerContentContainer>
<FormControl isRequired isReadOnly={isLoading} isInvalid={!!errors.title}>
<FormLabel>Field Name</FormLabel>
<FormLabel>
{t('features.adminForm.sidebar.fields.commonFieldComponents.title')}
</FormLabel>
<Input autoFocus {...register('title', requiredValidationRule)} />
<FormErrorMessage>{errors?.title?.message}</FormErrorMessage>
</FormControl>
<FormControl isReadOnly={isLoading} isInvalid={!!errors.description}>
<FormLabel>Description</FormLabel>
<FormLabel>
{t(
'features.adminForm.sidebar.fields.commonFieldComponents.description',
)}
</FormLabel>
<Textarea {...register('description')} />
<FormErrorMessage>{errors?.description?.message}</FormErrorMessage>
</FormControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,18 @@ export const EditCheckbox = ({ field }: EditCheckboxProps): JSX.Element => {
return (
<CreatePageDrawerContentContainer>
<FormControl isRequired isReadOnly={isLoading} isInvalid={!!errors.title}>
<FormLabel>Field Name</FormLabel>
<FormLabel>
{t('features.adminForm.sidebar.fields.commonFieldComponents.title')}
</FormLabel>
<Input autoFocus {...register('title', requiredValidationRule)} />
<FormErrorMessage>{errors?.title?.message}</FormErrorMessage>
</FormControl>
<FormControl isReadOnly={isLoading} isInvalid={!!errors.description}>
<FormLabel>Description</FormLabel>
<FormLabel>
{t(
'features.adminForm.sidebar.fields.commonFieldComponents.description',
)}
</FormLabel>
<Textarea {...register('description')} />
<FormErrorMessage>{errors?.description?.message}</FormErrorMessage>
</FormControl>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import { FormControl } from '@chakra-ui/react'
import { extend, pick } from 'lodash'

Expand Down Expand Up @@ -61,6 +62,8 @@ export const EditCountryRegion = ({
},
})

const { t } = useTranslation()

const requiredValidationRule = useMemo(
() => createBaseValidationRules({ required: true }),
[],
Expand All @@ -69,12 +72,18 @@ export const EditCountryRegion = ({
return (
<CreatePageDrawerContentContainer>
<FormControl isRequired isReadOnly={isLoading} isInvalid={!!errors.title}>
<FormLabel>Field Name</FormLabel>
<FormLabel>
{t('features.adminForm.sidebar.fields.commonFieldComponents.title')}
</FormLabel>
<Input autoFocus {...register('title', requiredValidationRule)} />
<FormErrorMessage>{errors?.title?.message}</FormErrorMessage>
</FormControl>
<FormControl isReadOnly={isLoading} isInvalid={!!errors.description}>
<FormLabel>Description</FormLabel>
<FormLabel>
{t(
'features.adminForm.sidebar.fields.commonFieldComponents.description',
)}
</FormLabel>
<Textarea {...register('description')} />
<FormErrorMessage>{errors?.description?.message}</FormErrorMessage>
</FormControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,20 +253,26 @@ export const EditDate = ({ field }: EditDateProps): JSX.Element => {
},
deps: 'invalidDays',
}),
[getValues],
[getValues, t],
)

const { drawerWidth } = useCreatePageSidebarLayout()

return (
<CreatePageDrawerContentContainer>
<FormControl isRequired isReadOnly={isLoading} isInvalid={!!errors.title}>
<FormLabel>Field Name</FormLabel>
<FormLabel>
{t('features.adminForm.sidebar.fields.commonFieldComponents.title')}
</FormLabel>
<Input autoFocus {...register('title', requiredValidationRule)} />
<FormErrorMessage>{errors?.title?.message}</FormErrorMessage>
</FormControl>
<FormControl isReadOnly={isLoading} isInvalid={!!errors.description}>
<FormLabel>Description</FormLabel>
<FormLabel>
{t(
'features.adminForm.sidebar.fields.commonFieldComponents.description',
)}
</FormLabel>
<Textarea {...register('description')} />
<FormErrorMessage>{errors?.description?.message}</FormErrorMessage>
</FormControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,14 @@ export const EditDecimal = ({ field }: EditDecimalProps): JSX.Element => {
)
},
}
}, [getValues])
}, [getValues, t])

return (
<CreatePageDrawerContentContainer>
<FormControl isRequired isReadOnly={isLoading} isInvalid={!!errors.title}>
<FormLabel>Field Name</FormLabel>
<FormLabel>
{t('features.adminForm.sidebar.fields.commonFieldComponents.title')}
</FormLabel>
<Input autoFocus {...register('title', requiredValidationRule)} />
<FormErrorMessage>{errors?.title?.message}</FormErrorMessage>
</FormControl>
Expand All @@ -107,7 +109,11 @@ export const EditDecimal = ({ field }: EditDecimalProps): JSX.Element => {
isReadOnly={isLoading}
isInvalid={!!errors.description}
>
<FormLabel>Description</FormLabel>
<FormLabel>
{t(
'features.adminForm.sidebar.fields.commonFieldComponents.description',
)}
</FormLabel>
<Textarea {...register('description')} />
<FormErrorMessage>{errors?.description?.message}</FormErrorMessage>
</FormControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,18 @@ export const EditDropdown = ({ field }: EditDropdownProps): JSX.Element => {
return (
<CreatePageDrawerContentContainer>
<FormControl isRequired isReadOnly={isLoading} isInvalid={!!errors.title}>
<FormLabel>Field Name</FormLabel>
<FormLabel>
{t('features.adminForm.sidebar.fields.commonFieldComponents.title')}
</FormLabel>
<Input autoFocus {...register('title', requiredValidationRule)} />
<FormErrorMessage>{errors?.title?.message}</FormErrorMessage>
</FormControl>
<FormControl isReadOnly={isLoading} isInvalid={!!errors.description}>
<FormLabel>Description</FormLabel>
<FormLabel>
{t(
'features.adminForm.sidebar.fields.commonFieldComponents.description',
)}
</FormLabel>
<Textarea {...register('description')} />
<FormErrorMessage>{errors?.description?.message}</FormErrorMessage>
</FormControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ export const EditEmail = ({ field }: EditEmailProps): JSX.Element => {
return (
<CreatePageDrawerContentContainer>
<FormControl isRequired isReadOnly={isLoading} isInvalid={!!errors.title}>
<FormLabel>Field Name</FormLabel>
<FormLabel>
{t('features.adminForm.sidebar.fields.commonFieldComponents.title')}
</FormLabel>
<Input autoFocus {...register('title', requiredValidationRule)} />
<FormErrorMessage>{errors?.title?.message}</FormErrorMessage>
</FormControl>
Expand All @@ -164,7 +166,11 @@ export const EditEmail = ({ field }: EditEmailProps): JSX.Element => {
isReadOnly={isLoading}
isInvalid={!!errors.description}
>
<FormLabel>Description</FormLabel>
<FormLabel>
{t(
'features.adminForm.sidebar.fields.commonFieldComponents.description',
)}
</FormLabel>
<Textarea {...register('description')} />
<FormErrorMessage>{errors?.description?.message}</FormErrorMessage>
</FormControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ export const EditHeader = ({ field }: EditHeaderProps): JSX.Element => {
<FormErrorMessage>{errors?.title?.message}</FormErrorMessage>
</FormControl>
<FormControl isReadOnly={isLoading} isInvalid={!!errors.description}>
<FormLabel>Description</FormLabel>
<FormLabel>
{t(
'features.adminForm.sidebar.fields.commonFieldComponents.description',
)}
</FormLabel>
<Textarea {...register('description')} />
<FormErrorMessage>{errors?.description?.message}</FormErrorMessage>
</FormControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ export const EditHomeno = ({ field }: EditHomenoProps): JSX.Element => {
return (
<CreatePageDrawerContentContainer>
<FormControl isRequired isReadOnly={isLoading} isInvalid={!!errors.title}>
<FormLabel>Field Name</FormLabel>
<FormLabel>
{t('features.adminForm.sidebar.fields.commonFieldComponents.title')}
</FormLabel>
<Input autoFocus {...register('title', requiredValidationRule)} />
<FormErrorMessage>{errors?.title?.message}</FormErrorMessage>
</FormControl>
Expand All @@ -63,7 +65,11 @@ export const EditHomeno = ({ field }: EditHomenoProps): JSX.Element => {
isReadOnly={isLoading}
isInvalid={!!errors.description}
>
<FormLabel>Description</FormLabel>
<FormLabel>
{t(
'features.adminForm.sidebar.fields.commonFieldComponents.description',
)}
</FormLabel>
<Textarea {...register('description')} />
<FormErrorMessage>{errors?.description?.message}</FormErrorMessage>
</FormControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,11 @@ export const EditImage = ({ field }: EditImageProps): JSX.Element => {
isReadOnly={isLoading || isSubmitting}
isInvalid={!!errors.description}
>
<FormLabel isRequired>Description</FormLabel>
<FormLabel isRequired>
{t(
'features.adminForm.sidebar.fields.commonFieldComponents.description',
)}
</FormLabel>
<Textarea {...register('description', requiredValidationRule)} />
<FormErrorMessage>{errors?.description?.message}</FormErrorMessage>
</FormControl>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useMemo } from 'react'
import { Controller, RegisterOptions } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { FormControl, SimpleGrid } from '@chakra-ui/react'
import { extend, isEmpty, pick } from 'lodash'

Expand Down Expand Up @@ -87,6 +88,8 @@ export const EditLongText = ({ field }: EditLongTextProps): JSX.Element => {
},
})

const { t } = useTranslation()

const requiredValidationRule = useMemo(
() => createBaseValidationRules({ required: true }),
[],
Expand Down Expand Up @@ -130,7 +133,9 @@ export const EditLongText = ({ field }: EditLongTextProps): JSX.Element => {
return (
<CreatePageDrawerContentContainer>
<FormControl isRequired isReadOnly={isLoading} isInvalid={!!errors.title}>
<FormLabel>Field Name</FormLabel>
<FormLabel>
{t('features.adminForm.sidebar.fields.commonFieldComponents.title')}
</FormLabel>
<Input autoFocus {...register('title', requiredValidationRule)} />
<FormErrorMessage>{errors?.title?.message}</FormErrorMessage>
</FormControl>
Expand All @@ -139,7 +144,11 @@ export const EditLongText = ({ field }: EditLongTextProps): JSX.Element => {
isReadOnly={isLoading}
isInvalid={!!errors.description}
>
<FormLabel>Description</FormLabel>
<FormLabel>
{t(
'features.adminForm.sidebar.fields.commonFieldComponents.description',
)}
</FormLabel>
<Textarea {...register('description')} />
<FormErrorMessage>{errors?.description?.message}</FormErrorMessage>
</FormControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ export const EditMobile = ({ field }: EditMobileProps): JSX.Element => {
isReadOnly={isLoading}
isInvalid={!!errors.title}
>
<FormLabel>Field Name</FormLabel>
<FormLabel>
{t('features.adminForm.sidebar.fields.commonFieldComponents.title')}
</FormLabel>
<Input autoFocus {...register('title', requiredValidationRule)} />
<FormErrorMessage>{errors?.title?.message}</FormErrorMessage>
</FormControl>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import { FormControl } from '@chakra-ui/react'
import { extend, pick } from 'lodash'

Expand Down Expand Up @@ -39,6 +40,8 @@ export const EditNric = ({ field }: EditNricProps): JSX.Element => {
},
})

const { t } = useTranslation()

const requiredValidationRule = useMemo(
() => createBaseValidationRules({ required: true }),
[],
Expand All @@ -47,12 +50,18 @@ export const EditNric = ({ field }: EditNricProps): JSX.Element => {
return (
<CreatePageDrawerContentContainer>
<FormControl isRequired isReadOnly={isLoading} isInvalid={!!errors.title}>
<FormLabel>Field Name</FormLabel>
<FormLabel>
{t('features.adminForm.sidebar.fields.commonFieldComponents.title')}
</FormLabel>
<Input autoFocus {...register('title', requiredValidationRule)} />
<FormErrorMessage>{errors?.title?.message}</FormErrorMessage>
</FormControl>
<FormControl isReadOnly={isLoading} isInvalid={!!errors.description}>
<FormLabel>Description</FormLabel>
<FormLabel>
{t(
'features.adminForm.sidebar.fields.commonFieldComponents.description',
)}
</FormLabel>
<Textarea {...register('description')} />
<FormErrorMessage>{errors?.description?.message}</FormErrorMessage>
</FormControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,18 @@ export const EditRating = ({ field }: EditRatingProps): JSX.Element => {
return (
<CreatePageDrawerContentContainer>
<FormControl isRequired isReadOnly={isLoading} isInvalid={!!errors.title}>
<FormLabel>Field Name</FormLabel>
<FormLabel>
{t('features.adminForm.sidebar.fields.commonFieldComponents.title')}
</FormLabel>
<Input autoFocus {...register('title', requiredValidationRule)} />
<FormErrorMessage>{errors?.title?.message}</FormErrorMessage>
</FormControl>
<FormControl isReadOnly={isLoading} isInvalid={!!errors.description}>
<FormLabel>Description</FormLabel>
<FormLabel>
{t(
'features.adminForm.sidebar.fields.commonFieldComponents.description',
)}
</FormLabel>
<Textarea {...register('description')} />
<FormErrorMessage>{errors?.description?.message}</FormErrorMessage>
</FormControl>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useMemo, useRef } from 'react'
import { Controller, RegisterOptions } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import {
FormControl,
InputGroup,
Expand Down Expand Up @@ -102,6 +103,7 @@ export const EditShortText = ({ field }: EditShortTextProps): JSX.Element => {
output: transformShortTextEditFormToField,
},
})
const { t } = useTranslation()

const requiredValidationRule = useMemo(
() => createBaseValidationRules({ required: true }),
Expand Down Expand Up @@ -175,7 +177,9 @@ export const EditShortText = ({ field }: EditShortTextProps): JSX.Element => {
return (
<CreatePageDrawerContentContainer>
<FormControl isRequired isReadOnly={isLoading} isInvalid={!!errors.title}>
<FormLabel>Field Name</FormLabel>
<FormLabel>
{t('features.adminForm.sidebar.fields.commonFieldComponents.title')}
</FormLabel>
<Input autoFocus {...register('title', requiredValidationRule)} />
<FormErrorMessage>{errors?.title?.message}</FormErrorMessage>
</FormControl>
Expand All @@ -184,7 +188,11 @@ export const EditShortText = ({ field }: EditShortTextProps): JSX.Element => {
isReadOnly={isLoading}
isInvalid={!!errors.description}
>
<FormLabel>Description</FormLabel>
<FormLabel>
{t(
'features.adminForm.sidebar.fields.commonFieldComponents.description',
)}
</FormLabel>
<Textarea {...register('description')} />
<FormErrorMessage>{errors?.description?.message}</FormErrorMessage>
</FormControl>
Expand Down
Loading

0 comments on commit a2a04bd

Please sign in to comment.