From ac0c5791b6ae545bfc259f17eaf00855e4fd9093 Mon Sep 17 00:00:00 2001 From: Ben Halpern Date: Wed, 13 Jun 2018 15:44:16 -0400 Subject: [PATCH] Add expand support to Connect (#428) * Make adjustments and fixes to DEV Conncect * Make various small changes and add settings icon * Add expand support to Connect --- app/assets/stylesheets/chat.scss | 55 ++++++++++++++++++++++---- app/javascript/chat/actions.js | 2 - app/javascript/chat/channels.jsx | 35 +++++++++++++++- app/javascript/chat/chat.jsx | 51 ++++++++++++++++++------ app/views/chat_channels/index.html.erb | 14 +------ 5 files changed, 121 insertions(+), 36 deletions(-) diff --git a/app/assets/stylesheets/chat.scss b/app/assets/stylesheets/chat.scss index 9ec1c9210..bfc0576a3 100644 --- a/app/assets/stylesheets/chat.scss +++ b/app/assets/stylesheets/chat.scss @@ -1,6 +1,23 @@ @import 'variables'; -// High level class +// High level classes +.chat-page-wrapper{ + height: calc(100vh - 121px); + margin: 100px auto; + width: 96%; + max-width: 1240px; + height: calc(100vh - 155px); + @media screen and ( min-width: 375px ){ + height: calc(100vh - 121px); + } +} +.live-chat{ + height: calc(100vh - 155px); + overflow-y: hidden; + @media screen and ( min-width: 375px ){ + height: calc(100vh - 121px); + } +} .chat-page-header{ background: $green; text-align: center; @@ -12,9 +29,15 @@ font-weight: bold; } + +//chat .chat { display: flex; - height: inherit; + height: calc(100vh - 162px); + padding-right: 3px; + @media screen and ( min-width: 375px ){ + height: calc(100vh - 128px); + } } .chat__notificationsbutton{ @@ -35,20 +58,36 @@ } .chat__channels { - width: 80px; + width: 45px; height: inherit; position: relative; - @media screen and ( min-width: 550px ){ - width: 160px; +} + +.chat__channels--expanded{ + width: 180px; +} + +.chat__channelstogglebutt{ + width: 26px; + height: 38px; + background: transparent; + border: 0px; + -webkit-appearance: none; + font-size: 18px; + font-weight: bold; + img{ + width: 100%; } } .chat__channels input { - width: 96%; + width: calc(100% - 37px); border-radius: 3px; border: 1px solid $light-medium-gray; box-sizing: border-box; - padding: 5px; + padding: 8px; + margin-left: 2px; + font-size: 14px; } .chat_chatconfig{ @@ -277,6 +316,7 @@ color: $medium-gray; padding: 10px; opacity:0.8; + padding-bottom: 70px; } .chatchannels__config{ @@ -304,6 +344,7 @@ position: absolute; bottom: 42px; padding: 12px 10px; + min-width: 150px; left: 0; right: 0; background: $lightest-gray; diff --git a/app/javascript/chat/actions.js b/app/javascript/chat/actions.js index 69a92be5b..31b290261 100644 --- a/app/javascript/chat/actions.js +++ b/app/javascript/chat/actions.js @@ -85,8 +85,6 @@ export function getChannels(query,retrievalID, props, successCb, failureCb) { console.log(query) let channels = content.hits if (retrievalID === null || content.hits.filter(e => e.id === retrievalID).length === 1) { - console.log("third-1") - console.log(query) successCb(channels, query) } else { index.getObjects([`${retrievalID}`], function(err, content) { diff --git a/app/javascript/chat/channels.jsx b/app/javascript/chat/channels.jsx index 12fb14612..01d7c1af8 100644 --- a/app/javascript/chat/channels.jsx +++ b/app/javascript/chat/channels.jsx @@ -2,7 +2,7 @@ import { h } from 'preact'; import PropTypes from 'prop-types'; import ConfigImage from 'images/three-dots.svg'; -const Channels = ({ activeChannelId, chatChannels, handleSwitchChannel }) => { +const Channels = ({ activeChannelId, chatChannels, handleSwitchChannel, expanded }) => { const channels = chatChannels.map(channel => { const isActive = parseInt(activeChannelId, 10) === channel.id const lastOpened = channel.last_opened_at ? channel.last_opened_at : channel.channel_users[window.currentUser.username].last_opened_at @@ -22,6 +22,35 @@ const Channels = ({ activeChannelId, chatChannels, handleSwitchChannel }) => { } else if ( isActive ) { channelColor = '#4e57ef' } + + let content = '' + + if (expanded) { + content = + + {indicatorPic} + + {name} + + } else { + if (channel.channel_type === "direct") { + + content = + {indicatorPic} + + } else { + content = name + } + } + return ( + + + {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 %> - -
+
DEV Connect is Beta (Work in Progress ❤️)