Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Refactor Modals, ChannelHeader and Navbar component #1666

Merged
merged 100 commits into from
Nov 22, 2018
Merged
Changes from 1 commit
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
7a3d7ed
Refactor duplicated RenameChannelModal component
cometkim Sep 5, 2018
a53c657
Refactor duplicated EditChannelPurposeModal comp
cometkim Sep 5, 2018
fb641b7
Refactor duplicated ChannelMembersModal component
cometkim Sep 5, 2018
7c2cf32
Refactor ChannelNotificationsModal comp
cometkim Sep 5, 2018
45d3eaf
Move QuickSwitchModal to ModalController
cometkim Sep 7, 2018
0d0e4be
Refactor ModalController component
cometkim Sep 7, 2018
0681abe
Change Navbar component to PureComponent
cometkim Sep 7, 2018
21b4eeb
Migrate NavBar code to be use mattermost-redux
cometkim Sep 7, 2018
faba039
Refactor actions in NavBar
cometkim Sep 7, 2018
4da5158
Extract SetChannelHeaderOption component from NavBar
cometkim Sep 7, 2018
6daa40f
Extract ViewChannelInfoOption component from NavBar
cometkim Sep 7, 2018
2abbbf3
Extract NotificationPreferencesOption component from NavBar
cometkim Sep 9, 2018
32d06e6
Extract ChannelMembersOption component from NavBar
cometkim Sep 9, 2018
ab03668
Extract ViewPinnedPostsOption component from NavBar
cometkim Sep 9, 2018
fdb3627
Extract AddMembersOption component from NavBar
cometkim Sep 9, 2018
a71acdc
Extract SetChannelPurposeOption component from NavBar
cometkim Sep 9, 2018
5eae8c3
Extract RenameChannelOption component from NavBar
cometkim Sep 9, 2018
68db33c
Extract ConvertChannelOption component from NavBar
cometkim Sep 9, 2018
59f3602
Extract DeleteChannelOption component from NavBar
cometkim Sep 9, 2018
07f8b6a
Extract LeaveChannelOption component from NavBar
cometkim Sep 9, 2018
65891fa
Extract ToggleFavoriteChannel component from NavBar
cometkim Sep 9, 2018
a0793cb
Fix typo in ModalIdentifiers
cometkim Sep 9, 2018
28fd15f
Extract WebrtcOption component from NavBar
cometkim Sep 11, 2018
3d6aeb5
Building clean dropdown code, start from AddMembers
cometkim Sep 20, 2018
32f2c62
... ViewChannelInfo
cometkim Sep 20, 2018
29097b1
... ViewPinnedPosts
cometkim Sep 20, 2018
4541859
... NotificationPreferences
cometkim Sep 20, 2018
3f0195f
... ToggleFavoriteChannel
cometkim Sep 20, 2018
099fa0a
... SetChannelHeader
cometkim Sep 20, 2018
193568b
... SetChannelPurpose
cometkim Sep 20, 2018
ff6f507
... ViewMembers
cometkim Sep 21, 2018
37e650c
... ManageMembers
cometkim Sep 21, 2018
48592df
... ConvertChannel
cometkim Sep 21, 2018
6e0a628
... RenameChannel
cometkim Sep 21, 2018
5d47cc7
... DeleteChannel
cometkim Sep 22, 2018
7109c11
... LeaveChannel
cometkim Sep 22, 2018
858b868
... WebRTC
cometkim Sep 24, 2018
457ee43
Add draft of ChannelHeaderDropdown component
cometkim Sep 25, 2018
2ec1a44
Connect MobileChannelHeaderComponent to redux store
cometkim Sep 25, 2018
c306bab
Change the default rendering of dropdown
cometkim Sep 25, 2018
94d673d
Clean Navbar component with the new dropdown component
cometkim Sep 25, 2018
b0dc1e7
Remove more
cometkim Sep 25, 2018
8b43b15
Extract ShowSearchButton component from Navbar
cometkim Sep 25, 2018
69ab511
Remove undefined prop
cometkim Sep 25, 2018
91119f1
Remove unnecessary wrapper
cometkim Sep 25, 2018
54025e9
Comment on collapseButtons
cometkim Sep 25, 2018
21defc4
Refactor Navbar even more
cometkim Sep 25, 2018
cf0ff04
Fix character of close button
cometkim Sep 25, 2018
16c3702
Make channel prop to be required
cometkim Sep 25, 2018
f39ea39
Remove unused codes
cometkim Sep 25, 2018
fb38963
Fix ToggleFavorite menu
cometkim Sep 25, 2018
29e4211
[MM-11162] Add mute icon to mobile view (#1744)
saturninoabril Sep 26, 2018
ed484a3
Fix the composition of navbar
cometkim Oct 4, 2018
b0e2b06
Fix NotificationPreference modal
cometkim Oct 4, 2018
bb30e01
Extract ToggleMuteChannel comp from ChannelHeader
cometkim Oct 4, 2018
d082673
Cleanup ChannelHeader with new ChannelHeaderDropdown
cometkim Oct 4, 2018
d7139fd
Update snapshot of NotificationPreferences menu
cometkim Oct 4, 2018
4b87632
Refactor ChannelHeader component
cometkim Oct 4, 2018
7bd8110
Fix tests
cometkim Oct 4, 2018
a392c5a
MM-12150 - Updating x icon and plugins (#1841)
asaadmahmood Oct 5, 2018
a032ccb
Fix tests
cometkim Oct 7, 2018
f9f0f67
Rename Navbar to ChannelHeaderMobile
cometkim Oct 7, 2018
d76f995
MM-12503: Show Mute/Unmute menu item for GMs too. (#1847)
grundleborg Oct 9, 2018
c9fefde
Remove comment from view
cometkim Oct 11, 2018
f1c2823
Change ext of modified components to .js instead of .jsx
cometkim Oct 11, 2018
7fafd9e
MM-12494 Removing some flux store usage. (#1882)
crspeller Oct 16, 2018
8e6d305
Fix some filename extensions
cometkim Oct 17, 2018
2c96292
Fix a updated snaphost
cometkim Oct 17, 2018
96b03b3
Migrate ChannelActions joinChannel and leaveChannel to redux (#1898)
enahum Oct 17, 2018
496dc0b
Update ModalController snapshot
cometkim Oct 20, 2018
d887c61
Drop WebRTC from ChannelHeader
cometkim Oct 24, 2018
f2ada0f
Remove deprecated lifecycle method from ChannelHeader
cometkim Oct 24, 2018
8f8b197
Replace hardcoded isMobile to utils
cometkim Oct 24, 2018
8420ef1
Fix import annotations
cometkim Oct 26, 2018
5b7a299
Migrate current channel state selectors to use mattermost-redux
cometkim Oct 26, 2018
95deaf0
Remove unused declarations
cometkim Oct 26, 2018
48aa099
Cherry-picked MM-11577: Back to previous channel on archive (#1775)
jespino Sep 27, 2018
2a5d742
Cherry-picked: MM-12497 Remove flux store usages from user settings (…
jwilander Oct 22, 2018
b854604
Change ToggleMuteChannel component to PureComponent class style to av…
cometkim Oct 26, 2018
c4292d9
Remove unnecessary arrow function in render
cometkim Oct 26, 2018
114d417
Rollback mapStateToProps to plain function
cometkim Oct 26, 2018
70fdf9c
Change UnmuteChannelButton component to PureComponent class style to …
cometkim Oct 26, 2018
18e55b4
Change file ext for UnmuteChannelButton to .js
cometkim Oct 26, 2018
859e6b9
Move back QuickSwitchModal to ChannelHeader (Desktop only), and use r…
cometkim Oct 26, 2018
288f618
Change ShowSearchButton component to PureComponent class style to avo…
cometkim Oct 26, 2018
ce99b44
Rollback mapStateToProps for ViewPinnedPosts to plain function
cometkim Oct 26, 2018
f29dda7
Cherry-picked: Remove flux usages from email invite modal (#1954)
jwilander Nov 2, 2018
9d9c512
Fix Channel Header
cometkim Nov 5, 2018
cf00c3f
Fix ShowSearchButton in ChannelHeaderMobile
cometkim Nov 5, 2018
a86b9e1
Fix ChannelMembersModal on PopoverListMembers
cometkim Nov 5, 2018
463501b
Migrate test files to component path
cometkim Nov 15, 2018
5acdc93
fix eslint style error on test mock
cometkim Nov 15, 2018
32a47c4
Update per feedback
cometkim Nov 15, 2018
e32df59
Fix ChannelMembersModal test, IDK when it have been break exactly
cometkim Nov 15, 2018
3c31e33
Fix errors on dropdown
cometkim Nov 15, 2018
84a809e
Fix view_and_manage_members to show different name by permission
cometkim Nov 20, 2018
b3c430d
Fix to show RenameChannel on defaultChannel
cometkim Nov 20, 2018
71b0f26
Refactor ChannelMembersModal to use redux action
cometkim Nov 22, 2018
22d8563
Fix ChannelNotificationModal to handle hide anim correctly
cometkim Nov 22, 2018
59d3874
Fix ViewAndManageMembers to be view mode only in default channel
cometkim Nov 22, 2018
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
Prev Previous commit
Next Next commit
Change ToggleMuteChannel component to PureComponent class style to av…
…oid arrow function in render
  • Loading branch information
cometkim committed Nov 22, 2018
commit b854604fd433366529c502480c555cbfa79050fd
Original file line number Diff line number Diff line change
Expand Up @@ -7,70 +7,75 @@ import {FormattedMessage} from 'react-intl';

import {NotificationLevels} from 'utils/constants';

const ToggleMuteChannel = ({
user,
channel,
isMuted,
actions: {
updateChannelNotifyProps,
},
}) => {
let notifyProps;
let message;
if (isMuted) {
notifyProps = {mark_unread: NotificationLevels.ALL};
message = (
<FormattedMessage
id='channel_header.unmute'
defaultMessage='Unmute Channel'
/>
);
} else {
notifyProps = {mark_unread: NotificationLevels.MENTION};
message = (
<FormattedMessage
id='channel_header.mute'
defaultMessage='Mute Channel'
/>
);
}
export default class ToggleMuteChannel extends React.PureComponent {
static propTypes = {

return (
<li role='presentation'>
<button
className='style--none'
role='menuitem'
onClick={() => updateChannelNotifyProps(user.id, channel.id, notifyProps)}
>
{message}
</button>
</li>
);
};
/**
* Object with info about the current user
*/
user: PropTypes.object.isRequired,

ToggleMuteChannel.propTypes = {
/**
* Object with info about the current channel
*/
channel: PropTypes.object.isRequired,

/**
* Object with info about the current user
*/
user: PropTypes.object.isRequired,
/**
* Boolean whether the current channel is muted
*/
isMuted: PropTypes.bool.isRequired,

/**
* Object with info about the current channel
*/
channel: PropTypes.object.isRequired,
/**
* Object with action creators
*/
actions: PropTypes.shape({
updateChannelNotifyProps: PropTypes.func.isRequired,
}).isRequired,
};

/**
* Boolean whether the current channel is muted
*/
isMuted: PropTypes.bool.isRequired,
handleClick = () => {
const {
user,
channel,
isMuted,
actions: {
updateChannelNotifyProps,
},
} = this.props;

/**
* Object with action creators
*/
actions: PropTypes.shape({
updateChannelNotifyProps: PropTypes.func.isRequired,
}).isRequired,
};
updateChannelNotifyProps(user.id, channel.id, {
mark_unread: isMuted ? NotificationLevels.ALL : NotificationLevels.MENTION,
});
}

export default ToggleMuteChannel;
render() {
let message;
if (this.props.isMuted) {
message = (
<FormattedMessage
id='channel_header.unmute'
defaultMessage='Unmute Channel'
/>
);
} else {
message = (
<FormattedMessage
id='channel_header.mute'
defaultMessage='Mute Channel'
/>
);
}

return (
<li role='presentation'>
<button
className='style--none'
role='menuitem'
onClick={this.handleClick}
>
{message}
</button>
</li>
);
}
}