Use proper constants.ts exports for Edit Profile Dialog limits (#10054)
This commit is contained in:
@@ -5,7 +5,7 @@ import {msg} from '@lingui/core/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {Plural, Trans} from '@lingui/react/macro'
|
import {Plural, Trans} from '@lingui/react/macro'
|
||||||
|
|
||||||
import {urls} from '#/lib/constants'
|
import {MAX_DESCRIPTION, MAX_DISPLAY_NAME, urls} from '#/lib/constants'
|
||||||
import {cleanError} from '#/lib/strings/errors'
|
import {cleanError} from '#/lib/strings/errors'
|
||||||
import {isOverMaxGraphemeCount} from '#/lib/strings/helpers'
|
import {isOverMaxGraphemeCount} from '#/lib/strings/helpers'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
@@ -26,9 +26,6 @@ import * as Toast from '#/components/Toast'
|
|||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
import {useSimpleVerificationState} from '#/components/verification'
|
import {useSimpleVerificationState} from '#/components/verification'
|
||||||
|
|
||||||
const DISPLAY_NAME_MAX_GRAPHEMES = 64
|
|
||||||
const DESCRIPTION_MAX_GRAPHEMES = 256
|
|
||||||
|
|
||||||
export function EditProfileDialog({
|
export function EditProfileDialog({
|
||||||
profile,
|
profile,
|
||||||
control,
|
control,
|
||||||
@@ -205,11 +202,11 @@ function DialogInner({
|
|||||||
|
|
||||||
const displayNameTooLong = isOverMaxGraphemeCount({
|
const displayNameTooLong = isOverMaxGraphemeCount({
|
||||||
text: displayName,
|
text: displayName,
|
||||||
maxCount: DISPLAY_NAME_MAX_GRAPHEMES,
|
maxCount: MAX_DISPLAY_NAME,
|
||||||
})
|
})
|
||||||
const descriptionTooLong = isOverMaxGraphemeCount({
|
const descriptionTooLong = isOverMaxGraphemeCount({
|
||||||
text: description,
|
text: description,
|
||||||
maxCount: DESCRIPTION_MAX_GRAPHEMES,
|
maxCount: MAX_DESCRIPTION,
|
||||||
})
|
})
|
||||||
|
|
||||||
const cancelButton = useCallback(
|
const cancelButton = useCallback(
|
||||||
@@ -330,7 +327,7 @@ function DialogInner({
|
|||||||
{color: t.palette.negative_400},
|
{color: t.palette.negative_400},
|
||||||
]}>
|
]}>
|
||||||
<Plural
|
<Plural
|
||||||
value={DISPLAY_NAME_MAX_GRAPHEMES}
|
value={MAX_DISPLAY_NAME}
|
||||||
other="Display name is too long. The maximum number of characters is #."
|
other="Display name is too long. The maximum number of characters is #."
|
||||||
/>
|
/>
|
||||||
</Text>
|
</Text>
|
||||||
@@ -381,7 +378,7 @@ function DialogInner({
|
|||||||
{color: t.palette.negative_400},
|
{color: t.palette.negative_400},
|
||||||
]}>
|
]}>
|
||||||
<Plural
|
<Plural
|
||||||
value={DESCRIPTION_MAX_GRAPHEMES}
|
value={MAX_DESCRIPTION}
|
||||||
other="Description is too long. The maximum number of characters is #."
|
other="Description is too long. The maximum number of characters is #."
|
||||||
/>
|
/>
|
||||||
</Text>
|
</Text>
|
||||||
|
|||||||
Reference in New Issue
Block a user