chore: More changes

This commit is contained in:
iamsivin
2024-11-11 21:51:32 +05:30
parent e2c1e6ff00
commit ae804baf9b
4 changed files with 25 additions and 3 deletions
@@ -147,7 +147,7 @@ const updateCurrentPage = page => {
@update:sort="emit('sort', $event)"
@more="emit('more')"
/>
<div class="w-px h-4 bg-n-strong" />
<div v-if="!isDetailView" class="w-px h-4 bg-n-strong" />
<Button :label="buttonLabel" size="sm" @click="emit('message')" />
</div>
</div>
@@ -5,6 +5,7 @@ import { useStore, useMapGetter } from 'dashboard/composables/store';
import { useRoute } from 'vue-router';
import { useMessageFormatter } from 'shared/composables/useMessageFormatter';
import { dynamicTime } from 'shared/helpers/timeHelper';
import { useKeyboardEvents } from 'dashboard/composables/useKeyboardEvents';
import Editor from 'dashboard/components-next/Editor/Editor.vue';
import Avatar from 'dashboard/components-next/avatar/Avatar.vue';
@@ -47,6 +48,14 @@ const onDelete = noteId => {
const { contactId } = route.params;
store.dispatch('contactNotes/delete', { noteId, contactId });
};
const keyboardEvents = {
'$mod+Enter': {
action: () => onAdd(state.message),
allowOnFocusedInput: true,
},
};
useKeyboardEvents(keyboardEvents);
</script>
<template>
@@ -54,6 +63,7 @@ const onDelete = noteId => {
<Editor
v-model="state.message"
:placeholder="t('CONTACTS_LAYOUT.SIDEBAR.NOTES.PLACEHOLDER')"
focus-on-mount
class="[&>div]:!border-transparent [&>div]:px-4 [&>div]:py-4 px-6"
>
<template #actions>
@@ -83,7 +83,7 @@ const handleBlur = () => {
watch(
() => props.modelValue,
newValue => {
if (props.maxLength && props.showCharacterCount) {
if (props.maxLength && props.showCharacterCount && !slots.actions) {
if (characterCount.value >= props.maxLength) {
emit('update:modelValue', newValue.slice(0, props.maxLength));
}
@@ -1,6 +1,7 @@
<script setup>
import { onMounted, computed, ref, reactive, watch } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { useStore, useMapGetter } from 'dashboard/composables/store';
import { debounce } from '@chatwoot/utils';
import { useUISettings } from 'dashboard/composables/useUISettings';
@@ -14,6 +15,7 @@ const DEBOUNCE_DELAY = 300;
const store = useStore();
const route = useRoute();
const { t } = useI18n();
const { updateUISettings, uiSettings } = useUISettings();
@@ -53,6 +55,16 @@ const activeSegment = computed(() =>
: undefined
);
const headerTitle = computed(() => {
if (activeSegmentId.value) {
return activeSegment.value.name;
}
if (activeLabel.value) {
return `#${activeLabel.value}`;
}
return t('CONTACTS_LAYOUT.HEADER.TITLE');
});
const buildSortAttr = () =>
`${sortState.activeOrdering}${sortState.activeSort}`;
@@ -153,7 +165,7 @@ onMounted(async () => {
class="flex flex-col justify-between flex-1 h-full m-0 overflow-auto bg-n-background"
>
<ContactsLayout
:header-title="$t('CONTACTS_LAYOUT.HEADER.TITLE')"
:header-title="headerTitle"
:button-label="$t('CONTACTS_LAYOUT.HEADER.MESSAGE_BUTTON')"
:current-page="currentPage"
:total-items="totalItems"