From a3c6dd36eff90f386b553af96b45166a30dc3dc6 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Fri, 12 Jan 2018 17:38:21 +0000 Subject: [PATCH] Stickers popover. --- src/components/views/rooms/MessageComposer.js | 129 +++++++++++------- 1 file changed, 79 insertions(+), 50 deletions(-) diff --git a/src/components/views/rooms/MessageComposer.js b/src/components/views/rooms/MessageComposer.js index 9f4a017689..b17694011c 100644 --- a/src/components/views/rooms/MessageComposer.js +++ b/src/components/views/rooms/MessageComposer.js @@ -23,7 +23,7 @@ import sdk from '../../../index'; import dis from '../../../dispatcher'; import Autocomplete from './Autocomplete'; import SettingsStore, {SettingLevel} from "../../../settings/SettingsStore"; -import Popover from 'react-simple-popover'; +import Popover, {ArrowContainer} from 'react-tiny-popover'; import Widgets from '../../../utils/widgets'; import AppTile from '../elements/AppTile'; @@ -266,7 +266,13 @@ export default class MessageComposer extends React.Component { alt={e2eTitle} title={e2eTitle} />, ); - let callButton, videoCallButton, hangupButton, showStickersButton, hideStickersButton; + + let callButton; + let videoCallButton; + let hangupButton; + let stickersButton; + + // Call buttons if (this.props.callState && this.props.callState !== 'ended') { hangupButton =
@@ -284,63 +290,58 @@ export default class MessageComposer extends React.Component { } // Stickers - if (this.state.showStickers) { - const popoverWidth = '300px'; - const popoverHeight = '300px'; - const stickerpackWidget = Widgets.getStickerpackWidgets()[0]; - let stickersContent =

Click here to add your first sitckerpack

; - if (stickerpackWidget && stickerpackWidget.content && stickerpackWidget.content.url) { - stickersContent =
- -
; - } + }} + > + +
; + } else { + // Default content to show if stickerpack widget not added + this.state.stickersContent =

Click here to add your first sitckerpack

; + } - hideStickersButton = + + if (this.state.showStickers) { + // Show hide-stickers button + stickersButton =
-
; } else { - showStickersButton = + // Show show-stickers button + stickersButton =
; } - const stickersContainer =
- { showStickersButton } - { hideStickersButton } -
; + + const stickers = ( + +
+ { this.state.stickersContent } +
+
+ )} + > +
+ { stickersButton } +
+
; const canSendMessages = this.props.room.currentState.maySendMessage( MatrixClientPeg.get().credentials.userId); @@ -398,7 +427,7 @@ export default class MessageComposer extends React.Component { hangupButton, callButton, videoCallButton, - stickersContainer, + stickers, ); } else { controls.push(