Pass room and user id to apps draw

This commit is contained in:
Richard Lewis 2017-06-05 18:21:31 +01:00
parent c6991fd33c
commit dc4f321707
4 changed files with 37 additions and 5 deletions

View file

@ -122,6 +122,7 @@ module.exports = React.createClass({
return {
room: null,
roomId: null,
userId: null,
roomLoading: true,
editingRoomSettings: false,
uploadingRoomSettings: false,
@ -185,6 +186,7 @@ module.exports = React.createClass({
this.setState({
room: room,
roomId: result.room_id,
userId: MatrixClientPeg.get().credentials.userId,
roomLoading: !room,
unsentMessageError: this._getUnsentMessageError(room),
}, this._onHaveRoom);
@ -198,6 +200,7 @@ module.exports = React.createClass({
var room = MatrixClientPeg.get().getRoom(this.props.roomAddress);
this.setState({
roomId: this.props.roomAddress,
userId: MatrixClientPeg.get().credentials.userId,
room: room,
roomLoading: !room,
unsentMessageError: this._getUnsentMessageError(room),
@ -1640,6 +1643,7 @@ module.exports = React.createClass({
var auxPanel = (
<AuxPanel ref="auxPanel" room={this.state.room}
userId={this.state.userId}
conferenceHandler={this.props.ConferenceHandler}
draggingFile={this.state.draggingFile}
displayConfCallNotification={this.state.displayConfCallNotification}

View file

@ -74,8 +74,7 @@ export default React.createClass({
</span>
</div>
<div className="mx_AppTileBody">
{/* <iframe sandbox="sandbox" seamless="seamless" src={this.props.url}></iframe> */}
<iframe ref="appFrame" seamless="seamless" src={this.props.url}></iframe>
<iframe ref="appFrame" src={this.props.url}></iframe>
</div>
</div>
);

View file

@ -44,7 +44,7 @@ const roomWidgetConfig = {
name: "Monitoring our Single-Point-Of-Failure DB",
},
],
// Chat room - https://www.youtube.com/watch?v=ZfkwW4GgAiU
// Camgirl room - https://www.youtube.com/watch?v=ZfkwW4GgAiU
'!wQqrqwOipOOWALxJNe:matrix.org': [
{
id: "youtube",
@ -70,6 +70,14 @@ const roomWidgetConfig = {
name: "Tip Me!!! -- Send me cash $$$",
},
],
// Game room - !BLQjREzUgbtIsgrvRn:matrix.org
'!BLQjREzUgbtIsgrvRn:matrix.org': [
{
id: "etherpad",
url: "http://localhost:8000/etherpad.html",
name: "Etherpad",
},
],
};
module.exports = React.createClass({
@ -81,11 +89,27 @@ module.exports = React.createClass({
componentDidMount: function() {
},
initAppConfig: function(appConfig) {
console.log("App props: ", this.props);
appConfig = appConfig.map(
(app, index, arr) => {
switch(app.id) {
case 'etherpad':
app.url = app.url + '?userName=' + this.props.userId +
'&padId=' + this.props.room.roomId;
break;
}
return app;
});
return appConfig;
},
getInitialState: function() {
for (const key in roomWidgetConfig) {
if(key == this.props.room.roomId) {
return {
apps: roomWidgetConfig[key],
apps: this.initAppConfig(roomWidgetConfig[key]),
};
}
}
@ -112,6 +136,8 @@ module.exports = React.createClass({
url={app.url}
name={app.name}
fullWdith={arr.length<2 ? true : false}
roomId={this.props.roomId}
userId={this.props.userId}
/>);
return (

View file

@ -116,7 +116,10 @@ module.exports = React.createClass({
let appsDrawer = null;
if(this.props.showApps) {
appsDrawer = <AppsDrawer ref="appsDrawer" room={this.props.room} />;
appsDrawer = <AppsDrawer ref="appsDrawer"
room={this.props.room}
userId={this.props.userId}
maxHeight={this.props.maxHeight}/>;
}
return (