57 changed files with 955 additions and 264 deletions
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// copy static files from node_modules to the vector directory
|
||||
//
|
||||
|
||||
var fs = require('fs-extra'); |
||||
|
||||
function exists(f) { |
||||
try { |
||||
fs.statSync(f); |
||||
return true; |
||||
} catch(e) { |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
const olm = 'node_modules/olm/olm.js'; |
||||
if (exists(olm)) { |
||||
console.log("copy", olm, "-> vector"); |
||||
fs.copySync(olm, 'vector/olm.js'); |
||||
} |
@ -0,0 +1,153 @@
|
||||
/* |
||||
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 q = require("q"); |
||||
var React = require('react'); |
||||
var classNames = require('classnames'); |
||||
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg'); |
||||
var dis = require('matrix-react-sdk/lib/dispatcher'); |
||||
|
||||
module.exports = React.createClass({ |
||||
displayName: 'NotificationStateContextMenu', |
||||
|
||||
propTypes: { |
||||
room: React.PropTypes.object.isRequired, |
||||
/* callback called when the menu is dismissed */ |
||||
onFinished: React.PropTypes.func, |
||||
}, |
||||
|
||||
getInitialState: function() { |
||||
var areNotifsMuted = false; |
||||
var cli = MatrixClientPeg.get(); |
||||
if (!cli.isGuest()) { |
||||
var roomPushRule = cli.getRoomPushRule("global", this.props.room.roomId); |
||||
if (roomPushRule) { |
||||
if (0 <= roomPushRule.actions.indexOf("dont_notify")) { |
||||
areNotifsMuted = true; |
||||
} |
||||
} |
||||
} |
||||
|
||||
return { |
||||
areNotifsMuted: areNotifsMuted, |
||||
}; |
||||
}, |
||||
|
||||
_save: function( areNotifsMuted ) { |
||||
var self = this; |
||||
const roomId = this.props.room.roomId; |
||||
var cli = MatrixClientPeg.get(); |
||||
|
||||
if (!cli.isGuest()) { |
||||
// Wrapping this in a q promise, as setRoomMutePushRule can return
|
||||
// a promise or a value
|
||||
q(cli.setRoomMutePushRule("global", roomId, areNotifsMuted)) |
||||
.then(function(s) { |
||||
self.setState({areNotifsMuted: areNotifsMuted}); |
||||
|
||||
// delay slightly so that the user can see their state change
|
||||
// before closing the menu
|
||||
return q.delay(500).then(function() { |
||||
// tell everyone that wants to know of the change in
|
||||
// notification state
|
||||
dis.dispatch({ |
||||
action: 'notification_change', |
||||
roomId: self.props.room.roomId, |
||||
areNotifsMuted: areNotifsMuted, |
||||
}); |
||||
|
||||
// Close the context menu
|
||||
if (self.props.onFinished) { |
||||
self.props.onFinished(); |
||||
}; |
||||
}); |
||||
}).fail(function(error) { |
||||
// TODO: some form of error notification to the user
|
||||
// to inform them that their state change failed.
|
||||
}); |
||||
} |
||||
}, |
||||
|
||||
_onClickAlertMe: function() { |
||||
// Placeholder
|
||||
}, |
||||
|
||||
_onClickAllNotifs: function() { |
||||
this._save(false); |
||||
}, |
||||
|
||||
_onClickMentions: function() { |
||||
this._save(true); |
||||
}, |
||||
|
||||
_onClickMute: function() { |
||||
// Placeholder
|
||||
}, |
||||
|
||||
render: function() { |
||||
var cli = MatrixClientPeg.get(); |
||||
|
||||
var alertMeClasses = classNames({ |
||||
'mx_NotificationStateContextMenu_field': true, |
||||
'mx_NotificationStateContextMenu_fieldDisabled': true, |
||||
}); |
||||
|
||||
var allNotifsClasses = classNames({ |
||||
'mx_NotificationStateContextMenu_field': true, |
||||
'mx_NotificationStateContextMenu_fieldSet': !this.state.areNotifsMuted, |
||||
}); |
||||
|
||||
var mentionsClasses = classNames({ |
||||
'mx_NotificationStateContextMenu_field': true, |
||||
'mx_NotificationStateContextMenu_fieldSet': this.state.areNotifsMuted, |
||||
}); |
||||
|
||||
var muteNotifsClasses = classNames({ |
||||
'mx_NotificationStateContextMenu_field': true, |
||||
'mx_NotificationStateContextMenu_fieldDisabled': true, |
||||
}); |
||||
|
||||
return ( |
||||
<div> |
||||
<div className="mx_NotificationStateContextMenu_picker" > |
||||
<img src="img/notif-slider.svg" width="20" height="107" /> |
||||
</div> |
||||
<div className={ alertMeClasses } onClick={this._onClickAlertMe} > |
||||
<img className="mx_NotificationStateContextMenu_activeIcon" src="img/notif-active.svg" width="12" height="12" /> |
||||
<img className="mx_NotificationStateContextMenu_icon" src="img/icon-context-mute-off-copy.svg" width="16" height="12" /> |
||||
All messages (loud) |
||||
</div> |
||||
<div className={ allNotifsClasses } onClick={this._onClickAllNotifs} > |
||||
<img className="mx_NotificationStateContextMenu_activeIcon" src="img/notif-active.svg" width="12" height="12" /> |
||||
<img className="mx_NotificationStateContextMenu_icon" src="img/icon-context-mute-off.svg" width="16" height="12" /> |
||||
All messages |
||||
</div> |
||||
<div className={ mentionsClasses } onClick={this._onClickMentions} > |
||||
<img className="mx_NotificationStateContextMenu_activeIcon" src="img/notif-active.svg" width="12" height="12" /> |
||||
<img className="mx_NotificationStateContextMenu_icon" src="img/icon-context-mute-mentions.svg" width="16" height="12" /> |
||||
Mentions only |
||||
</div> |
||||
<div className={ muteNotifsClasses } onClick={this._onClickMute} > |
||||
<img className="mx_NotificationStateContextMenu_activeIcon" src="img/notif-active.svg" width="12" height="12" /> |
||||
<img className="mx_NotificationStateContextMenu_icon" src="img/icon-context-mute.svg" width="16" height="12" /> |
||||
Mute |
||||
</div> |
||||
</div> |
||||
); |
||||
} |
||||
}); |
@ -0,0 +1,56 @@
|
||||
/* |
||||
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 sdk = require('matrix-react-sdk'); |
||||
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg'); |
||||
|
||||
module.exports = React.createClass({ |
||||
displayName: 'IntegrationsManager', |
||||
|
||||
propTypes: { |
||||
src: React.PropTypes.string.isRequired, // the source of the integration manager being embedded
|
||||
onFinished: React.PropTypes.func.isRequired, // callback when the lightbox is dismissed
|
||||
}, |
||||
|
||||
// XXX: keyboard shortcuts for managing dialogs should be done by the modal
|
||||
// dialog base class somehow, surely...
|
||||
componentDidMount: function() { |
||||
document.addEventListener("keydown", this.onKeyDown); |
||||
}, |
||||
|
||||
componentWillUnmount: function() { |
||||
document.removeEventListener("keydown", this.onKeyDown); |
||||
}, |
||||
|
||||
onKeyDown: function(ev) { |
||||
if (ev.keyCode == 27) { // escape
|
||||
ev.stopPropagation(); |
||||
ev.preventDefault(); |
||||
this.props.onFinished(); |
||||
} |
||||
}, |
||||
|
||||
render: function() { |
||||
return ( |
||||
<div className="mx_IntegrationsManager"> |
||||
<iframe src={ this.props.src }></iframe> |
||||
</div> |
||||
); |
||||
} |
||||
}); |
@ -0,0 +1,106 @@
|
||||
/* |
||||
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. |
||||
*/ |
||||
|
||||
.mx_ContextualMenu_wrapper { |
||||
position: fixed; |
||||
z-index: 2000; |
||||
} |
||||
|
||||
.mx_ContextualMenu_background { |
||||
position: fixed; |
||||
top: 0; |
||||
left: 0; |
||||
width: 100%; |
||||
height: 100%; |
||||
opacity: 1.0; |
||||
z-index: 2000; |
||||
} |
||||
|
||||
.mx_ContextualMenu { |
||||
border: solid 1px rgba(187, 187, 187, 0.5); |
||||
border-radius: 4px; |
||||
background-color: #f6f6f6; |
||||
color: #4a4a4a; |
||||
position: absolute; |
||||
padding: 6px; |
||||
font-size: 14px; |
||||
z-index: 2001; |
||||
} |
||||
|
||||
.mx_ContextualMenu.mx_ContextualMenu_right { |
||||
right: 8px; |
||||
} |
||||
|
||||
.mx_ContextualMenu_chevron_right { |
||||
position: absolute; |
||||
right: -8px; |
||||
top: 0px; |
||||
width: 0; |
||||
height: 0; |
||||
border-top: 8px solid transparent; |
||||
border-left: 8px solid rgba(187, 187, 187, 0.5); |
||||
border-bottom: 8px solid transparent; |
||||
} |
||||
|
||||
.mx_ContextualMenu_chevron_right:after{ |
||||
content:''; |
||||
width: 0; |
||||
height: 0; |
||||
border-top: 7px solid transparent; |
||||
border-left: 7px solid #f6f6f6; |
||||
border-bottom: 7px solid transparent; |
||||
position:absolute; |
||||
top: -7px; |
||||
right: 1px; |
||||
} |
||||
|
||||
.mx_ContextualMenu.mx_ContextualMenu_left { |
||||
left: 8px; |
||||
} |
||||
|
||||
.mx_ContextualMenu_chevron_left { |
||||
position: absolute; |
||||
left: -8px; |
||||
top: 0px; |
||||
width: 0; |
||||
height: 0; |
||||
border-top: 8px solid transparent; |
||||
border-right: 8px solid rgba(187, 187, 187, 0.5); |
||||
border-bottom: 8px solid transparent; |
||||
} |
||||
|
||||
.mx_ContextualMenu_chevron_left:after{ |
||||
content:''; |
||||
width: 0; |
||||
height: 0; |
||||
border-top: 7px solid transparent; |
||||
border-right: 7px solid #f6f6f6; |
||||
border-bottom: 7px solid transparent; |
||||
position:absolute; |
||||
top: -7px; |
||||
left: 1px; |
||||
} |
||||
|
||||
.mx_ContextualMenu_field { |
||||
padding: 3px 6px 3px 6px; |
||||
cursor: pointer; |
||||
white-space: nowrap; |
||||
} |
||||
|
||||
.mx_ContextualMenu_spinner { |
||||
display: block; |
||||
margin: 0 auto; |
||||
} |
@ -0,0 +1,16 @@
|
||||
/* |
||||
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. |
||||
*/ |
||||
|
||||
.mx_UnknownBody { |
||||
white-space: pre-wrap; |
||||
} |
@ -0,0 +1,47 @@
|
||||
/* |
||||
Copyright 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. |
||||
*/ |
||||
|
||||
.mx_DevicesPanel { |
||||
display: table; |
||||
table-layout: fixed; |
||||
width: 880px; |
||||
border-spacing: 2px; |
||||
} |
||||
|
||||
.mx_DevicesPanel_header { |
||||
display: table-header-group; |
||||
font-weight: bold; |
||||
} |
||||
|
||||
.mx_DevicesPanel_header > div { |
||||
display: table-cell; |
||||
} |
||||
|
||||
.mx_DevicesPanel_header .mx_DevicesPanel_deviceLastSeen { |
||||
width: 30%; |
||||
} |
||||
|
||||
.mx_DevicesPanel_header .mx_DevicesPanel_deviceButtons { |
||||
width: 20%; |
||||
} |
||||
|
||||
.mx_DevicesPanel_device { |
||||
display: table-row; |
||||
} |
||||
|
||||
.mx_DevicesPanel_device > div { |
||||
display: table-cell; |
||||
} |
@ -0,0 +1,33 @@
|
||||
/* |
||||
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. |
||||
*/ |
||||
|
||||
.mx_IntegrationsManager { |
||||
display: -webkit-flex; |
||||
display: flex; |
||||
width: 100%; |
||||
height: 100%; |
||||
-webkit-align-items: center; |
||||
align-items: center; |
||||
justify-content: center; |
||||
-webkit-justify-content: center; |
||||
} |
||||
|
||||
.mx_IntegrationsManager iframe { |
||||
background-color: #fff; |
||||
border: 0px; |
||||
width: 720px; |
||||
height: 512px; |
||||
} |