From dc4f321707da8d7431c857ab6abf8240e671fb31 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Mon, 5 Jun 2017 18:21:31 +0100 Subject: [PATCH] Pass room and user id to apps draw --- src/components/structures/RoomView.js | 4 ++++ src/components/views/elements/AppTile.js | 3 +-- src/components/views/rooms/AppsDrawer.js | 30 ++++++++++++++++++++++-- src/components/views/rooms/AuxPanel.js | 5 +++- 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 49aa3a0af5..af5429fe4e 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -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 = (
- {/* */} - +
); diff --git a/src/components/views/rooms/AppsDrawer.js b/src/components/views/rooms/AppsDrawer.js index f729c2032d..ed21fb6d77 100644 --- a/src/components/views/rooms/AppsDrawer.js +++ b/src/components/views/rooms/AppsDrawer.js @@ -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 ( diff --git a/src/components/views/rooms/AuxPanel.js b/src/components/views/rooms/AuxPanel.js index 31739a890f..ec2de2558c 100644 --- a/src/components/views/rooms/AuxPanel.js +++ b/src/components/views/rooms/AuxPanel.js @@ -116,7 +116,10 @@ module.exports = React.createClass({ let appsDrawer = null; if(this.props.showApps) { - appsDrawer = ; + appsDrawer = ; } return (