Cleaned up unused files and removed commented code

This commit is contained in:
Richard Lewis 2017-06-27 11:28:38 +01:00
parent 2cb2c44bd8
commit e343e99355
6 changed files with 3 additions and 231 deletions

View File

@ -1,28 +0,0 @@
/*
Copyright 2015, 2016 OpenMarket Ltd
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 ModularWidgets from './ModularWidgets';
class AppWidget {
constructor(type, url, options) {
if(!ModularWidgets.widgetTypes.includes(type) || url === "") {
return null;
}
this.type = type;
this.url = url;
this.options = options || {};
}
}
export default AppWidget;

View File

@ -1,35 +0,0 @@
class ModularWidgets {
static widgetTypes = [
{
type: 'etherpad',
icon: 'http://localhost:8000/static/etherpad.svg',
name: 'Etherpad',
description: 'Collaborative text editor',
},
{
type: 'grafana',
icon: 'http://localhost:8000/static/grafana.svg',
name: 'Grafana',
description: 'Graph and monitor all the things!',
},
{
type: 'jitsi',
icon: 'http://localhost:8000/static/jitsi.svg',
name: 'jitsi',
description: 'Jitsi video conference',
},
{
type: 'vrdemo',
icon: 'http://localhost:8000/static/cardboard.png',
name: 'vrdemo',
description: 'Matrix VR Demo',
},
{
type: 'custom',
icon: 'http://localhost:8000/static/blocks.png',
name: 'Custom Widget',
description: 'Add your own custom widget',
},
];
}
export default ModularWidgets;

View File

@ -1,58 +0,0 @@
/*
Copyright 2015, 2016 OpenMarket Ltd
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.
*/
'use strict';
import React from 'react';
class AppIconTile extends React.Component {
constructor(props) {
super(props);
this._onTileClick = this._onTileClick.bind(this);
}
_onTileClick(props) {
this.props.onClick(this.props.type);
}
render() {
const contentClasses = ['mx_AppIconTile'];
// if(this.props.type == 'custom') {
// contentClasses.push('mx_AppIconTile_active');
// }
return (
<div className={contentClasses.join(' ')} onClick={this._onTileClick}>
<div className="mx_AppIconTile_imageContainer">
<img src={this.props.icon} alt={this.props.name} className="mx_AppIconTile_image"/>
</div>
<div className="mx_AppIconTile_content">
<h4><b>{this.props.name}</b></h4>
<p>{this.props.description}</p>
</div>
</div>
);
}
}
AppIconTile.propTypes = {
type: React.PropTypes.string.isRequired,
icon: React.PropTypes.string.isRequired,
name: React.PropTypes.string.isRequired,
description: React.PropTypes.string.isRequired,
onClick: React.PropTypes.func.isRequired,
};
export default AppIconTile;

View File

@ -35,16 +35,6 @@ export default React.createClass({
};
},
componentDidMount: function() {
console.log("App component %s mounted", this.props.id);
// setInterval(() => {
// const msg = "Message from riot";
// const domain = 'http://localhost:8000';
// this.refs.appFrame.contentWindow.postMessage(msg, domain);
// console.log("Sending message");
// }, 3000);
},
_onEditClick: function() {
console.log("Edit widget %s", this.props.id);
},
@ -78,12 +68,12 @@ export default React.createClass({
{this.props.name}
<span className="mx_AppTileMenuBarWidgets">
{/* Edit widget */}
<img
{/* <img
src="img/edit.svg"
className="mx_filterFlipColor mx_AppTileMenuBarWidget mx_AppTileMenuBarWidgetPadding"
width="8" height="8" alt="Edit"
onClick={this._onEditClick}
/>
/> */}
{/* Delete widget */}
<img src="img/cancel.svg"

View File

@ -1,97 +0,0 @@
/*
Copyright 2015, 2016 OpenMarket Ltd
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.
*/
'use strict';
var React = require('react');
var MatrixClientPeg = require('../../../MatrixClientPeg');
var sdk = require('../../../index');
var dis = require('../../../dispatcher');
var Modal = require("../../../Modal");
module.exports = React.createClass({
displayName: 'MemberTile',
propTypes: {
member: React.PropTypes.any.isRequired, // RoomMember
},
getInitialState: function() {
return {};
},
shouldComponentUpdate: function(nextProps, nextState) {
if (
this.member_last_modified_time === undefined ||
this.member_last_modified_time < nextProps.member.getLastModifiedTime()
) {
return true;
}
if (
nextProps.member.user &&
(this.user_last_modified_time === undefined ||
this.user_last_modified_time < nextProps.member.user.getLastModifiedTime())
) {
return true;
}
return false;
},
onClick: function(e) {
dis.dispatch({
action: 'view_user',
member: this.props.member,
});
},
_getDisplayName: function() {
return this.props.member.name;
},
getPowerLabel: function() {
return this.props.member.userId + " (power " + this.props.member.powerLevel + ")";
},
render: function() {
var MemberAvatar = sdk.getComponent('avatars.MemberAvatar');
var BaseAvatar = sdk.getComponent('avatars.BaseAvatar');
var EntityTile = sdk.getComponent('rooms.EntityTile');
var member = this.props.member;
var name = this._getDisplayName();
var active = -1;
var presenceState = member.user ? member.user.presence : null;
var av = (
<MemberAvatar member={member} width={36} height={36} />
);
if (member.user) {
this.user_last_modified_time = member.user.getLastModifiedTime();
}
this.member_last_modified_time = member.getLastModifiedTime();
return (
<EntityTile {...this.props} presenceState={presenceState}
presenceLastActiveAgo={ member.user ? member.user.lastActiveAgo : 0 }
presenceLastTs={ member.user ? member.user.lastPresenceTs : 0 }
presenceCurrentlyActive={ member.user ? member.user.currentlyActive : false }
avatarJsx={av} title={this.getPowerLabel()} onClick={this.onClick}
name={name} powerLevel={this.props.member.powerLevel} />
);
}
});

View File

@ -57,7 +57,7 @@ module.exports = React.createClass({
},
componentWillUnmount: function() {
ScalarMessaging.startListening();
ScalarMessaging.stopListening();
if (MatrixClientPeg.get()) {
MatrixClientPeg.get().removeListener("RoomState.events", this.onRoomStateEvents);
}