From 3a47b7e3d19944cefdffb379ed348d665cf921bc Mon Sep 17 00:00:00 2001 From: Pranav Date: Thu, 29 Aug 2024 19:06:11 +0530 Subject: [PATCH] feat(design): Update the design for the custom attribute console (#10049) This PR continues the design update series, updates the design for the custom attributes management page. This PR improves the interaction in the Add Custom Attribute feature. Now, the attribute model in the add attribute form will default to the currently selected tab. --------- Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> --- .../dashboard/components/CustomAttribute.vue | 2 + .../i18n/locale/en/attributesMgmt.json | 10 +- .../dashboard/settings/SettingsLayout.vue | 28 +- .../settings/attributes/AddAttribute.vue | 17 +- .../settings/attributes/CustomAttribute.vue | 325 +++++++----------- .../dashboard/settings/attributes/Index.vue | 130 +++++-- .../settings/attributes/attributes.routes.js | 9 +- 7 files changed, 274 insertions(+), 247 deletions(-) diff --git a/app/javascript/dashboard/components/CustomAttribute.vue b/app/javascript/dashboard/components/CustomAttribute.vue index 4bf97320b..ee00c182d 100644 --- a/app/javascript/dashboard/components/CustomAttribute.vue +++ b/app/javascript/dashboard/components/CustomAttribute.vue @@ -331,10 +331,12 @@ export default { ::v-deep { .selector-wrap { @apply m-0 top-1; + .selector-name { @apply ml-0; } } + .name { @apply ml-0; } diff --git a/app/javascript/dashboard/i18n/locale/en/attributesMgmt.json b/app/javascript/dashboard/i18n/locale/en/attributesMgmt.json index a2f7386dc..a83852fb8 100644 --- a/app/javascript/dashboard/i18n/locale/en/attributesMgmt.json +++ b/app/javascript/dashboard/i18n/locale/en/attributesMgmt.json @@ -3,7 +3,8 @@ "HEADER": "Custom Attributes", "HEADER_BTN_TXT": "Add Custom Attribute", "LOADING": "Fetching custom attributes", - "SIDEBAR_TXT": "

Custom Attributes

A custom attribute tracks facts about your contacts/conversation — like the subscription plan, or when they ordered the first item etc.

For creating a Custom Attribute, just click on the Add Custom Attribute. You can also edit or delete an existing Custom Attribute by clicking on the Edit or Delete button.

", + "DESCRIPTION": "A custom attribute tracks additional details about your contacts or conversations—such as the subscription plan or the date of their first purchase. You can add different types of custom attributes, such as text, lists, or numbers, to capture the specific information you need.", + "LEARN_MORE": "Learn more about custom attributes", "ADD": { "TITLE": "Add Custom Attribute", "SUBMIT": "Create", @@ -91,7 +92,12 @@ "CONTACT": "Contact" }, "LIST": { - "TABLE_HEADER": ["Name", "Description", "Type", "Key"], + "TABLE_HEADER": [ + "Name", + "Description", + "Type", + "Key" + ], "BUTTONS": { "EDIT": "Edit", "DELETE": "Delete" diff --git a/app/javascript/dashboard/routes/dashboard/settings/SettingsLayout.vue b/app/javascript/dashboard/routes/dashboard/settings/SettingsLayout.vue index 916f821ad..0e6a42fe8 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/SettingsLayout.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/SettingsLayout.vue @@ -22,17 +22,21 @@ defineProps({ diff --git a/app/javascript/dashboard/routes/dashboard/settings/attributes/AddAttribute.vue b/app/javascript/dashboard/routes/dashboard/settings/attributes/AddAttribute.vue index 1ff257b7e..33f9ab7a5 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/attributes/AddAttribute.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/attributes/AddAttribute.vue @@ -12,6 +12,12 @@ export default { type: Function, default: () => {}, }, + // Passes 0 or 1 based on the selected AttributeModel tab selected in the UI + // Needs a better data type, todo: refactor this component later + selectedAttributeModelTab: { + type: Number, + default: 0, + }, }, setup() { return { v$: useVuelidate() }; @@ -20,7 +26,10 @@ export default { return { displayName: '', description: '', - attributeModel: 0, + // Using the prop as default. There is no side effect here as the component + // is destroyed completely when the modal is closed. The prop doesn't change + // dynamically when the modal is active. + attributeModel: this.selectedAttributeModelTab || 0, attributeType: 0, attributeKey: '', regexPattern: null, @@ -280,13 +289,16 @@ export default { padding: 0 var(--space-small) var(--space-small) 0; font-family: monospace; } + .multiselect--wrap { margin-bottom: var(--space-normal); + .error-message { color: var(--r-400); font-size: var(--font-size-small); font-weight: var(--font-weight-normal); } + .invalid { ::v-deep { .multiselect__tags { @@ -295,13 +307,16 @@ export default { } } } + ::v-deep { .multiselect { margin-bottom: 0; } + .multiselect__content-wrapper { display: none; } + .multiselect--active .multiselect__tags { border-radius: var(--border-radius-normal); } diff --git a/app/javascript/dashboard/routes/dashboard/settings/attributes/CustomAttribute.vue b/app/javascript/dashboard/routes/dashboard/settings/attributes/CustomAttribute.vue index 5c234ec03..e5e85cdd1 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/attributes/CustomAttribute.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/attributes/CustomAttribute.vue @@ -1,195 +1,141 @@ -