Review changes
This commit is contained in:
parent
ea2f265baa
commit
4ac2b31f42
9 changed files with 98 additions and 10 deletions
|
@ -11,7 +11,9 @@
|
||||||
"CONVERSATIONS": "CONVERSATIONS",
|
"CONVERSATIONS": "CONVERSATIONS",
|
||||||
"MESSAGES": "MESSAGES"
|
"MESSAGES": "MESSAGES"
|
||||||
},
|
},
|
||||||
"EMPTY_STATE": "No results found for this query",
|
"EMPTY_STATE": "No %{item} found for query '%{query}'",
|
||||||
"PLACEHOLDER_KEYBINDING": "/ to focus"
|
"PLACEHOLDER_KEYBINDING": "/ to focus",
|
||||||
|
"INPUT_PLACEHOLDER": "Search message content, contact name, email or phone or conversations",
|
||||||
|
"BOT_LABEL": "Bot"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
<template>
|
||||||
|
<div class="read-more">
|
||||||
|
<div ref="content" :class="{ content: applyReadMore }">
|
||||||
|
<slot />
|
||||||
|
<woot-button
|
||||||
|
size="tiny"
|
||||||
|
variant="smooth"
|
||||||
|
color-scheme="primary"
|
||||||
|
class="read-more-button"
|
||||||
|
>
|
||||||
|
Read more
|
||||||
|
</woot-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
applyReadMore: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.content {
|
||||||
|
max-height: 100px;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
height: 50px;
|
||||||
|
background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 100%);
|
||||||
|
z-index: 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.read-more-button {
|
||||||
|
max-width: max-content;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
margin: 0 auto;
|
||||||
|
z-index: 5;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -8,7 +8,7 @@
|
||||||
<input
|
<input
|
||||||
ref="searchInput"
|
ref="searchInput"
|
||||||
type="search"
|
type="search"
|
||||||
placeholder="Search message content, contact name, email or phone or conversations"
|
:placeholder="$t('SEARCH.INPUT_PLACEHOLDER')"
|
||||||
:value="searchQuery"
|
:value="searchQuery"
|
||||||
@input="debounceSearch"
|
@input="debounceSearch"
|
||||||
/>
|
/>
|
||||||
|
@ -43,7 +43,10 @@ export default {
|
||||||
}, 500);
|
}, 500);
|
||||||
},
|
},
|
||||||
focusSearch(e) {
|
focusSearch(e) {
|
||||||
if (e.key === '/') this.$refs.searchInput.focus();
|
if (e.key === '/') {
|
||||||
|
e.preventDefault();
|
||||||
|
this.$refs.searchInput.focus();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<search-result-section
|
<search-result-section
|
||||||
:title="$t('SEARCH.SECTION.CONTACTS')"
|
:title="$t('SEARCH.SECTION.CONTACTS')"
|
||||||
:empty="!contacts.length"
|
:empty="!contacts.length"
|
||||||
|
:query="query"
|
||||||
>
|
>
|
||||||
<ul class="search-list">
|
<ul class="search-list">
|
||||||
<li v-for="contact in contacts" :key="contact.id">
|
<li v-for="contact in contacts" :key="contact.id">
|
||||||
|
@ -24,6 +25,10 @@ export default {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
|
query: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<search-result-section
|
<search-result-section
|
||||||
:title="$t('SEARCH.SECTION.CONVERSATIONS')"
|
:title="$t('SEARCH.SECTION.CONVERSATIONS')"
|
||||||
:empty="!conversations.length"
|
:empty="!conversations.length"
|
||||||
|
:query="query"
|
||||||
>
|
>
|
||||||
<ul class="search-list">
|
<ul class="search-list">
|
||||||
<li v-for="conversation in conversations" :key="conversation.id">
|
<li v-for="conversation in conversations" :key="conversation.id">
|
||||||
|
@ -24,6 +25,10 @@ export default {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
|
query: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -39,12 +39,12 @@ export default {
|
||||||
getThumbnail() {
|
getThumbnail() {
|
||||||
return this.message.sender && this.message.sender.thumbnail
|
return this.message.sender && this.message.sender.thumbnail
|
||||||
? this.message.sender.thumbnail
|
? this.message.sender.thumbnail
|
||||||
: '';
|
: this.$t('SEARCH.BOT_LABEL');
|
||||||
},
|
},
|
||||||
getName() {
|
getName() {
|
||||||
return this.message && this.message.sender && this.message.sender.name
|
return this.message && this.message.sender && this.message.sender.name
|
||||||
? this.message.sender.name
|
? this.message.sender.name
|
||||||
: '';
|
: this.$t('SEARCH.BOT_LABEL');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<search-result-section
|
<search-result-section
|
||||||
:title="$t('SEARCH.SECTION.MESSAGES')"
|
:title="$t('SEARCH.SECTION.MESSAGES')"
|
||||||
:empty="!messages.length"
|
:empty="!messages.length"
|
||||||
|
:query="query"
|
||||||
>
|
>
|
||||||
<ul class="search-list">
|
<ul class="search-list">
|
||||||
<li v-for="message in messages" :key="message.id">
|
<li v-for="message in messages" :key="message.id">
|
||||||
|
@ -24,6 +25,10 @@ export default {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
|
query: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
</div>
|
</div>
|
||||||
<slot />
|
<slot />
|
||||||
<div v-if="empty" class="empty">
|
<div v-if="empty" class="empty">
|
||||||
<fluent-icon icon="info" size="32px" class="icon" />
|
<fluent-icon icon="info" size="24px" class="icon" />
|
||||||
<p class="empty-state__text">
|
<p class="empty-state__text">
|
||||||
{{ $t('SEARCH.EMPTY_STATE') }}
|
{{ $t('SEARCH.EMPTY_STATE', { item: titleCase, query }) }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
@ -24,6 +24,15 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
query: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
titleCase() {
|
||||||
|
return this.title.toLowerCase();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -43,13 +52,13 @@ export default {
|
||||||
z-index: 50;
|
z-index: 50;
|
||||||
border-bottom-width: 1px;
|
border-bottom-width: 1px;
|
||||||
border-top-width: 1px;
|
border-top-width: 1px;
|
||||||
border-color: #dbdbdb;
|
border-color: var(--s-100);
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-left: 0;
|
border-left: 0;
|
||||||
border-right: 0;
|
border-right: 0;
|
||||||
p {
|
p {
|
||||||
font-size: var(--font-size-small);
|
font-size: var(--font-size-small);
|
||||||
color: var(--b-600);
|
color: var(--s-500);
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,14 +11,17 @@
|
||||||
<search-result-contacts-list
|
<search-result-contacts-list
|
||||||
v-if="filterContacts"
|
v-if="filterContacts"
|
||||||
:contacts="contacts"
|
:contacts="contacts"
|
||||||
|
:query="query"
|
||||||
/>
|
/>
|
||||||
<search-result-messages-list
|
<search-result-messages-list
|
||||||
v-if="filterMessages"
|
v-if="filterMessages"
|
||||||
:messages="messages"
|
:messages="messages"
|
||||||
|
:query="query"
|
||||||
/>
|
/>
|
||||||
<search-result-conversations-list
|
<search-result-conversations-list
|
||||||
v-if="filterConversations"
|
v-if="filterConversations"
|
||||||
:conversations="conversations"
|
:conversations="conversations"
|
||||||
|
:query="query"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -122,6 +125,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
search(q) {
|
search(q) {
|
||||||
|
this.query = q;
|
||||||
this.$store.dispatch('conversationSearch/fullSearch', { q });
|
this.$store.dispatch('conversationSearch/fullSearch', { q });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue