diff --git a/src/components/views/dialogs/DevtoolsDialog.js b/src/components/views/dialogs/DevtoolsDialog.js index c4248fa9..9a518fd0 100644 --- a/src/components/views/dialogs/DevtoolsDialog.js +++ b/src/components/views/dialogs/DevtoolsDialog.js @@ -152,6 +152,89 @@ class SendCustomStateEvent extends React.Component { } } +class RoomStateExplorer extends React.Component { + static propTypes = { + roomId: React.PropTypes.string.isRequired, + onFinished: React.PropTypes.func.isRequired, + onBack: React.PropTypes.func.isRequired, + }; + + constructor(props, context) { + super(props, context); + + this.onBack = this.onBack.bind(this); + } + + state = { + eventType: null, + }; + + browseEventType(eventType) { + const self = this; + return () => { + self.setState({ eventType }); + }; + } + + onViewSourceClick(ev) { + const ViewSource = sdk.getComponent('structures.ViewSource'); + return () => { + Modal.createDialog(ViewSource, { + content: ev, + }, 'mx_Dialog_viewsource'); + }; + } + + onBack() { + if (this.state.eventType === null) { + this.props.onBack(); + } else { + this.setState({ eventType: null }); + } + } + + render() { + const room = MatrixClientPeg.get().getRoom(this.props.roomId); + const roomStateEvents = room.currentState.events; + + const rows = []; + + if (this.state.eventType === null) { + Object.keys(roomStateEvents).forEach((evType) => { + const stateGroup = roomStateEvents[evType]; + const keys = Object.keys(stateGroup); + + if (keys.length > 1) { + rows.push(); + } else if (keys.length === 1) { + rows.push(); + } + }); + } else { + const evType = this.state.eventType; + const stateGroup = roomStateEvents[evType]; + Object.keys(stateGroup).forEach((stateKey) => { + const ev = stateGroup[stateKey]; + rows.push(); + }); + } + + return