Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wmwragg/mention state menu #1900

Merged
merged 45 commits into from
Aug 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ad74d26
Selected room highlight teaked to better fit previous design
wmwragg Jul 21, 2016
73bb317
Slight tweak to the name padding so there is a little less space abov…
wmwragg Jul 21, 2016
df163d8
Clean up of the CSS, and refactor to better match current code
wmwragg Jul 21, 2016
633a3f4
New component for testing
wmwragg Jul 21, 2016
e988f5c
Badge visual tweaks
wmwragg Jul 21, 2016
24e021b
Badge dohickey shown on name hover and badge hover
wmwragg Jul 21, 2016
7eff6d9
Tweak to z-index as the tooltip was occasionally getting occluded.
wmwragg Jul 22, 2016
ce53111
Tweaked tooltip z-index
wmwragg Jul 22, 2016
72b4a86
Tweaked the tooltip to be better aligned. Also added the fading of th…
wmwragg Jul 22, 2016
204e424
The default props doesn't seem to be working, hardcoded 'LABEL' for n…
wmwragg Jul 22, 2016
2768cd2
Initial unstyled mentions state notifier context menu
wmwragg Jul 22, 2016
6c19504
Merge branch 'wmwragg/mention-state-indicator-round-3' into wmwragg/m…
wmwragg Jul 25, 2016
791980c
Menu context dohickey now sticks when menu shown
wmwragg Jul 25, 2016
30b1e70
Contextual menu restyling
wmwragg Jul 25, 2016
187818a
Radio buttons now added, and only none guests can modify notfication …
wmwragg Jul 26, 2016
15f9f5d
Doing the state change via onClick events rather than radio buttons, …
wmwragg Jul 26, 2016
37a7ce8
Added two new icons for notifications states
wmwragg Jul 27, 2016
5cf164f
Re-modularised the context menus
wmwragg Jul 27, 2016
dab707a
Additional refactor to further modularise the context menus
wmwragg Jul 27, 2016
074bbc7
Added the two additiona states that don't yet exist on the backend, a…
wmwragg Jul 27, 2016
53f4da1
Refactor so that chevron and menu can be positioned independantly
wmwragg Jul 27, 2016
d376df4
Initial context menu with all it's elements
wmwragg Jul 27, 2016
22bf74d
Tweaks to get icons to line up better, still need to space labels cor…
wmwragg Jul 27, 2016
b5fdaac
Final spacing tweaks to get it aligned with the design
wmwragg Jul 27, 2016
6329e27
Extra polish to get styling looking like the design
wmwragg Jul 28, 2016
b870585
When a use clicks the state they want, after the change has been made…
wmwragg Jul 28, 2016
49545ce
Leaving the fail promise section blank as a todo, with explanitary co…
wmwragg Jul 28, 2016
55a10ee
Mute state handled corrcectly
wmwragg Jul 28, 2016
6c4c0bf
Initial feature set complete, but the state and CSS need to be simpli…
wmwragg Jul 28, 2016
2f08f24
CSS tweaks for muted dohickey positioning
wmwragg Jul 28, 2016
2f65064
CSS bugfix to stop incorrect letter spaceing on room names
wmwragg Jul 28, 2016
18701a2
CSS tweaks to get the collapsed mute state properly working
wmwragg Jul 29, 2016
87bddcd
Preliminary fix for showing muted state when collapsed - keep faded a…
wmwragg Jul 29, 2016
0ad84fd
Better comments
wmwragg Jul 29, 2016
bb93a59
fixed unread hightlight font weight for room name
wmwragg Jul 29, 2016
f382946
Merge up from develop
wmwragg Jul 30, 2016
4a7d290
Positional tweaks for the name, badge and context menu, to better mat…
wmwragg Jul 30, 2016
ef5ea46
Consistent collapsed height across browsers
wmwragg Aug 1, 2016
472acd4
New design for long names
wmwragg Aug 2, 2016
f640be9
Container height shrunk, so it doesn't bump the avatars when collapse…
wmwragg Aug 2, 2016
ee85725
Fixed small collapsed state hover issue with badges
wmwragg Aug 2, 2016
8e0f7f1
Design update to match the new Zeplin designs
wmwragg Aug 3, 2016
f53f9af
Badge width fixed, and hover state for badge now only on badge itself.
wmwragg Aug 3, 2016
be1f014
Speech bubble tail shifted slightly, as the badge is now larger
wmwragg Aug 3, 2016
16f8143
synced prefix flex with flex
wmwragg Aug 3, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/component-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ module.exports.components['structures.RoomDirectory'] = require('./components/st
module.exports.components['structures.RoomSubList'] = require('./components/structures/RoomSubList');
module.exports.components['structures.SearchBox'] = require('./components/structures/SearchBox');
module.exports.components['structures.ViewSource'] = require('./components/structures/ViewSource');
module.exports.components['views.context_menus.MessageContextMenu'] = require('./components/views/context_menus/MessageContextMenu');
module.exports.components['views.context_menus.NotificationStateContextMenu'] = require('./components/views/context_menus/NotificationStateContextMenu');
module.exports.components['views.elements.ImageView'] = require('./components/views/elements/ImageView');
module.exports.components['views.elements.Spinner'] = require('./components/views/elements/Spinner');
module.exports.components['views.globals.GuestWarningBar'] = require('./components/views/globals/GuestWarningBar');
Expand All @@ -46,7 +48,6 @@ module.exports.components['views.messages.DateSeparator'] = require('./component
module.exports.components['views.messages.MessageTimestamp'] = require('./components/views/messages/MessageTimestamp');
module.exports.components['views.messages.SenderProfile'] = require('./components/views/messages/SenderProfile');
module.exports.components['views.rooms.BottomLeftMenuTile'] = require('./components/views/rooms/BottomLeftMenuTile');
module.exports.components['views.rooms.MessageContextMenu'] = require('./components/views/rooms/MessageContextMenu');
module.exports.components['views.rooms.RoomDNDView'] = require('./components/views/rooms/RoomDNDView');
module.exports.components['views.rooms.RoomDropTarget'] = require('./components/views/rooms/RoomDropTarget');
module.exports.components['views.rooms.RoomTooltip'] = require('./components/views/rooms/RoomTooltip');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,38 +95,38 @@ module.exports = React.createClass({

if (eventStatus === 'not_sent') {
resendButton = (
<div className="mx_ContextualMenu_field" onClick={this.onResendClick}>
<div className="mx_MessageContextMenu_field" onClick={this.onResendClick}>
Resend
</div>
);
}

if (!eventStatus) { // sent
redactButton = (
<div className="mx_ContextualMenu_field" onClick={this.onRedactClick}>
<div className="mx_MessageContextMenu_field" onClick={this.onRedactClick}>
Redact
</div>
);
}

if (eventStatus === "queued" || eventStatus === "not_sent") {
cancelButton = (
<div className="mx_ContextualMenu_field" onClick={this.onCancelSendClick}>
<div className="mx_MessageContextMenu_field" onClick={this.onCancelSendClick}>
Cancel Sending
</div>
);
}

viewSourceButton = (
<div className="mx_ContextualMenu_field" onClick={this.onViewSourceClick}>
<div className="mx_MessageContextMenu_field" onClick={this.onViewSourceClick}>
View Source
</div>
);

if (this.props.eventTileOps) {
if (this.props.eventTileOps.isWidgetHidden()) {
unhidePreviewButton = (
<div className="mx_ContextualMenu_field" onClick={this.onUnhidePreviewClick}>
<div className="mx_MessageContextMenu_field" onClick={this.onUnhidePreviewClick}>
Unhide Preview
</div>
)
Expand All @@ -136,7 +136,7 @@ module.exports = React.createClass({
// XXX: this should be https://matrix.to.
// XXX: if we use room ID, we should also include a server where the event can be found (other than in the domain of the event ID)
permalinkButton = (
<div className="mx_ContextualMenu_field">
<div className="mx_MessageContextMenu_field">
<a href={ "#/room/" + this.props.mxEvent.getRoomId() +"/"+ this.props.mxEvent.getId() }
onClick={ this.onPermalinkClick }>Permalink</a>
</div>
Expand Down
150 changes: 150 additions & 0 deletions src/components/views/context_menus/NotificationStateContextMenu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
/*
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( isMuted ) {
var self = this;
const roomId = this.props.room.roomId;
var cli = MatrixClientPeg.get();

if (!cli.isGuest()) {
cli.setRoomMutePushRule(
"global", roomId, isMuted
).then(function() {
self.setState({areNotifsMuted: isMuted});

// delay slightly so that the user can see their state change
// before closing the menu
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,
isMuted: isMuted,
});

// 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() {
// Placeholder
},

_onClickMute: function() {
this._save(true);
},

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_fieldDisabled': true,
});

var muteNotifsClasses = classNames({
'mx_NotificationStateContextMenu_field': true,
'mx_NotificationStateContextMenu_fieldSet': this.state.areNotifsMuted,
});

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_icon" src="img/icon-context-mute-off-copy.svg" width="16" height="12" />
Alert me
</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 notifications
</div>
<div className={ mentionsClasses } onClick={this._onClickMentions} >
<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>
);
}
});
44 changes: 0 additions & 44 deletions src/skins/vector/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -85,50 +85,6 @@ input[type=text]:focus, textarea:focus {
border-left: 6px solid transparent;
}

.mx_ContextualMenu_background {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 1.0;
z-index: 2000;
}

.mx_ContextualMenu {
border: 1px solid #a4a4a4;
border-radius: 8px;
background-color: #fff;
color: #747474;
position: fixed;
z-index: 2001;
padding: 6px;
}

.mx_ContextualMenu_chevron_right {
padding: 12px;
position: absolute;
right: -21px;
top: 0px;
}

.mx_ContextualMenu_chevron_left {
padding: 12px;
position: absolute;
left: -21px;
top: 0px;
}

.mx_ContextualMenu_field {
padding: 3px 6px 3px 6px;
cursor: pointer;
}

.mx_ContextualMenu_spinner {
display: block;
margin: 0 auto;
}

.mx_Dialog_wrapper {
position: fixed;
z-index: 4000;
Expand Down
106 changes: 106 additions & 0 deletions src/skins/vector/css/matrix-react-sdk/structures/ContextualMenu.css
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ limitations under the License.

background-color: #eaf5f0;

-webkit-flex: 0 0 210px;
flex: 0 0 210px;
-webkit-flex: 0 0 235px;
flex: 0 0 235px;
Copy link
Member

@ara4n ara4n Aug 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, the -webkit-flex is now out of sync with the flex

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that the -webkit-flex is used anymore, but I've corrected anyway

}

.mx_MatrixChat .mx_LeftPanel.collapsed {
Expand Down
Loading