From 36f086c5cbab67f410655726f274a630e4756fc1 Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+sivin-git@users.noreply.github.com> Date: Mon, 15 Mar 2021 18:38:05 +0530 Subject: [PATCH] feat: Redesigned search UI (#1845) --- .../i18n/locale/en/conversation.json | 2 +- .../conversation/ConversationView.vue | 42 +--- .../conversation/search/PopOverSearch.vue | 228 ++++++++++++++++++ .../conversation/search/ResultItem.vue | 191 +++++++++++++++ .../dashboard/conversation/search/Search.vue | 175 -------------- .../conversation/search/SearchMessageItem.vue | 155 ++++++++++++ .../conversations/search.json.jbuilder | 13 + 7 files changed, 591 insertions(+), 215 deletions(-) create mode 100644 app/javascript/dashboard/routes/dashboard/conversation/search/PopOverSearch.vue create mode 100644 app/javascript/dashboard/routes/dashboard/conversation/search/ResultItem.vue delete mode 100644 app/javascript/dashboard/routes/dashboard/conversation/search/Search.vue create mode 100644 app/javascript/dashboard/routes/dashboard/conversation/search/SearchMessageItem.vue diff --git a/app/javascript/dashboard/i18n/locale/en/conversation.json b/app/javascript/dashboard/i18n/locale/en/conversation.json index 4fccad865..91247105d 100644 --- a/app/javascript/dashboard/i18n/locale/en/conversation.json +++ b/app/javascript/dashboard/i18n/locale/en/conversation.json @@ -11,7 +11,7 @@ "TITLE": "Search messages", "LOADING_MESSAGE": "Crunching data...", "PLACEHOLDER": "Type any text to search messages", - "NO_MATCHING_RESULTS": "There are no messages matching the search parameters." + "NO_MATCHING_RESULTS": "No results found." }, "UNREAD_MESSAGES": "Unread Messages", "UNREAD_MESSAGE": "Unread Message", diff --git a/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue b/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue index 702613cf8..0e1bfd464 100644 --- a/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue +++ b/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue @@ -6,17 +6,7 @@ :active-team="activeTeam" @conversation-load="onConversationLoad" > - - + import { mapGetters } from 'vuex'; - import ChatList from '../../../components/ChatList'; import ConversationBox from '../../../components/widgets/conversation/ConversationBox'; -import Search from './search/Search.vue'; +import PopOverSearch from './search/PopOverSearch'; import uiSettingsMixin from 'dashboard/mixins/uiSettings'; export default { components: { ChatList, ConversationBox, - Search, + PopOverSearch, }, mixins: [uiSettingsMixin], props: { @@ -146,31 +135,6 @@ export default { }; diff --git a/app/javascript/dashboard/routes/dashboard/conversation/search/ResultItem.vue b/app/javascript/dashboard/routes/dashboard/conversation/search/ResultItem.vue new file mode 100644 index 000000000..20bb34cc9 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/conversation/search/ResultItem.vue @@ -0,0 +1,191 @@ + + + + + diff --git a/app/javascript/dashboard/routes/dashboard/conversation/search/Search.vue b/app/javascript/dashboard/routes/dashboard/conversation/search/Search.vue deleted file mode 100644 index 611e77968..000000000 --- a/app/javascript/dashboard/routes/dashboard/conversation/search/Search.vue +++ /dev/null @@ -1,175 +0,0 @@ - - - - - diff --git a/app/javascript/dashboard/routes/dashboard/conversation/search/SearchMessageItem.vue b/app/javascript/dashboard/routes/dashboard/conversation/search/SearchMessageItem.vue new file mode 100644 index 000000000..40da05e99 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/conversation/search/SearchMessageItem.vue @@ -0,0 +1,155 @@ + + + + diff --git a/app/views/api/v1/accounts/conversations/search.json.jbuilder b/app/views/api/v1/accounts/conversations/search.json.jbuilder index 9193b0e48..ab9114ad7 100644 --- a/app/views/api/v1/accounts/conversations/search.json.jbuilder +++ b/app/views/api/v1/accounts/conversations/search.json.jbuilder @@ -6,9 +6,22 @@ end json.payload do json.array! @conversations do |conversation| json.id conversation.display_id + json.created_at conversation.created_at.to_i + json.contact do + json.id conversation.contact.id + json.name conversation.contact.name + end + json.inbox do + json.id conversation.inbox.id + json.name conversation.inbox.name + json.channel_type conversation.inbox.channel_type + end json.messages do json.array! conversation.messages do |message| json.content message.content + json.id message.id + json.sender_name message.sender.name if message.sender + json.message_type message.message_type_before_type_cast json.created_at message.created_at.to_i end end