From 9cc3d3c9bbaa4b8b8d7d54a11b2742fde09f440a Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Thu, 29 Mar 2018 21:48:03 +0100 Subject: [PATCH] Move default sticker content into generator function. --- src/components/views/rooms/Stickerpicker.js | 26 +++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/components/views/rooms/Stickerpicker.js b/src/components/views/rooms/Stickerpicker.js index 32bf284c19..63ebfe3496 100644 --- a/src/components/views/rooms/Stickerpicker.js +++ b/src/components/views/rooms/Stickerpicker.js @@ -1,6 +1,5 @@ /* -Copyright 2015, 2016 OpenMarket Ltd -Copyright 2017 New Vector Ltd +Copyright 2018 New Vector Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -38,21 +37,24 @@ export default class Stickerpicker extends React.Component { this._onWidgetAction = this._onWidgetAction.bind(this); this.onFinished = this.onFinished.bind(this); - this.defaultStickersContent = ( + this.popoverWidth = 300; + this.popoverHeight = 300; + + this.state = { + stickersContent: this.defaultStickersContent(), + showStickers: false, + imError: null, + }; + } + + defaultStickersContent() { + return (

{ _t("You don't currently have any stickerpacks enabled") }

{ _t("Click") } { _t("here") } { _t("to add some!") }

{_t('Add
); - this.popoverWidth = 300; - this.popoverHeight = 300; - - this.state = { - stickersContent: this.defaultStickersContent, - showStickers: false, - imError: null, - }; } _removeStickerpickerWidgets() { @@ -175,7 +177,7 @@ export default class Stickerpicker extends React.Component { } else { // Default content to show if stickerpicker widget not added console.warn("No available sticker picker widgets"); - stickersContent = this.defaultStickersContent; + stickersContent = this.defaultStickersContent(); this.widgetId = null; this.forceUpdate(); }