-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
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 73bb317
Slight tweak to the name padding so there is a little less space abov…
wmwragg df163d8
Clean up of the CSS, and refactor to better match current code
wmwragg 633a3f4
New component for testing
wmwragg e988f5c
Badge visual tweaks
wmwragg 24e021b
Badge dohickey shown on name hover and badge hover
wmwragg 7eff6d9
Tweak to z-index as the tooltip was occasionally getting occluded.
wmwragg ce53111
Tweaked tooltip z-index
wmwragg 72b4a86
Tweaked the tooltip to be better aligned. Also added the fading of th…
wmwragg 204e424
The default props doesn't seem to be working, hardcoded 'LABEL' for n…
wmwragg 2768cd2
Initial unstyled mentions state notifier context menu
wmwragg 6c19504
Merge branch 'wmwragg/mention-state-indicator-round-3' into wmwragg/m…
wmwragg 791980c
Menu context dohickey now sticks when menu shown
wmwragg 30b1e70
Contextual menu restyling
wmwragg 187818a
Radio buttons now added, and only none guests can modify notfication …
wmwragg 15f9f5d
Doing the state change via onClick events rather than radio buttons, …
wmwragg 37a7ce8
Added two new icons for notifications states
wmwragg 5cf164f
Re-modularised the context menus
wmwragg dab707a
Additional refactor to further modularise the context menus
wmwragg 074bbc7
Added the two additiona states that don't yet exist on the backend, a…
wmwragg 53f4da1
Refactor so that chevron and menu can be positioned independantly
wmwragg d376df4
Initial context menu with all it's elements
wmwragg 22bf74d
Tweaks to get icons to line up better, still need to space labels cor…
wmwragg b5fdaac
Final spacing tweaks to get it aligned with the design
wmwragg 6329e27
Extra polish to get styling looking like the design
wmwragg b870585
When a use clicks the state they want, after the change has been made…
wmwragg 49545ce
Leaving the fail promise section blank as a todo, with explanitary co…
wmwragg 55a10ee
Mute state handled corrcectly
wmwragg 6c4c0bf
Initial feature set complete, but the state and CSS need to be simpli…
wmwragg 2f08f24
CSS tweaks for muted dohickey positioning
wmwragg 2f65064
CSS bugfix to stop incorrect letter spaceing on room names
wmwragg 18701a2
CSS tweaks to get the collapsed mute state properly working
wmwragg 87bddcd
Preliminary fix for showing muted state when collapsed - keep faded a…
wmwragg 0ad84fd
Better comments
wmwragg bb93a59
fixed unread hightlight font weight for room name
wmwragg f382946
Merge up from develop
wmwragg 4a7d290
Positional tweaks for the name, badge and context menu, to better mat…
wmwragg ef5ea46
Consistent collapsed height across browsers
wmwragg 472acd4
New design for long names
wmwragg f640be9
Container height shrunk, so it doesn't bump the avatars when collapse…
wmwragg ee85725
Fixed small collapsed state hover issue with badges
wmwragg 8e0f7f1
Design update to match the new Zeplin designs
wmwragg f53f9af
Badge width fixed, and hover state for badge now only on badge itself.
wmwragg be1f014
Speech bubble tail shifted slightly, as the badge is now larger
wmwragg 16f8143
synced prefix flex with flex
wmwragg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
150 changes: 150 additions & 0 deletions
150
src/components/views/context_menus/NotificationStateContextMenu.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
src/skins/vector/css/matrix-react-sdk/structures/ContextualMenu.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 theflex
There was a problem hiding this comment.
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