diff --git a/app/search/client/provider/result.js b/app/search/client/provider/result.js index 1d62162bd202..0f1714135e80 100644 --- a/app/search/client/provider/result.js +++ b/app/search/client/provider/result.js @@ -18,6 +18,13 @@ Meteor.startup(function() { context: ['search'], action() { const { msg: message } = messageArgs(this); + if (Session.get('openSearchPage')) { + Session.set('openSearchPage', false); + window.setTimeout(() => { + RoomHistoryManager.getSurroundingMessages(message, 50); + }, 400); + return; + } if (Session.get('openedRoom') === message.rid) { return RoomHistoryManager.getSurroundingMessages(message, 50); } diff --git a/app/search/client/search/search.html b/app/search/client/search/search.html index dbb6c5a7f179..280cd79e716c 100644 --- a/app/search/client/search/search.html +++ b/app/search/client/search/search.html @@ -7,11 +7,13 @@ {{/if}} {{else}}
- {{#if provider.description}} -
-

{{{_ provider.description}}}

-
- {{/if}} + {{#unless isMobile}} + {{#if provider.description}} +
+

{{{_ provider.description}}}

+
+ {{/if}} + {{/unless}}
diff --git a/app/search/client/search/search.js b/app/search/client/search/search.js index fbaed0bab153..f1515a71e125 100644 --- a/app/search/client/search/search.js +++ b/app/search/client/search/search.js @@ -6,6 +6,8 @@ import { TAPi18n } from 'meteor/rocketchat:tap-i18n'; import toastr from 'toastr'; import _ from 'underscore'; +import { isMobile } from '../../../utils/client'; + Template.RocketSearch.onCreated(function() { this.provider = new ReactiveVar(); this.isActive = new ReactiveVar(false); @@ -143,6 +145,9 @@ Template.RocketSearch.events = { }; Template.RocketSearch.helpers({ + isMobile() { + return isMobile(); + }, error() { return Template.instance().error.get(); }, diff --git a/app/theme/client/imports/components/header.css b/app/theme/client/imports/components/header.css index 063647aca0bb..f099256acb03 100644 --- a/app/theme/client/imports/components/header.css +++ b/app/theme/client/imports/components/header.css @@ -420,12 +420,7 @@ display: none; } - &__block { - margin: 0 0.25rem; - } - &__block-action { - order: 2; & + & { border-left: 1px var(--color-gray) solid; @@ -435,10 +430,24 @@ border-left: 0; } } + .rc-room-actions { + &__action { + .rc-room-actions__button { + .tab-button-icon { + height: 1.2em; + } + } + } + } } - - &__favorite { + &__search-button { + margin: 0 0.25em; order: 1; + &__action { + &__icon { + height: 1.2em; + } + } } &__data { diff --git a/app/ui-flextab/client/flexTabBar.js b/app/ui-flextab/client/flexTabBar.js index 7b1878a2d3f7..89ade57b1547 100644 --- a/app/ui-flextab/client/flexTabBar.js +++ b/app/ui-flextab/client/flexTabBar.js @@ -9,6 +9,7 @@ import { hasAllPermission } from '../../authorization'; import { popover, TabBar, Layout } from '../../ui-utils'; import { t } from '../../utils'; import { settings } from '../../settings'; +import { isMobile } from '../../utils/client'; const commonHelpers = { title() { @@ -53,6 +54,9 @@ const filterButtons = (button, anonymous, rid) => { if (button.groups.indexOf(Template.instance().tabBar.currentGroup()) === -1) { return false; } + if (button.id === 'rocket-search' && isMobile()) { + return false; + } if (button.id === 'addUsers' && !canShowAddUsersButton(rid)) { return false; } diff --git a/app/ui-utils/client/lib/RoomHistoryManager.js b/app/ui-utils/client/lib/RoomHistoryManager.js index b41ccfa790ec..74db81866dc8 100644 --- a/app/ui-utils/client/lib/RoomHistoryManager.js +++ b/app/ui-utils/client/lib/RoomHistoryManager.js @@ -227,8 +227,7 @@ export const RoomHistoryManager = new class { if (!message || !message.rid) { return; } - - const instance = Blaze.getView($('.messages-box .wrapper')[0]).templateInstance(); + const instance = Blaze.getView($('.messages-box .wrapper')[0]).parentView.templateInstance(); if (ChatMessage.findOne({ _id: message._id, _hidden: { $ne: true } })) { const wrapper = $('.messages-box .wrapper'); diff --git a/app/ui/client/components/header/headerRoom.html b/app/ui/client/components/header/headerRoom.html index b3d6a7c2fff4..eb6a4160ffb4 100644 --- a/app/ui/client/components/header/headerRoom.html +++ b/app/ui/client/components/header/headerRoom.html @@ -1,77 +1,98 @@ diff --git a/app/ui/client/components/header/headerRoom.js b/app/ui/client/components/header/headerRoom.js index 3f72b2d8d5c0..6aed27479347 100644 --- a/app/ui/client/components/header/headerRoom.js +++ b/app/ui/client/components/header/headerRoom.js @@ -6,7 +6,7 @@ import { Session } from 'meteor/session'; import { Template } from 'meteor/templating'; import { FlowRouter } from 'meteor/kadira:flow-router'; -import { t, roomTypes, handleError } from '../../../../utils'; +import { t, roomTypes, handleError, isMobile } from '../../../../utils'; import { TabBar, fireGlobalEvent, call } from '../../../../ui-utils'; import { ChatSubscription, Rooms, ChatRoom } from '../../../../models'; import { settings } from '../../../../settings'; @@ -29,10 +29,21 @@ Template.headerRoom.helpers({ isToggleFavoriteButtonVisible: () => Template.instance().state.get('favorite') !== null, toggleFavoriteButtonIconLabel: () => (Template.instance().state.get('favorite') ? t('Unfavorite') : t('Favorite')), toggleFavoriteButtonIcon: () => (Template.instance().state.get('favorite') ? 'star-filled' : 'star'), - + showSearchButton: () => isMobile(), + openSearchPage() { + if (!isMobile()) { + return; + } + return Session.get('openSearchPage'); + }, back() { return Template.instance().data.back; }, + getSearchButton() { + return TabBar.getButtons().filter(function(item) { + return item.id === 'rocket-search'; + })[0]; + }, avatarBackground() { const roomData = Session.get(`roomData${ this._id }`); if (!roomData) { return ''; } @@ -136,6 +147,18 @@ Template.headerRoom.helpers({ }); Template.headerRoom.events({ + 'click .js-open-search'() { + if (!Session.get('openSearchPage')) { + Session.set('openSearchPage', true); + } else { + Session.set('openSearchPage', false); + } + }, + + 'click .js-close-search'() { + Session.set('openSearchPage', !Session.get('openSearchPage')); + }, + 'click .iframe-toolbar .js-iframe-action'(e) { fireGlobalEvent('click-toolbar-button', { id: this.id }); e.currentTarget.querySelector('button').blur(); @@ -203,7 +226,7 @@ const loadUserStatusText = () => { Template.headerRoom.onCreated(function() { this.state = new ReactiveDict(); - + Session.set('openSearchPage', false); const isFavoritesEnabled = () => settings.get('Favorite_Rooms'); const isDiscussion = (rid) => { diff --git a/app/ui/client/views/app/room.html b/app/ui/client/views/app/room.html index 635b2260aac3..6c399ea2ecf1 100644 --- a/app/ui/client/views/app/room.html +++ b/app/ui/client/views/app/room.html @@ -11,129 +11,133 @@ {{/headerRoom}} {{/unless}}
-
-
{{_ "Drop_to_upload_file"}}
- {{#unless embeddedVersion}} - {{#if showAnnouncement}} -
-

{{{RocketChatMarkdownInline roomAnnouncement}}}

-
- {{/if}} - {{/unless}} -
- {{#with unreadData}} - {{#if since}} - {{#if count}} -
- - - {{_ "S_new_messages_since_s" count formatUnreadSince}} - - - {{_ "N_new_messages" count}} - - -
- {{/if}} + {{#if openSearchPage}} + {{> RocketSearch}} + {{else}} +
+
{{_ "Drop_to_upload_file"}}
+ {{#unless embeddedVersion}} + {{#if showAnnouncement}} +
+

{{{RocketChatMarkdownInline roomAnnouncement}}}

+
{{/if}} - {{/with}} -
-
-
- -
- + {{/unless}} +
+ {{#with unreadData}} + {{#if since}} + {{#if count}} +
+ + + {{_ "S_new_messages_since_s" count formatUnreadSince}} + + + {{_ "N_new_messages" count}} + + +
+ {{/if}} + {{/if}} + {{/with}}
- {{#unless canPreview}} -
-
- {{_ "You_must_join_to_view_messages_in_this_channel"}} -
+
+
+ +
+
- {{/unless}} - {{#with roomLeader}} -
- -
{{name}}
-
- - {{statusDisplay}} + {{#unless canPreview}} +
+
+ {{_ "You_must_join_to_view_messages_in_this_channel"}} +
- {{_ "Chat_Now"}} -
- {{/with}} -
-
    - {{#if canPreview}} - {{#if hasMore}} + {{/unless}} + {{#with roomLeader}} +
    + +
    {{name}}
    +
    + + {{statusDisplay}} +
    + {{_ "Chat_Now"}} +
    + {{/with}} +
    +
      + {{#if canPreview}} + {{#if hasMore}} +
    • + {{#if isLoading}} + {{> loading}} + {{/if}} +
    • + {{else}} +
    • + {{#if hasPurge}} +
      + {{> icon block="start__purge-warning-icon" icon="warning"}} + {{#unless filesOnly}} + {{#unless excludePinned}} + {{_ "RetentionPolicy_RoomWarning" time=purgeTimeout}} + {{else}} + {{_ "RetentionPolicy_RoomWarning_Unpinned" time=purgeTimeout}} + {{/unless}} + {{else}} + {{#unless excludePinned}} + {{_ "RetentionPolicy_RoomWarning_FilesOnly" time=purgeTimeout}} + {{else}} + {{_ "RetentionPolicy_RoomWarning_UnpinnedFilesOnly" time=purgeTimeout}} + {{/unless}} + {{/unless}} +
      + {{/if}} + {{_ "Start_of_conversation"}} +
    • + {{/if}} + {{/if}} + + {{# if useNrr}} + {{# with messageContext}} + {{#each msg in messagesHistory}}{{> nrr nrrargs 'message' shouldCollapseReplies=true msg=msg room=room subscription=subscription settings=settings u=u}}{{/each}} + {{/with}} + {{else}} + {{# with messageContext}} + {{#each msg in messagesHistory}}{{> message shouldCollapseReplies=true msg=msg room=room subscription=subscription settings=settings u=u}}{{/each}} + {{/with}} + {{/if}} + + {{#if hasMoreNext}}
    • {{#if isLoading}} {{> loading}} {{/if}}
    • - {{else}} -
    • - {{#if hasPurge}} -
      - {{> icon block="start__purge-warning-icon" icon="warning"}} - {{#unless filesOnly}} - {{#unless excludePinned}} - {{_ "RetentionPolicy_RoomWarning" time=purgeTimeout}} - {{else}} - {{_ "RetentionPolicy_RoomWarning_Unpinned" time=purgeTimeout}} - {{/unless}} - {{else}} - {{#unless excludePinned}} - {{_ "RetentionPolicy_RoomWarning_FilesOnly" time=purgeTimeout}} - {{else}} - {{_ "RetentionPolicy_RoomWarning_UnpinnedFilesOnly" time=purgeTimeout}} - {{/unless}} - {{/unless}} -
      - {{/if}} - {{_ "Start_of_conversation"}} -
    • {{/if}} - {{/if}} - - {{# if useNrr}} - {{# with messageContext}} - {{#each msg in messagesHistory}}{{> nrr nrrargs 'message' shouldCollapseReplies=true msg=msg room=room subscription=subscription settings=settings u=u}}{{/each}} - {{/with}} - {{else}} - {{# with messageContext}} - {{#each msg in messagesHistory}}{{> message shouldCollapseReplies=true msg=msg room=room subscription=subscription settings=settings u=u}}{{/each}} - {{/with}} - {{/if}} - - {{#if hasMoreNext}} -
    • - {{#if isLoading}} - {{> loading}} - {{/if}} -
    • - {{/if}} -
    +
+
+
+ {{> messageBox messageboxData}} +
- + {{/if}} + {{#with flexData}} + {{> contextualBar}} + {{/with}}
- {{#with flexData}} - {{> contextualBar}} - {{/with}} -
diff --git a/app/ui/client/views/app/room.js b/app/ui/client/views/app/room.js index 0088d4a1ddf3..855967b50abc 100644 --- a/app/ui/client/views/app/room.js +++ b/app/ui/client/views/app/room.js @@ -11,7 +11,7 @@ import { FlowRouter } from 'meteor/kadira:flow-router'; import { Session } from 'meteor/session'; import { Template } from 'meteor/templating'; -import { t, roomTypes, getUserPreference, handleError } from '../../../../utils'; +import { t, roomTypes, getUserPreference, handleError, isMobile } from '../../../../utils'; import { WebRTC } from '../../../../webrtc/client'; import { ChatMessage, RoomRoles, Users, Subscriptions, Rooms } from '../../../../models'; import { @@ -218,6 +218,12 @@ function roomMaxAge(room) { const ignoreReplies = getConfig('ignoreReplies') === 'true'; Template.room.helpers({ + openSearchPage() { + if (!isMobile()) { + return false; + } + return Session.get('openSearchPage'); + }, useNrr() { const useNrr = getConfig('useNrr'); return useNrr === 'true' || useNrr !== 'false'; @@ -942,6 +948,7 @@ Template.room.events({ Template.room.onCreated(function() { // this.scrollOnBottom = true // this.typing = new msgTyping this.data._id + Session.set('openSearchPage', false); lazyloadtick(); const rid = this.data._id; @@ -1084,6 +1091,8 @@ Template.room.onDestroyed(function() { }); Template.room.onRendered(function() { + Session.set('openSearchPage', false); + const { _id: rid } = this.data; if (!chatMessages[rid]) {