Manage sticker packs link and add comments

This commit is contained in:
Richard Lewis 2018-01-22 17:00:50 +01:00
parent 23bef68a8f
commit 0441487e97
2 changed files with 19 additions and 3 deletions

View File

@ -115,7 +115,7 @@ export default class Stickerpack extends React.Component {
padding: '5px', padding: '5px',
borderTop: '1px solid #999', borderTop: '1px solid #999',
}}> }}>
<span className='mx_Stickers_addLink' onClick={this._launchManageIntegrations} >Add sticker packs</span> <span className='mx_Stickers_addLink' onClick={this._launchManageIntegrations} > { _t("Manage sticker packs") } </span>
</div> </div>
</div> </div>
); );
@ -126,6 +126,11 @@ export default class Stickerpack extends React.Component {
this.setState({stickersContent}); 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) { onShowStickersClick(e) {
const GenericElementContextMenu = sdk.getComponent('context_menus.GenericElementContextMenu'); const GenericElementContextMenu = sdk.getComponent('context_menus.GenericElementContextMenu');
const buttonRect = e.target.getBoundingClientRect(); const buttonRect = e.target.getBoundingClientRect();
@ -149,23 +154,33 @@ export default class Stickerpack extends React.Component {
this.setState({showStickers: true}); this.setState({showStickers: true});
} }
/**
* Trigger hiding of the sticker picker overlay
* @param {Event} ev Event that triggered the function call
*/
onHideStickersClick(ev) { onHideStickersClick(ev) {
this.stickersMenu.close(); this.stickersMenu.close();
} }
/**
* The stickers picker was hidden
*/
onFinished() { onFinished() {
this.setState({showStickers: false}); this.setState({showStickers: false});
this.stickersMenu = null; this.stickersMenu = null;
} }
/**
* Launch the integrations manager on the stickers integration page
*/
_launchManageIntegrations() { _launchManageIntegrations() {
this.onFinished(); this.onFinished();
const IntegrationsManager = sdk.getComponent("views.settings.IntegrationsManager"); const IntegrationsManager = sdk.getComponent("views.settings.IntegrationsManager");
const src = (this.scalarClient !== null && this.scalarClient.hasCredentials()) ? const src = (this.scalarClient !== null && this.scalarClient.hasCredentials()) ?
this.scalarClient.getScalarInterfaceUrlForRoom( this.scalarClient.getScalarInterfaceUrlForRoom(
this.props.room.roomId, this.props.room.roomId,
'add_integ', 'type_stickerpack',
// this.widgetId, this.widgetId,
) : ) :
null; null;
Modal.createTrackedDialog('Integrations Manager', '', IntegrationsManager, { Modal.createTrackedDialog('Integrations Manager', '', IntegrationsManager, {

View File

@ -555,6 +555,7 @@
"NOTE: Apps are not end-to-end encrypted": "NOTE: Apps are not end-to-end encrypted", "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:", "Do you want to load widget from URL:": "Do you want to load widget from URL:",
"Allow": "Allow", "Allow": "Allow",
"Manage sticker packs": "Manage sticker packs",
"Delete Widget": "Delete Widget", "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?", "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", "Delete widget": "Delete widget",