From b9d888d8ab4a827f8a5d21280f26551916e28909 Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Tue, 26 Nov 2024 09:29:04 +0530 Subject: [PATCH] feat: Add contact header components (#10498) --- .../Contacts/ContactsHeader/ContactHeader.vue | 97 ++++++++++++ .../components/ContactMoreActions.vue | 62 ++++++++ .../components/ContactSortMenu.vue | 138 ++++++++++++++++++ .../story/ContactHeader.story.vue | 106 ++++++++++++++ .../dashboard/i18n/locale/en/contact.json | 56 +++++++ app/javascript/histoire.setup.ts | 2 + 6 files changed, 461 insertions(+) create mode 100644 app/javascript/dashboard/components-next/Contacts/ContactsHeader/ContactHeader.vue create mode 100644 app/javascript/dashboard/components-next/Contacts/ContactsHeader/components/ContactMoreActions.vue create mode 100644 app/javascript/dashboard/components-next/Contacts/ContactsHeader/components/ContactSortMenu.vue create mode 100644 app/javascript/dashboard/components-next/Contacts/ContactsHeader/story/ContactHeader.story.vue diff --git a/app/javascript/dashboard/components-next/Contacts/ContactsHeader/ContactHeader.vue b/app/javascript/dashboard/components-next/Contacts/ContactsHeader/ContactHeader.vue new file mode 100644 index 000000000..c9dad651b --- /dev/null +++ b/app/javascript/dashboard/components-next/Contacts/ContactsHeader/ContactHeader.vue @@ -0,0 +1,97 @@ + + + + + + + {{ headerTitle }} + + + + + + + + + + + + + + + + + + + + diff --git a/app/javascript/dashboard/components-next/Contacts/ContactsHeader/components/ContactMoreActions.vue b/app/javascript/dashboard/components-next/Contacts/ContactsHeader/components/ContactMoreActions.vue new file mode 100644 index 000000000..c37a7854c --- /dev/null +++ b/app/javascript/dashboard/components-next/Contacts/ContactsHeader/components/ContactMoreActions.vue @@ -0,0 +1,62 @@ + + + + + + + + diff --git a/app/javascript/dashboard/components-next/Contacts/ContactsHeader/components/ContactSortMenu.vue b/app/javascript/dashboard/components-next/Contacts/ContactsHeader/components/ContactSortMenu.vue new file mode 100644 index 000000000..edf4bd70f --- /dev/null +++ b/app/javascript/dashboard/components-next/Contacts/ContactsHeader/components/ContactSortMenu.vue @@ -0,0 +1,138 @@ + + + + + + + + + {{ t('CONTACTS_LAYOUT.HEADER.ACTIONS.SORT_BY.LABEL') }} + + + + + + {{ t('CONTACTS_LAYOUT.HEADER.ACTIONS.ORDER.LABEL') }} + + + + + + diff --git a/app/javascript/dashboard/components-next/Contacts/ContactsHeader/story/ContactHeader.story.vue b/app/javascript/dashboard/components-next/Contacts/ContactsHeader/story/ContactHeader.story.vue new file mode 100644 index 000000000..a89aa724c --- /dev/null +++ b/app/javascript/dashboard/components-next/Contacts/ContactsHeader/story/ContactHeader.story.vue @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/javascript/dashboard/i18n/locale/en/contact.json b/app/javascript/dashboard/i18n/locale/en/contact.json index defc28e67..9a33b1f99 100644 --- a/app/javascript/dashboard/i18n/locale/en/contact.json +++ b/app/javascript/dashboard/i18n/locale/en/contact.json @@ -388,6 +388,62 @@ }, "CONTACTS_LAYOUT": { + "HEADER": { + "TITLE": "Contacts", + "SEARCH_TITLE": "Search contacts", + "SEARCH_PLACEHOLDER": "Search...", + "MESSAGE_BUTTON": "Message", + "BREADCRUMB": { + "CONTACTS": "Contacts" + }, + "ACTIONS": { + "CONTACT_CREATION": { + "ADD_CONTACT": "Add contact", + "EXPORT_CONTACT": "Export contacts", + "IMPORT_CONTACT": "Import contacts", + "SAVE_CONTACT": "Save contact" + }, + "IMPORT_CONTACT": { + "TITLE": "Import contacts", + "DESCRIPTION": "Import contacts through a CSV file.", + "DOWNLOAD_LABEL": "Download a sample csv.", + "LABEL": "CSV File:", + "CHOOSE_FILE": "Choose file", + "CHANGE": "Change", + "CANCEL": "Cancel", + "IMPORT": "Import", + "SUCCESS_MESSAGE": "You will be notified via email when the import is complete.", + "ERROR_MESSAGE": "There was an error, please try again" + }, + "EXPORT_CONTACT": { + "TITLE": "Export contacts", + "DESCRIPTION": "Quickly export a csv file with comprehensive details of your contacts", + "CONFIRM": "Export", + "SUCCESS_MESSAGE": "Export is in progress. You will be notified on email when the export file is ready to download.", + "ERROR_MESSAGE": "There was an error, please try again" + }, + "SORT_BY": { + "LABEL": "Sort by", + "OPTIONS": { + "NAME": "Name", + "EMAIL": "Email", + "PHONE_NUMBER": "Phone number", + "COMPANY": "Company", + "COUNTRY": "Country", + "CITY": "City", + "LAST_ACTIVITY": "Last activity", + "CREATED_AT": "Created at" + } + }, + "ORDER": { + "LABEL": "Ordering", + "OPTIONS": { + "ASCENDING": "Ascending", + "DESCENDING": "Descending" + } + } + } + }, "CARD": { "OF": "of", "VIEW_DETAILS": "View details", diff --git a/app/javascript/histoire.setup.ts b/app/javascript/histoire.setup.ts index 6b7358d59..8ea1a31c2 100644 --- a/app/javascript/histoire.setup.ts +++ b/app/javascript/histoire.setup.ts @@ -6,6 +6,7 @@ import { vResizeObserver } from '@vueuse/components'; import store from 'dashboard/store'; import VueDOMPurifyHTML from 'vue-dompurify-html'; import { domPurifyConfig } from 'shared/helpers/HTMLSanitizer.js'; +import { directive as onClickaway } from 'vue3-click-away'; const i18n = createI18n({ legacy: false, // https://github.com/intlify/vue-i18n/issues/1902 @@ -18,4 +19,5 @@ export const setupVue3 = defineSetupVue3(({ app }) => { app.use(i18n); app.directive('resize', vResizeObserver); app.use(VueDOMPurifyHTML, domPurifyConfig); + app.directive('on-clickaway', onClickaway); });