-
-
- {this.props.value === undefined ? (
-
-
-
- ) : (
-
- )}
-
- );
- }
-
-}
-
-export default injectIntl(AccountNote);
diff --git a/app/javascript/mastodon/features/account/components/account_note.tsx b/app/javascript/mastodon/features/account/components/account_note.tsx
new file mode 100644
index 0000000000..ea3a4cdaca
--- /dev/null
+++ b/app/javascript/mastodon/features/account/components/account_note.tsx
@@ -0,0 +1,131 @@
+import type { ChangeEventHandler, KeyboardEventHandler } from 'react';
+import { useState, useRef, useCallback, useId } from 'react';
+
+import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
+
+import Textarea from 'react-textarea-autosize';
+
+import { submitAccountNote } from '@/mastodon/actions/account_notes';
+import { LoadingIndicator } from '@/mastodon/components/loading_indicator';
+import { useAppDispatch, useAppSelector } from '@/mastodon/store';
+
+const messages = defineMessages({
+ placeholder: {
+ id: 'account_note.placeholder',
+ defaultMessage: 'Click to add a note',
+ },
+});
+
+const AccountNoteUI: React.FC<{
+ initialValue: string | undefined;
+ onSubmit: (newNote: string) => void;
+ wasSaved: boolean;
+}> = ({ initialValue, onSubmit, wasSaved }) => {
+ const intl = useIntl();
+ const uniqueId = useId();
+ const [value, setValue] = useState(initialValue ?? '');
+ const isLoading = initialValue === undefined;
+ const canSubmitOnBlurRef = useRef(true);
+
+ const handleChange = useCallback