2017-08-09 13:44:24 +03:00
|
|
|
/*
|
2017-08-17 13:22:42 +03:00
|
|
|
Copyright 2017 New Vector Ltd
|
2019-06-18 00:29:19 +03:00
|
|
|
Copyright 2019 The Matrix.org Foundation C.I.C.
|
2017-08-09 13:44:24 +03:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import sdk from '../../../index';
|
|
|
|
import ScalarAuthClient from '../../../ScalarAuthClient';
|
|
|
|
import { _t } from '../../../languageHandler';
|
2019-07-09 20:51:56 +03:00
|
|
|
import { showIntegrationsManager } from '../../../integrations/integrations';
|
2017-08-09 13:44:24 +03:00
|
|
|
|
|
|
|
export default class ManageIntegsButton extends React.Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
}
|
|
|
|
|
2019-06-18 00:29:19 +03:00
|
|
|
onManageIntegrations = (ev) => {
|
2017-08-09 13:44:24 +03:00
|
|
|
ev.preventDefault();
|
2019-06-18 00:29:19 +03:00
|
|
|
|
2019-07-09 20:51:56 +03:00
|
|
|
showIntegrationsManager({ room: this.props.room });
|
2019-06-18 00:29:19 +03:00
|
|
|
};
|
2017-08-09 13:44:24 +03:00
|
|
|
|
|
|
|
render() {
|
2017-08-24 14:31:29 +03:00
|
|
|
let integrationsButton = <div />;
|
2019-06-18 00:29:19 +03:00
|
|
|
if (ScalarAuthClient.isPossible()) {
|
|
|
|
const AccessibleButton = sdk.getComponent("elements.AccessibleButton");
|
2017-09-19 13:57:23 +03:00
|
|
|
integrationsButton = (
|
2019-06-18 00:29:19 +03:00
|
|
|
<AccessibleButton
|
|
|
|
className='mx_RoomHeader_button mx_RoomHeader_manageIntegsButton'
|
|
|
|
title={_t("Manage Integrations")}
|
2019-02-12 19:42:11 +03:00
|
|
|
onClick={this.onManageIntegrations}
|
2019-06-18 00:29:19 +03:00
|
|
|
/>
|
2019-06-18 00:51:14 +03:00
|
|
|
);
|
2017-08-09 13:44:24 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return integrationsButton;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ManageIntegsButton.propTypes = {
|
2018-02-09 14:44:27 +03:00
|
|
|
room: PropTypes.object.isRequired,
|
2017-08-09 13:44:24 +03:00
|
|
|
};
|