From 47faf47ed5a20d7d959110caefe6839d12343ec7 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Sun, 21 Apr 2019 12:44:30 +0200 Subject: ComposerTextarea → AutosuggestTextarea MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../compose/components/autosuggest_account.js | 24 ++++++++++ .../features/compose/components/compose_form.js | 54 ++++++++++++++-------- .../containers/autosuggest_account_container.js | 15 ++++++ 3 files changed, 74 insertions(+), 19 deletions(-) create mode 100644 app/javascript/flavours/glitch/features/compose/components/autosuggest_account.js create mode 100644 app/javascript/flavours/glitch/features/compose/containers/autosuggest_account_container.js (limited to 'app/javascript/flavours/glitch/features/compose') diff --git a/app/javascript/flavours/glitch/features/compose/components/autosuggest_account.js b/app/javascript/flavours/glitch/features/compose/components/autosuggest_account.js new file mode 100644 index 000000000..fb9bb5035 --- /dev/null +++ b/app/javascript/flavours/glitch/features/compose/components/autosuggest_account.js @@ -0,0 +1,24 @@ +import React from 'react'; +import Avatar from 'flavours/glitch/components/avatar'; +import DisplayName from 'flavours/glitch/components/display_name'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + +export default class AutosuggestAccount extends ImmutablePureComponent { + + static propTypes = { + account: ImmutablePropTypes.map.isRequired, + }; + + render () { + const { account } = this.props; + + return ( +
+
+ +
+ ); + } + +} diff --git a/app/javascript/flavours/glitch/features/compose/components/compose_form.js b/app/javascript/flavours/glitch/features/compose/components/compose_form.js index ecd1aed69..2ea137965 100644 --- a/app/javascript/flavours/glitch/features/compose/components/compose_form.js +++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.js @@ -7,17 +7,20 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; // Components. import ComposerOptions from '../../composer/options'; import ComposerPublisher from '../../composer/publisher'; -import ComposerTextarea from '../../composer/textarea'; +import ComposerTextareaIcons from '../../composer/textarea/icons'; import UploadFormContainer from '../containers/upload_form_container'; import PollFormContainer from '../containers/poll_form_container'; import WarningContainer from '../containers/warning_container'; import ReplyIndicatorContainer from '../containers/reply_indicator_container'; +import EmojiPicker from 'flavours/glitch/features/emoji_picker'; +import AutosuggestTextarea from '../../../components/autosuggest_textarea'; // Utils. import { countableText } from 'flavours/glitch/util/counter'; import { isMobile } from 'flavours/glitch/util/is_mobile'; const messages = defineMessages({ + placeholder: { id: 'compose_form.placeholder', defaultMessage: 'What is on your mind?' }, missingDescriptionMessage: { id: 'confirmations.missing_media_description.message', defaultMessage: 'At least one media attachment is lacking a description. Consider describing all media attachments for the visually impaired before sending your toot.' }, missingDescriptionConfirm: { id: 'confirmations.missing_media_description.confirm', @@ -183,7 +186,7 @@ class ComposeForm extends ImmutablePureComponent { } // Sets a reference to the textarea. - handleRefTextarea = (textareaComponent) => { + setAutosuggestTextarea = (textareaComponent) => { if (textareaComponent) { this.textarea = textareaComponent.textarea; } @@ -269,6 +272,10 @@ class ComposeForm extends ImmutablePureComponent { } } + handleChange = (e) => { + this.props.onChangeText(e.target.value); + } + render () { const { handleEmoji, @@ -339,27 +346,35 @@ class ComposeForm extends ImmutablePureComponent { - +
+ + + + + +
+
+ 0)} spoiler={spoilersAlwaysOn ? (spoilerText && spoilerText.length > 0) : spoiler} /> + { + const getAccount = makeGetAccount(); + + const mapStateToProps = (state, { id }) => ({ + account: getAccount(state, id), + }); + + return mapStateToProps; +}; + +export default connect(makeMapStateToProps)(AutosuggestAccount); -- cgit