Merge branch 'feat/contacts-redesign' into feat/compose-new-conversation

This commit is contained in:
Sivin Varghese
2024-11-22 09:04:27 +05:30
committed by GitHub
8 changed files with 52 additions and 18 deletions
@@ -38,14 +38,16 @@ const onClickViewDetails = async () => {
<span class="text-sm font-medium truncate text-n-slate-12">
{{ name }}
</span>
<template v-if="additionalAttributes?.companyName">
<span class="text-sm text-n-slate-11">
{{ t('CONTACTS_LAYOUT.CARD.OF') }}
</span>
<span class="text-sm font-medium truncate text-n-slate-12">
{{ additionalAttributes.companyName }}
</span>
</template>
<span
v-if="additionalAttributes?.companyName"
class="i-lucide-briefcase-business size-4 text-n-slate-11"
/>
<span
v-if="additionalAttributes?.companyName"
class="text-sm truncate text-n-slate-11"
>
{{ additionalAttributes.companyName }}
</span>
</div>
<div class="flex items-center gap-3">
<span v-if="email" class="text-sm text-n-slate-11">{{ email }}</span>
@@ -63,7 +63,7 @@ const updateContact = async updatedData => {
const handleFormUpdate = debounce(
updatedData => updateContact(updatedData),
500,
600,
false
);
@@ -27,7 +27,7 @@ const updateContact = async ({ id, updatedData }) => {
const handleFormUpdate = debounce(
({ id, updatedData }) => updateContact({ id, updatedData }),
500,
600,
false
);
@@ -9,7 +9,6 @@ export const labelMenuItems = [
label: 'delivery',
value: 3,
thumbnail: {
name: 'delivery',
color: '#A2FDD5',
},
isSelected: true,
@@ -19,7 +18,6 @@ export const labelMenuItems = [
label: 'lead',
value: 6,
thumbnail: {
name: 'lead',
color: '#F161C8',
},
isSelected: false,
@@ -29,7 +27,6 @@ export const labelMenuItems = [
label: 'ops-handover',
value: 4,
thumbnail: {
name: 'ops-handover',
color: '#A53326',
},
isSelected: false,
@@ -39,7 +36,6 @@ export const labelMenuItems = [
label: 'billing',
value: 1,
thumbnail: {
name: 'billing',
color: '#28AD21',
},
isSelected: false,
@@ -49,7 +45,6 @@ export const labelMenuItems = [
label: 'premium-customer',
value: 5,
thumbnail: {
name: 'premium-customer',
color: '#6FD4EF',
},
isSelected: false,
@@ -59,7 +54,6 @@ export const labelMenuItems = [
label: 'software',
value: 2,
thumbnail: {
name: 'software',
color: '#8F6EF2',
},
isSelected: false,
@@ -449,7 +449,6 @@
"SHOWING": "Showing {startItem} - {endItem} of {totalItems} contacts"
},
"CARD": {
"OF": "of",
"VIEW_DETAILS": "View details",
"EDIT_DETAILS_FORM": {
"TITLE": "Edit contact details",
@@ -4,6 +4,7 @@ import {
} from 'shared/helpers/CustomErrors';
import types from '../../mutation-types';
import ContactAPI from '../../../api/contacts';
import decamelizeKeys from 'decamelize-keys';
import AccountActionsAPI from '../../../api/accountActions';
import AnalyticsHelper from '../../../helper/AnalyticsHelper';
import { CONTACTS_EVENTS } from '../../../helper/AnalyticsHelper/events';
@@ -90,11 +91,16 @@ export const actions = {
},
update: async ({ commit }, { id, isFormData = false, ...contactParams }) => {
const decamelizedContactParams = decamelizeKeys(contactParams, {
deep: true,
});
commit(types.SET_CONTACT_UI_FLAG, { isUpdating: true });
try {
const response = await ContactAPI.update(
id,
isFormData ? buildContactFormData(contactParams) : contactParams
isFormData
? buildContactFormData(decamelizedContactParams)
: decamelizedContactParams
);
commit(types.EDIT_CONTACT, response.data.payload);
commit(types.SET_CONTACT_UI_FLAG, { isUpdating: false });