From 806e5efd7aa1f73e00a1c88884963d548878dac6 Mon Sep 17 00:00:00 2001 From: Fayaz Ahmed <15716057+fayazara@users.noreply.github.com> Date: Wed, 27 Jul 2022 14:37:55 +0530 Subject: [PATCH] Portals Popover component (#5052) * Portal Switch component * Review fixes * Update storybook props * Review changes * Popover component * Review changes and moved the files to helpcenter folder --- .../Portal/Switch/Switch.stories.js | 68 ------------- .../dashboard/i18n/locale/en/helpCenter.json | 78 +++------------ .../helpcenter/components/PortalPopover.vue | 95 +++++++++++++++++++ .../helpcenter/components/PortalSwitch.vue} | 16 ++-- .../stories/PortalPopover.stories.js | 80 ++++++++++++++++ .../stories/PortalSwitch.stories.js | 58 +++++++++++ 6 files changed, 254 insertions(+), 141 deletions(-) delete mode 100644 app/javascript/dashboard/components/helpCenter/Portal/Switch/Switch.stories.js create mode 100644 app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalPopover.vue rename app/javascript/dashboard/{components/helpCenter/Portal/Switch/Index.vue => routes/dashboard/helpcenter/components/PortalSwitch.vue} (90%) create mode 100644 app/javascript/dashboard/routes/dashboard/helpcenter/components/stories/PortalPopover.stories.js create mode 100644 app/javascript/dashboard/routes/dashboard/helpcenter/components/stories/PortalSwitch.stories.js diff --git a/app/javascript/dashboard/components/helpCenter/Portal/Switch/Switch.stories.js b/app/javascript/dashboard/components/helpCenter/Portal/Switch/Switch.stories.js deleted file mode 100644 index 690eab642..000000000 --- a/app/javascript/dashboard/components/helpCenter/Portal/Switch/Switch.stories.js +++ /dev/null @@ -1,68 +0,0 @@ -import PortalSwitch from './Index.vue'; - -export default { - title: 'Components/Help Center/Portal Switch', - component: PortalSwitch, - argTypes: { - active: { - defaultValue: false, - control: { - type: 'boolean', - }, - }, - }, -}; - -const Template = (args, { argTypes }) => ({ - props: Object.keys(argTypes), - components: { PortalSwitch }, - template: - '{{label}}', -}); - -export const Primary = Template.bind({}); - -Primary.args = { - active: false, - portal: { - id: 1, - color: null, - custom_domain: 'doc', - articles_count: 123, - header_text: null, - homepage_link: null, - name: 'Chatwoot Docs', - page_title: null, - slug: 'first_portal', - archived: false, - config: { - allowed_locales: [ - { - code: 'en', - name: 'English', - articles_count: 123, - }, - { - code: 'fr', - name: 'Français', - articles_count: 123, - }, - { - code: 'de', - name: 'Deutsch', - articles_count: 32, - }, - { - code: 'es', - name: 'Español', - articles_count: 12, - }, - { - code: 'it', - name: 'Italiano', - articles_count: 8, - }, - ], - }, - }, -}; diff --git a/app/javascript/dashboard/i18n/locale/en/helpCenter.json b/app/javascript/dashboard/i18n/locale/en/helpCenter.json index 39ad4067a..e7bb8c4ee 100644 --- a/app/javascript/dashboard/i18n/locale/en/helpCenter.json +++ b/app/javascript/dashboard/i18n/locale/en/helpCenter.json @@ -4,18 +4,7 @@ "FILTER": "Filter by", "SORT": "Sort by", "SETTINGS_BUTTON": "Settings", - "NEW_BUTTON": "New Article", - "DROPDOWN_OPTIONS": { - "PUBLISHED": "Published", - "DRAFT": "Draft", - "ARCHIVED": "Archived" - }, - "TITLES": { - "ALL_ARTICLES": "All Articles", - "MINE": "My Articles", - "DRAFT": "Draft Articles", - "ARCHIVED": "Archived Articles" - } + "NEW_BUTTON": "New Article" }, "EDIT_HEADER": { "PUBLISH_BUTTON": "Publish", @@ -30,60 +19,19 @@ "ACTIVE_BADGE": "active", "CHOOSE_LOCALE_LABEL": "Choose a locale", "ARTICLES_LABEL": "articles", - "ADD_NEW_LOCALE": "Add a new locale" - }, - "TABLE": { - "LOADING_MESSAGE": "Loading articles...", - "404": "No articles matches your search 🔍", - "NO_ARTICLES": "There are no available articles", - "HEADERS": { - "TITLE": "Title", - "CATEGORY": "Category", - "READ_COUNT": "Read count", - "STATUS": "Status", - "LAST_EDITED": "Last edited" - }, - "COLUMNS": { - "BY": "by" - } - }, - "EDIT_ARTICLE": { - "TITLE_PLACEHOLDER": "Article title goes here", - "CONTENT_PLACEHOLDER": "Write your article here" - }, - "SIDEBAR": { - "SEARCH": { - "PLACEHOLDER": "Search for articles" - } - }, - "CATEGORY": { - "ADD": { - "TITLE": "Create a category", - "SUB_TITLE": "The category will be used in the public facing portal to categorize articles.", - "PORTAL": "Portal", - "LOCALE": "Locale", - "NAME": { - "LABEL": "Name", - "PLACEHOLDER": "Category name", - "HELP_TEXT": "The category name will be used in the public facing portal to categorize articles.", - "ERROR": "Name is required" - }, - "SLUG": { - "LABEL": "Slug", - "PLACEHOLDER": "Category slug for urls", - "HELP_TEXT": "app.chatwoot.com/portal/my-portal/en-US/categories/my-slug", - "ERROR": "Slug is required" - }, - "DESCRIPTION": { - "LABEL": "Description", - "PLACEHOLDER": "Give a short description about the category.", - "ERROR": "Description is required" - }, - "BUTTONS": { - "CREATE": "Create category", - "CANCEL": "Cancel" - } + "ADD_NEW_LOCALE": "Add a new locale", + "POPOVER": { + "TITLE": "Portals", + "NEW_PORTAL_LINK": "New Portal", + "SUBTITLE": "You have multiple portals and can have different locales for each portal.", + "CANCEL_BUTTON_LABEL": "Cancel", + "CHOOSE_LOCALE_BUTTON": "Choose Locale" } } + }, + "TABLE": { + "COLUMNS": { + "BY": "by" + } } } diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalPopover.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalPopover.vue new file mode 100644 index 000000000..c563fad95 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalPopover.vue @@ -0,0 +1,95 @@ + + + + + diff --git a/app/javascript/dashboard/components/helpCenter/Portal/Switch/Index.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalSwitch.vue similarity index 90% rename from app/javascript/dashboard/components/helpCenter/Portal/Switch/Index.vue rename to app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalSwitch.vue index 5519e897d..fd29be0d0 100644 --- a/app/javascript/dashboard/components/helpCenter/Portal/Switch/Index.vue +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalSwitch.vue @@ -4,7 +4,7 @@
-

{{ portal.name }}

+

{{ portal.name }}

{{ portal.articles_count }} {{ $t('HELP_CENTER.PORTAL.ARTICLES_LABEL') }} @@ -15,14 +15,11 @@ }}

-

+

{{ $t('HELP_CENTER.PORTAL.CHOOSE_LOCALE_LABEL') }}