From eb848d082afc8864b2aa15858f414e4867902c65 Mon Sep 17 00:00:00 2001 From: Echo Date: Fri, 6 Mar 2026 13:57:06 +0100 Subject: [PATCH] Profile editing: Rearranging and adding fields (#38083) --- .../form_fields/emoji_text_field.stories.tsx | 6 +- .../form_fields/emoji_text_field.tsx | 18 +- .../account_edit/components/field.tsx | 29 ++ .../mastodon/features/account_edit/index.tsx | 70 +++- .../account_edit/modals/bio_modal.tsx | 12 +- .../account_edit/modals/fields_modals.tsx | 60 +++- .../modals/fields_reorder_modal.tsx | 322 ++++++++++++++++++ .../features/account_edit/modals/index.ts | 1 + .../account_edit/modals/name_modal.tsx | 2 +- .../account_edit/modals/styles.module.scss | 66 ++++ .../account_edit/modals/verified_modal.tsx | 1 + .../features/account_edit/styles.module.scss | 22 +- app/javascript/mastodon/locales/en.json | 12 + .../400-24px/drag_indicator-fill.svg | 1 + .../400-24px/drag_indicator.svg | 1 + package.json | 1 + yarn.lock | 14 + 17 files changed, 595 insertions(+), 43 deletions(-) create mode 100644 app/javascript/mastodon/features/account_edit/components/field.tsx create mode 100644 app/javascript/mastodon/features/account_edit/modals/fields_reorder_modal.tsx create mode 100644 app/javascript/material-icons/400-24px/drag_indicator-fill.svg create mode 100644 app/javascript/material-icons/400-24px/drag_indicator.svg diff --git a/app/javascript/mastodon/components/form_fields/emoji_text_field.stories.tsx b/app/javascript/mastodon/components/form_fields/emoji_text_field.stories.tsx index aed04bbcbf..05df009ecf 100644 --- a/app/javascript/mastodon/components/form_fields/emoji_text_field.stories.tsx +++ b/app/javascript/mastodon/components/form_fields/emoji_text_field.stories.tsx @@ -26,13 +26,13 @@ export const Simple: Story = {}; export const WithMaxLength: Story = { args: { - maxLength: 20, + counterMax: 20, }, }; export const WithRecommended: Story = { args: { - maxLength: 20, + counterMax: 20, recommended: true, }, }; @@ -52,7 +52,7 @@ export const TextArea: Story = { value={value} onChange={setValue} label='Label' - maxLength={100} + counterMax={100} /> ); }, diff --git a/app/javascript/mastodon/components/form_fields/emoji_text_field.tsx b/app/javascript/mastodon/components/form_fields/emoji_text_field.tsx index 9c29bcbf91..a57c4d1dd4 100644 --- a/app/javascript/mastodon/components/form_fields/emoji_text_field.tsx +++ b/app/javascript/mastodon/components/form_fields/emoji_text_field.tsx @@ -26,7 +26,7 @@ import { TextInput } from './text_input_field'; export type EmojiInputProps = { value?: string; onChange?: Dispatch>; - maxLength?: number; + counterMax?: number; recommended?: boolean; } & Omit; @@ -39,6 +39,7 @@ export const EmojiTextInputField: FC< hint, hasError, maxLength, + counterMax = maxLength, recommended, disabled, ...otherProps @@ -49,7 +50,7 @@ export const EmojiTextInputField: FC< label, hint, hasError, - maxLength, + counterMax, recommended, disabled, inputRef, @@ -63,6 +64,7 @@ export const EmojiTextInputField: FC< @@ -78,7 +80,8 @@ export const EmojiTextAreaField: FC< value, label, maxLength, - recommended = false, + counterMax = maxLength, + recommended, disabled, hint, hasError, @@ -90,7 +93,7 @@ export const EmojiTextAreaField: FC< label, hint, hasError, - maxLength, + counterMax, recommended, disabled, inputRef: textareaRef, @@ -104,6 +107,7 @@ export const EmojiTextAreaField: FC<