Skip to content
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

improved ux for 360 width media #3229

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion packages/rocketchat-emojione/emojiButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
Template.messageBox.events({
'click .emoji-picker-icon'(event) {
event.stopPropagation();
const mainContent = $('.main-content');
if (RocketChat.EmojiPicker.isOpened()) {
RocketChat.EmojiPicker.close();
} else {
mainContent.addClass('emoji-picking');
RocketChat.EmojiPicker.open(event.currentTarget, (emoji) => {
const input = $(event.currentTarget).parent().parent().find('.input-message');

Expand All @@ -15,7 +17,8 @@ Template.messageBox.events({

input.val(textAreaTxt.substring(0, caretPos) + emojiValue + textAreaTxt.substring(caretPos));

input.focus();
if ( !window.matchMedia('all and (min-width: 360px)').matches )
input.focus();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


input.prop('selectionStart', caretPos + emojiValue.length);
input.prop('selectionEnd', caretPos + emojiValue.length);
Expand Down
5 changes: 5 additions & 0 deletions packages/rocketchat-emojione/emojiPicker.less
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,9 @@
}
}
}

@media all and (max-width: 360px) {
border-radius: 0;
.transition(none);
}
}
7 changes: 7 additions & 0 deletions packages/rocketchat-emojione/lib/EmojiPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ RocketChat.EmojiPicker = {
return this.recent;
},
setPosition() {
if (window.matchMedia('all and (min-width: 360px)').matches) {
return $('.emoji-picker');
}

let sourcePos = $(this.source).offset();
let left = (sourcePos.left - this.width + 65);
let top = (sourcePos.top - this.height - 5);
Expand Down Expand Up @@ -88,6 +92,9 @@ RocketChat.EmojiPicker = {
this.opened = true;
},
close() {
const mainContent = $('.main-content');
mainContent.removeClass('emoji-picking');

$('.emoji-picker').removeClass('show');
this.opened = false;
},
Expand Down
171 changes: 171 additions & 0 deletions packages/rocketchat-theme/assets/stylesheets/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -4601,3 +4601,174 @@ br.only-after-a {
a + br.only-after-a {
display: block;
}

@media all and (max-width: 360px) {
#rocket-chat {
.fixed-title h2 {
font-size: 19px;
height: 38px;
margin-left: 22px;
margin-top: -3px;
}
.flex-tab {
.transform(translateY(-100%));
.transition(height .50s cubic-bezier(ease-in-out));
border-top: 1px solid #eaeaea;
right: 0px;
top: 76px;
width: 100%;
}
.flex-opened .flex-tab {
.transform(translateY(0px));
}
.flex-tab-bar {
align-items: center;
border-bottom: 1px solid #eaeaea;
border-left: none;
display: flex;
height: 37px;
left: 0;
padding: 0px;
top: 40px;
width: 100%;
}
.main-content {
right: 0px;
&.emoji-picking {
bottom: 219px;
}
}

.messages-box {
bottom: 18px;
height: calc(100% - 124px);
margin-top: 77px;
}
.toggle-favorite {
border-bottom: 1px solid #eaeaea;
font-size: 24px;
padding: 7px 8px 3px 1px;
position: absolute;
right: 0px;
top: 0px;
}
}

.account-box .options,
.flex-nav .content {
height: calc(100%);
}

.burger {
left: -5px;
top: -5px;
}

.emoji-picker {
bottom: 0px;
left: initial;
position: absolute;
top: initial;
form {
display: none;
}
}

.fixed-title {
height: 40px;
z-index: 200;
h2 {
margin-right: 26px;
.icon-lock, .icon-hash, .icon-at {
font-size: 14px;
}
.room-title {
font-size: 14px;
font-weight: bold;
}
.room-topic {
display: block;
font-size: 12px;
font-style: italic;
line-height: 100%;
margin-left: 5px;
margin-top: -6px;
overflow: hidden;
padding-top: 0;
text-overflow: ellipsis;
}
}
}

.flex-tab-bar .tab-button.active {
border-right: none;
border-top: 3px solid #f00;
margin-left: 0px;
margin-top: -3px;
padding-left: 10px;
}

.message {
padding-left: 63px;
.thumb {
left: 13px;
}
}

.messages-container {
.footer {
min-height: 37px;
padding: 0px;
}
.message-form {
.message-input {
display: flex;
.file {
order: 2;
position: relative;
}
.input-message-container {
align-items: center;
background-color: #fff;
display: flex;
.inner-right-toolbar {
left: 0px;
order: 1;
padding: 0px 6px 0px 4px;
position: relative;
top: 0px;
}
}
.message-buttons {
order: 3;
input {
float: left;
width: 34px;
}
}
}
.formatting-tips {
display: none;
}
.users-typing {
display: none;
}
textarea {
border: 0;
height: 35px;
order: 2;
padding-left: 0px;
padding-right: 0px;
}
}
}

.side-nav {
.footer {
display: none;
}
.rooms-list {
height: calc(100%);
}
}
}
10 changes: 10 additions & 0 deletions packages/rocketchat-ui-message/message/messageBox.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,23 @@ Template.messageBox.events
# at this point, the input is cleared and ready for autogrow
input.updateAutogrow()
instance.isMessageFieldEmpty.set(chatMessages[@_id].isEmpty())

if window.matchMedia('all and (min-width: 360px)').matches
instance.$('.message-buttons.file').removeClass('hidden')
)
input.focus()

'keyup .input-message': (event, instance) ->
chatMessages[@_id].keyup(@_id, event, instance)
instance.isMessageFieldEmpty.set(chatMessages[@_id].isEmpty())

if window.matchMedia('all and (min-width: 360px)').matches
input = event.currentTarget
if input.value.length is 0
instance.$('.message-buttons.file').removeClass('hidden')
else
instance.$('.message-buttons.file').addClass('hidden')

'paste .input-message': (e) ->
if not e.originalEvent.clipboardData?
return
Expand Down