mirror of
https://github.com/lingble/chatwoot.git
synced 2025-12-14 17:57:09 +00:00
* feat: Remove foundation * chore: Minor fix * Minor fix * Update _forms.scss * chore: More changes * chore: Minor fix * chore: Clean up * fix: font-weight * chore: More changes * chore: Setting page * chore: Editor fix * chore: Reports page * chore: More changes * chore: Minor changes * chore: More fixes * chore: More changes * chore: More changes * chore: More changes * chore: Minor fix * chore: More changes * chore: More changes * chore: More changes * chore: More changes * chore: Clean up * chore: Minor fix * chore: Clean ups * chore: Rename basic file * chore: Remove unused files * chore: Fix expanded input * Fix campaign rendering * chore: Clean up * chore: More changes * chore: Remove unused files * fix: Overflow issue * chore: Minor fix * chore: Clean up * chore: Minor fix * chore: Remove unused files * chore: Minor fix * chore: Minor fix * fix: autoprefixer start/end value has mixed support * chore: Minor fix * chore: Remove unused files * chore: Minor fix * chore: Minor fix * chore: Minor fix * Add responsive design to label settings * fix inbox view * chore: Minor fix * w-60% to w-2/3 * chore: Fix team * chore: Fix button * w-[34%] to w-1/3 * chore: Fix border * Add support mobile views in team page * chore: fix snackbar * chore: clean up * chore: Clean up * fix: loading state alignment * fix: alert styles * chore: Minor fix * fix: spacing for agent bot row * fix: layout * fix: layout for SLA * fix: checkbox * fix: SLA checkbox spacing * Update inbox settings pages * fix macros listing page layout * fix canned responses * chore: Fix bot page * chore: fix automation page * chore: fix agents page * chore: fix canned response editor * chore: Fix settings table * chore: fix settings layout * chore: Minor fix * fix: canned response table layou * fix: layout for table header for webhooks * fix: webhook row layout * fix: dashboard app modal layout * fix: add title to canned response truncated shortcode * fix: dashboard apps row layuot * fix: layouts hooks * fix: body color * fix: delete action color in portal locales * fix: text color for campagin title * fix: success button color --------- Co-authored-by: Pranav <pranav@chatwoot.com> Co-authored-by: Vishnu Narayanan <iamwishnu@gmail.com> Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
126 lines
3.4 KiB
Vue
126 lines
3.4 KiB
Vue
<template>
|
|
<div
|
|
class="shadow-xl hover:shadow-lg bg-white dark:bg-slate-900 mt-2 max-h-96 scroll-py-2 p-5 overflow-y-auto text-sm text-slate-700 dark:text-slate-100 border border-solid border-slate-50 dark:border-slate-800 rounded-lg"
|
|
>
|
|
<div
|
|
v-if="isLoading"
|
|
class="font-medium text-sm text-slate-400 dark:text-slate-700"
|
|
>
|
|
{{ loadingPlaceholder }}
|
|
</div>
|
|
<ul
|
|
v-if="shouldShowResults"
|
|
class="bg-white dark:bg-slate-900 gap-4 flex flex-col text-sm text-slate-700 dark:text-slate-100"
|
|
role="listbox"
|
|
>
|
|
<li
|
|
v-for="(article, index) in items"
|
|
:id="article.id"
|
|
:key="article.id"
|
|
class="group flex border border-solid hover:bg-slate-25 dark:hover:bg-slate-800 border-slate-100 dark:border-slate-800 rounded-lg cursor-pointer select-none items-center p-4"
|
|
:class="isSearchItemActive(index)"
|
|
role="option"
|
|
tabindex="-1"
|
|
@mouse-enter="onHover(index)"
|
|
@mouse-leave="onHover(-1)"
|
|
>
|
|
<a
|
|
class="flex flex-col gap-1 overflow-y-hidden"
|
|
:href="generateArticleUrl(article)"
|
|
>
|
|
<span
|
|
v-dompurify-html="prepareContent(article.title)"
|
|
class="flex-auto truncate text-base font-semibold leading-6 w-full overflow-hidden text-ellipsis whitespace-nowrap"
|
|
/>
|
|
<div
|
|
v-dompurify-html="prepareContent(article.content)"
|
|
class="line-clamp-2 text-ellipsis whitespace-nowrap overflow-hidden text-slate-600 dark:text-slate-300 text-sm"
|
|
/>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
|
|
<div
|
|
v-if="showEmptyResults"
|
|
class="font-medium text-sm text-slate-400 dark:text-slate-700"
|
|
>
|
|
{{ emptyPlaceholder }}
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import mentionSelectionKeyboardMixin from 'dashboard/components/widgets/mentions/mentionSelectionKeyboardMixin.js';
|
|
import messageFormatterMixin from 'shared/mixins/messageFormatterMixin';
|
|
|
|
export default {
|
|
mixins: [mentionSelectionKeyboardMixin, messageFormatterMixin],
|
|
props: {
|
|
items: {
|
|
type: Array,
|
|
default: () => [],
|
|
},
|
|
isLoading: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
emptyPlaceholder: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
searchPlaceholder: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
loadingPlaceholder: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
resultsTitle: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
searchTerm: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
selectedIndex: -1,
|
|
};
|
|
},
|
|
|
|
computed: {
|
|
showEmptyResults() {
|
|
return !this.items.length && !this.isLoading;
|
|
},
|
|
shouldShowResults() {
|
|
return this.items.length && !this.isLoading;
|
|
},
|
|
},
|
|
|
|
methods: {
|
|
isSearchItemActive(index) {
|
|
return index === this.selectedIndex
|
|
? 'bg-slate-25 dark:bg-slate-800'
|
|
: 'bg-white dark:bg-slate-900';
|
|
},
|
|
generateArticleUrl(article) {
|
|
return `/hc/${article.portal.slug}/articles/${article.slug}`;
|
|
},
|
|
handleKeyboardEvent(e) {
|
|
this.processKeyDownEvent(e);
|
|
this.$el.scrollTop = 102 * this.selectedIndex;
|
|
},
|
|
prepareContent(content) {
|
|
return this.highlightContent(
|
|
content,
|
|
this.searchTerm,
|
|
'bg-slate-100 dark:bg-slate-700 font-semibold text-slate-600 dark:text-slate-200'
|
|
);
|
|
},
|
|
},
|
|
};
|
|
</script>
|