@@ -72,6 +102,7 @@ Channels.propTypes = {
activeChannelId: PropTypes.number.isRequired,
chatChannels: PropTypes.array.isRequired,
handleSwitchChannel: PropTypes.func.isRequired,
+ expanded: PropTypes.bool.isRequired,
};
export default Channels;
diff --git a/app/javascript/chat/chat.jsx b/app/javascript/chat/chat.jsx
index 5e9093aa0..1d62c5e17 100644
--- a/app/javascript/chat/chat.jsx
+++ b/app/javascript/chat/chat.jsx
@@ -31,6 +31,7 @@ export default class Chat extends Component {
showTimestamp: chatOptions.showTimestamp,
notificationsPermission: null,
activeContent: null,
+ expanded: window.innerWidth > 600,
isMobileDevice: typeof window.orientation !== "undefined",
};
}
@@ -385,6 +386,10 @@ export default class Chat extends Component {
getChannels(e.target.value, null, this.props, this.loadChannels);
}
+ toggleExpand = () => {
+ this.setState({expanded: !this.state.expanded})
+ }
+
renderChatChannels = () => {
if (this.state.showChannelsList) {
const notificationsPermission = this.state.notificationsPermission;
@@ -397,18 +402,40 @@ export default class Chat extends Component {
} else if (notificationsPermission === "denied") {
notificationsState =
Notificatins Off
}
- return (
-
- {notificationsButton}
-
-
- {notificationsState}
-
- );
+ if (this.state.expanded) {
+ return (
+
+ {notificationsButton}
+
+
+
+ {notificationsState}
+
+ )
+ } else {
+ return (
+
+ {notificationsButton}
+
+
+ {notificationsState}
+
+ )
+ }
}
return '';
};
diff --git a/app/views/chat_channels/index.html.erb b/app/views/chat_channels/index.html.erb
index 9cb1c4119..5f0fcb09a 100644
--- a/app/views/chat_channels/index.html.erb
+++ b/app/views/chat_channels/index.html.erb
@@ -9,19 +9,7 @@
<% if user_signed_in? %>
<%= javascript_pack_tag 'chat', defer: true %>
-
-