Use proper constants.ts exports for Edit Profile Dialog limits (#10054)

This commit is contained in:
RetroSunstar
2026-03-17 17:04:04 +00:00
committed by GitHub
parent 5e8ef6aa9b
commit dbba97f28d
@@ -5,7 +5,7 @@ import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
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 {isOverMaxGraphemeCount} from '#/lib/strings/helpers'
import {logger} from '#/logger'
@@ -26,9 +26,6 @@ import * as Toast from '#/components/Toast'
import {Text} from '#/components/Typography'
import {useSimpleVerificationState} from '#/components/verification'
const DISPLAY_NAME_MAX_GRAPHEMES = 64
const DESCRIPTION_MAX_GRAPHEMES = 256
export function EditProfileDialog({
profile,
control,
@@ -205,11 +202,11 @@ function DialogInner({
const displayNameTooLong = isOverMaxGraphemeCount({
text: displayName,
maxCount: DISPLAY_NAME_MAX_GRAPHEMES,
maxCount: MAX_DISPLAY_NAME,
})
const descriptionTooLong = isOverMaxGraphemeCount({
text: description,
maxCount: DESCRIPTION_MAX_GRAPHEMES,
maxCount: MAX_DESCRIPTION,
})
const cancelButton = useCallback(
@@ -330,7 +327,7 @@ function DialogInner({
{color: t.palette.negative_400},
]}>
<Plural
value={DISPLAY_NAME_MAX_GRAPHEMES}
value={MAX_DISPLAY_NAME}
other="Display name is too long. The maximum number of characters is #."
/>
</Text>
@@ -381,7 +378,7 @@ function DialogInner({
{color: t.palette.negative_400},
]}>
<Plural
value={DESCRIPTION_MAX_GRAPHEMES}
value={MAX_DESCRIPTION}
other="Description is too long. The maximum number of characters is #."
/>
</Text>