From 0441487e97573dde03578efd8b621ab5394ff0a0 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Mon, 22 Jan 2018 17:00:50 +0100 Subject: [PATCH] Manage sticker packs link and add comments --- src/components/views/rooms/Stickerpack.js | 21 ++++++++++++++++++--- src/i18n/strings/en_EN.json | 1 + 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/components/views/rooms/Stickerpack.js b/src/components/views/rooms/Stickerpack.js index 3c4a8f6425..cb2a19eae7 100644 --- a/src/components/views/rooms/Stickerpack.js +++ b/src/components/views/rooms/Stickerpack.js @@ -115,7 +115,7 @@ export default class Stickerpack extends React.Component { padding: '5px', borderTop: '1px solid #999', }}> - Add sticker packs + { _t("Manage sticker packs") } ); @@ -126,6 +126,11 @@ export default class Stickerpack extends React.Component { this.setState({stickersContent}); } + /** + * Show the sticker picker overlay + * If no stickerpacks have been added, show a link to the integration manager add sticker packs page. + * @param {Event} e Event that triggered the function + */ onShowStickersClick(e) { const GenericElementContextMenu = sdk.getComponent('context_menus.GenericElementContextMenu'); const buttonRect = e.target.getBoundingClientRect(); @@ -149,23 +154,33 @@ export default class Stickerpack extends React.Component { this.setState({showStickers: true}); } + /** + * Trigger hiding of the sticker picker overlay + * @param {Event} ev Event that triggered the function call + */ onHideStickersClick(ev) { this.stickersMenu.close(); } + /** + * The stickers picker was hidden + */ onFinished() { this.setState({showStickers: false}); this.stickersMenu = null; } + /** + * Launch the integrations manager on the stickers integration page + */ _launchManageIntegrations() { this.onFinished(); const IntegrationsManager = sdk.getComponent("views.settings.IntegrationsManager"); const src = (this.scalarClient !== null && this.scalarClient.hasCredentials()) ? this.scalarClient.getScalarInterfaceUrlForRoom( this.props.room.roomId, - 'add_integ', - // this.widgetId, + 'type_stickerpack', + this.widgetId, ) : null; Modal.createTrackedDialog('Integrations Manager', '', IntegrationsManager, { diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 41f1b75e43..a4152ef94a 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -555,6 +555,7 @@ "NOTE: Apps are not end-to-end encrypted": "NOTE: Apps are not end-to-end encrypted", "Do you want to load widget from URL:": "Do you want to load widget from URL:", "Allow": "Allow", + "Manage sticker packs": "Manage sticker packs", "Delete Widget": "Delete Widget", "Deleting a widget removes it for all users in this room. Are you sure you want to delete this widget?": "Deleting a widget removes it for all users in this room. Are you sure you want to delete this widget?", "Delete widget": "Delete widget",