-
Notifications
You must be signed in to change notification settings - Fork 2.7k
MM-15652 Render header plugin correctly in mobile view #3059
Conversation
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.
LGTM
@hmhealey, this basically looks like a revert of the original PR, but maybe with some differences? Is there a way to highlight the net changes? |
Here's the diff from before Jesús's changes. Basically, the original version rendered a single item as a button and multiple items as a list. It now renders multiple items the same, but a single item is a button if it's in the header or a list if it's in the dropdown. harrison-mm2:mattermost-webapp harrison$ git diff 2e6c8150f17d23f7d3fe19121170de70a777b432^ -- plugins/mobile_channel_header_plug/mobile_channel_header_plug.jsx
diff --git a/plugins/mobile_channel_header_plug/mobile_channel_header_plug.jsx b/plugins/mobile_channel_header_plug/mobile_channel_header_plug.jsx
index 410facf28..038195572 100644
--- a/plugins/mobile_channel_header_plug/mobile_channel_header_plug.jsx
+++ b/plugins/mobile_channel_header_plug/mobile_channel_header_plug.jsx
@@ -26,38 +26,43 @@ export default class MobileChannelHeaderPlug extends React.PureComponent {
theme: PropTypes.object.isRequired,
}
- createButton(plug) {
- return (
- <li className='flex-parent--center'>
- <button
- className='navbar-toggle navbar-right__icon'
- onClick={() => this.fireAction(plug)}
- >
- <span className='icon navbar-plugin-button'>
- {plug.icon}
- </span>
- </button>
- </li>
- );
- }
+ createButton = (plug) => {
+ const onClick = () => this.fireAction(plug);
- createList(plugs) {
- return plugs.map((plug) => {
+ if (this.props.isDropdown) {
return (
<li
key={'mobileChannelHeaderItem' + plug.id}
role='presentation'
+ className='MenuItem'
>
<a
role='menuitem'
href='#'
- onClick={() => this.fireAction(plug)}
+ onClick={onClick}
>
{plug.dropdownText}
</a>
</li>
);
- });
+ }
+
+ return (
+ <li className='flex-parent--center'>
+ <button
+ className='navbar-toggle navbar-right__icon'
+ onClick={onClick}
+ >
+ <span className='icon navbar-plugin-button'>
+ {plug.icon}
+ </span>
+ </button>
+ </li>
+ );
+ }
+
+ createList(plugs) {
+ return plugs.map(this.createButton);
}
fireAction(plug) { This reverts Jesús's changes when you have a single item outside of the dropdown, but it keeps them for a single item inside of the dropdown |
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.
Thanks, @hmhealey!
* [MM-16723] Added aria-label to post components * [MM-16723] Removed hard to read ternary statements * Increasing test coverage for MM-15012 (#3060) * Increasing test coverage for MM-15012 * combine checkEmojiSize functions and updating documentation * using emojis.join function in order to remove commas * MM-15652 Render header plugin correctly in mobile view (#3059) * MM-16695 Update mattermost-redux to add additional null check (#3052) * MM-16695 Update mattermost-redux to add additional null check * Update mattermost-redux * MM-16477 Check for modified users on reconnect (#3028) * MM-16477 Move websocket status to redux * MM-16477 Check for modified users on reconnect * Update mattermost-redux * Fix unit tests * Update mattermost-redux * Fix incorrect merge * [MM-15887] E2E: add test for interactive menus - basic options (#3063) * E2E: add test for interactive menus - basic options * check status after initiating Cypress task both for postIncomingWebhook and postMessageAs * fix messaging and team flaky specs (#3070) * [MM-14720] Add bot post counts per day to System Analytics (#3018) * Add Bot Posts per day analytics * Remove botPostCountsDay from team analytics. This is causing an linting error and not currently requested for teams * Add Total Posts from Bots * Correctly place alphabetically in sorted fields * [MM-16723] Removed hard to read ternary statements * [MM-16723] PR feedback
This seems to be a regression caused by #2933. Originally, it rendered the button in both the header and dropdown, then it rendered the text item in both places. Now, it'll render the button in the header and the text in the dropdown.
Ticket Link
https://mattermost.atlassian.net/browse/MM-15652