[Glitch] Profile editing: Re-adds the character counter with the new limit

Port 61e0ec8844e4bef17135ac00ee1df2b73b14b86e to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Echo 2026-03-25 16:31:58 +01:00 committed by Claire
parent ba56c45072
commit d610336398

View File

@ -3,6 +3,7 @@ import { useCallback, useState } from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { CharacterCounter } from '@/flavours/glitch/components/character_counter';
import { Details } from '@/flavours/glitch/components/details'; import { Details } from '@/flavours/glitch/components/details';
import { TextAreaField } from '@/flavours/glitch/components/form_fields'; import { TextAreaField } from '@/flavours/glitch/components/form_fields';
import { LoadingIndicator } from '@/flavours/glitch/components/loading_indicator'; import { LoadingIndicator } from '@/flavours/glitch/components/loading_indicator';
@ -84,7 +85,12 @@ export const ImageAltTextField: FC<{
const altLimit = useAppSelector( const altLimit = useAppSelector(
(state) => (state) =>
state.server.getIn( state.server.getIn(
['server', 'configuration', 'media_attachments', 'description_limit'], [
'server',
'configuration',
'accounts',
'max_header_description_length',
],
150, 150,
) as number, ) as number,
); );
@ -100,23 +106,26 @@ export const ImageAltTextField: FC<{
<> <>
<img src={imageSrc} alt='' className={classes.altImage} /> <img src={imageSrc} alt='' className={classes.altImage} />
<TextAreaField <div>
label={ <TextAreaField
<FormattedMessage label={
id='account_edit.image_alt_modal.text_label' <FormattedMessage
defaultMessage='Alt text' id='account_edit.image_alt_modal.text_label'
/> defaultMessage='Alt text'
} />
hint={ }
<FormattedMessage hint={
id='account_edit.image_alt_modal.text_hint' <FormattedMessage
defaultMessage='Alt text helps screen reader users to understand your content.' id='account_edit.image_alt_modal.text_hint'
/> defaultMessage='Alt text helps screen reader users to understand your content.'
} />
onChange={handleChange} }
value={altText} onChange={handleChange}
maxLength={altLimit} value={altText}
/> maxLength={altLimit}
/>
<CharacterCounter currentString={altText} maxLength={altLimit} />
</div>
{!hideTip && ( {!hideTip && (
<Details <Details