From 10f84911e5344f5c26a6c153a3e37db9f2f37baf Mon Sep 17 00:00:00 2001 From: crockwave Date: Wed, 23 Sep 2020 18:45:05 -0500 Subject: [PATCH] debugging drag drop --- app/soapbox/components/autosuggest_textarea.js | 2 +- .../features/chats/components/chat_box.js | 18 ++++++++++++++---- .../features/chats/components/chat_window.js | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/soapbox/components/autosuggest_textarea.js b/app/soapbox/components/autosuggest_textarea.js index 59a35989b..cdf8629dc 100644 --- a/app/soapbox/components/autosuggest_textarea.js +++ b/app/soapbox/components/autosuggest_textarea.js @@ -318,7 +318,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { render() { const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, children } = this.props; - const { suggestionsHidden } = this.state; + const { draggingOver, suggestionsHidden } = this.state; const style = { direction: 'ltr' }; if (isRtl(value)) { diff --git a/app/soapbox/features/chats/components/chat_box.js b/app/soapbox/features/chats/components/chat_box.js index 54199919e..b7f83a8fe 100644 --- a/app/soapbox/features/chats/components/chat_box.js +++ b/app/soapbox/features/chats/components/chat_box.js @@ -42,6 +42,7 @@ class ChatBox extends ImmutablePureComponent { onSetInputRef: PropTypes.func, me: PropTypes.node, onAttachment: PropTypes.func, + windowState: PropTypes.string, } initialState = () => ({ @@ -200,7 +201,6 @@ class ChatBox extends ImmutablePureComponent { if (e.dataTransfer && e.dataTransfer.files.length >= 1) { this.handleFiles(e.dataTransfer.files); - // this.props.dispatch(uploadCompose(e.dataTransfer.files)); } } @@ -242,6 +242,16 @@ class ChatBox extends ImmutablePureComponent { }); } + renderUploadArea = () => { + const { windowState } = this.props; + const { draggingOver } = this.state; + if (windowState !== 'open') return null; + + return ( + + ); + } + renderAttachment = () => { const { attachment } = this.state; if (!attachment) return null; @@ -271,9 +281,9 @@ class ChatBox extends ImmutablePureComponent { } render() { - const { chatMessageIds, chatId, intl } = this.props; + const { chatMessageIds, chatId, intl, windowState } = this.props; const { content, isUploading, uploadProgress } = this.state; - const { draggingOver } = this.state; + console.log('window state: ' + windowState + ', chatID: ' + chatId); if (!chatMessageIds) return null; return ( @@ -281,7 +291,7 @@ class ChatBox extends ImmutablePureComponent { {this.renderAttachment()} - + {this.renderUploadArea()}
{this.renderActionButton()}