mirror of
https://github.com/lingble/chatwoot.git
synced 2025-10-30 18:47:51 +00:00
These fixes are all auto generated and can be merged directly Fixes the following issues 1. Event used on components should be hypenated 2. Attribute orders in components 3. Use `unmounted` instead of `destroyed` 4. Add explicit `emits` declarations for components, autofixed [using this script](https://gist.github.com/scmmishra/6f549109b96400006bb69bbde392eddf) We ignore the top level v-if for now, we will fix it later
116 lines
3.0 KiB
Vue
116 lines
3.0 KiB
Vue
<script setup>
|
|
import { computed } from 'vue';
|
|
import ConversationBasicFilter from './widgets/conversation/ConversationBasicFilter.vue';
|
|
|
|
const props = defineProps({
|
|
pageTitle: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
hasAppliedFilters: {
|
|
type: Boolean,
|
|
required: true,
|
|
},
|
|
hasActiveFolders: {
|
|
type: Boolean,
|
|
required: true,
|
|
},
|
|
activeStatus: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
});
|
|
|
|
const emit = defineEmits([
|
|
'addFolders',
|
|
'deleteFolders',
|
|
'resetFilters',
|
|
'basicFilterChange',
|
|
'filtersModal',
|
|
]);
|
|
|
|
const onBasicFilterChange = (value, type) => {
|
|
emit('basicFilterChange', value, type);
|
|
};
|
|
|
|
const hasAppliedFiltersOrActiveFolders = computed(() => {
|
|
return props.hasAppliedFilters || props.hasActiveFolders;
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<div
|
|
class="flex items-center justify-between px-4 py-0"
|
|
:class="{
|
|
'pb-3 border-b border-slate-75 dark:border-slate-700':
|
|
hasAppliedFiltersOrActiveFolders,
|
|
}"
|
|
>
|
|
<div class="flex max-w-[85%] justify-center items-center">
|
|
<h1
|
|
class="text-xl font-medium break-words truncate text-black-900 dark:text-slate-100"
|
|
:title="pageTitle"
|
|
>
|
|
{{ pageTitle }}
|
|
</h1>
|
|
<span
|
|
v-if="!hasAppliedFiltersOrActiveFolders"
|
|
class="p-1 my-0.5 mx-1 rounded-md capitalize bg-slate-50 dark:bg-slate-800 text-xxs text-slate-600 dark:text-slate-300"
|
|
>
|
|
{{ $t(`CHAT_LIST.CHAT_STATUS_FILTER_ITEMS.${activeStatus}.TEXT`) }}
|
|
</span>
|
|
</div>
|
|
<div class="flex items-center gap-1">
|
|
<template v-if="hasAppliedFilters && !hasActiveFolders">
|
|
<woot-button
|
|
v-tooltip.top-end="$t('FILTER.CUSTOM_VIEWS.ADD.SAVE_BUTTON')"
|
|
size="tiny"
|
|
variant="smooth"
|
|
color-scheme="secondary"
|
|
icon="save"
|
|
@click="emit('addFolders')"
|
|
/>
|
|
<woot-button
|
|
v-tooltip.top-end="$t('FILTER.CLEAR_BUTTON_LABEL')"
|
|
size="tiny"
|
|
variant="smooth"
|
|
color-scheme="alert"
|
|
icon="dismiss-circle"
|
|
@click="emit('resetFilters')"
|
|
/>
|
|
</template>
|
|
<template v-if="hasActiveFolders">
|
|
<woot-button
|
|
v-tooltip.top-end="$t('FILTER.CUSTOM_VIEWS.EDIT.EDIT_BUTTON')"
|
|
size="tiny"
|
|
variant="smooth"
|
|
color-scheme="secondary"
|
|
icon="edit"
|
|
@click="emit('filtersModal')"
|
|
/>
|
|
<woot-button
|
|
v-tooltip.top-end="$t('FILTER.CUSTOM_VIEWS.DELETE.DELETE_BUTTON')"
|
|
size="tiny"
|
|
variant="smooth"
|
|
color-scheme="alert"
|
|
icon="delete"
|
|
@click="emit('deleteFolders')"
|
|
/>
|
|
</template>
|
|
<woot-button
|
|
v-else
|
|
v-tooltip.right="$t('FILTER.TOOLTIP_LABEL')"
|
|
variant="smooth"
|
|
color-scheme="secondary"
|
|
icon="filter"
|
|
size="tiny"
|
|
@click="emit('filtersModal')"
|
|
/>
|
|
<ConversationBasicFilter
|
|
v-if="!hasAppliedFiltersOrActiveFolders"
|
|
@change-filter="onBasicFilterChange"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|