From 11fe3f071e590f24299fbb84c1c6c548d78ec9bf Mon Sep 17 00:00:00 2001
From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Date: Tue, 2 Aug 2022 20:03:51 +0530
Subject: [PATCH] feat: Component for listing the portal (#5146)
---
.../dashboard/i18n/locale/en/helpCenter.json | 37 ++-
.../components/HelpCenterLayout.vue | 7 +
.../helpcenter/components/PortalListItem.vue | 301 ++++++++++++++++++
.../components/PortalListItemTable.vue | 148 +++++++++
.../helpcenter/components/PortalPopover.vue | 18 +-
.../components/Sidebar/SidebarHeader.vue | 6 +-
.../stories/PortalListItem.stories.js | 145 +++++++++
.../pages/portals/ListAllPortals.vue | 164 +++++++++-
8 files changed, 815 insertions(+), 11 deletions(-)
create mode 100644 app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalListItem.vue
create mode 100644 app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalListItemTable.vue
create mode 100644 app/javascript/dashboard/routes/dashboard/helpcenter/components/stories/PortalListItem.stories.js
diff --git a/app/javascript/dashboard/i18n/locale/en/helpCenter.json b/app/javascript/dashboard/i18n/locale/en/helpCenter.json
index 3188200a2..6004f4e29 100644
--- a/app/javascript/dashboard/i18n/locale/en/helpCenter.json
+++ b/app/javascript/dashboard/i18n/locale/en/helpCenter.json
@@ -27,16 +27,51 @@
"SAVED": "Draft saved"
},
"PORTAL": {
+ "HEADER": "Portals",
+ "NEW_BUTTON": "New Portal",
"ACTIVE_BADGE": "active",
"CHOOSE_LOCALE_LABEL": "Choose a locale",
"ARTICLES_LABEL": "articles",
"ADD_NEW_LOCALE": "Add a new locale",
"POPOVER": {
"TITLE": "Portals",
- "NEW_PORTAL_LINK": "New Portal",
+ "PORTAL_SETTINGS": "Portal settings",
"SUBTITLE": "You have multiple portals and can have different locales for each portal.",
"CANCEL_BUTTON_LABEL": "Cancel",
"CHOOSE_LOCALE_BUTTON": "Choose Locale"
+ },
+ "PORTAL_SETTINGS": {
+ "LIST_ITEM": {
+ "HEADER": {
+ "COUNT_LABEL": "articles",
+ "ADD": "Add locale",
+ "VISIT": "Visit site",
+ "SETTINGS": "Settings"
+ },
+ "PORTAL_CONFIG": {
+ "TITLE": "Portal Configurations",
+ "ITEMS": {
+ "NAME": "Name",
+ "DOMAIN": "Custom domain",
+ "SLUG": "Slug",
+ "TITLE": "Portal title",
+ "THEME": "Theme color",
+ "SUB_TEXT": "Portal sub text"
+ }
+ },
+ "AVAILABLE_LOCALES": {
+ "TITLE": "Available locales",
+ "TABLE": {
+ "NAME": "Locale name",
+ "CODE": "Locale code",
+ "ARTICLE_COUNT": "No. of articles",
+ "CATEGORIES": "No. of categories",
+ "SWAP": "Swap",
+ "DELETE": "Delete",
+ "DEFAULT_LOCALE": "Default"
+ }
+ }
+ }
}
},
"TABLE": {
diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/components/HelpCenterLayout.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/components/HelpCenterLayout.vue
index 1ba016edd..c7c604646 100644
--- a/app/javascript/dashboard/routes/dashboard/helpcenter/components/HelpCenterLayout.vue
+++ b/app/javascript/dashboard/routes/dashboard/helpcenter/components/HelpCenterLayout.vue
@@ -31,6 +31,7 @@
v-if="showPortalPopover"
:portals="portals"
@close-popover="closePortalPopover"
+ @open-portal-page="openPortalPage"
/>
@@ -339,6 +340,12 @@ export default {
closePortalPopover() {
this.showPortalPopover = false;
},
+ openPortalPage() {
+ this.$router.push({
+ name: 'list_all_portals',
+ });
+ this.showPortalPopover = false;
+ },
},
};
diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalListItem.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalListItem.vue
new file mode 100644
index 000000000..11de14069
--- /dev/null
+++ b/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalListItem.vue
@@ -0,0 +1,301 @@
+
+
+ {{ portal.articles_count }}
+ {{
+ $t(
+ 'HELP_CENTER.PORTAL.PORTAL_SETTINGS.LIST_ITEM.HEADER.COUNT_LABEL'
+ )
+ }}
+ {{ portal.name }}
+
+
+ {{
+ $t(
+ 'HELP_CENTER.PORTAL.PORTAL_SETTINGS.LIST_ITEM.PORTAL_CONFIG.TITLE'
+ )
+ }}
+
+
+ {{
+ $t(
+ 'HELP_CENTER.PORTAL.PORTAL_SETTINGS.LIST_ITEM.AVAILABLE_LOCALES.TITLE'
+ )
+ }}
+
+
+
+
+
+
+
+
+
diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalPopover.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalPopover.vue
index c424eb5de..b6659013f 100644
--- a/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalPopover.vue
+++ b/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalPopover.vue
@@ -5,12 +5,15 @@
+
+
+
+ {{
+ $t(
+ 'HELP_CENTER.PORTAL.PORTAL_SETTINGS.LIST_ITEM.AVAILABLE_LOCALES.TABLE.NAME'
+ )
+ }}
+
+
+ {{
+ $t(
+ 'HELP_CENTER.PORTAL.PORTAL_SETTINGS.LIST_ITEM.AVAILABLE_LOCALES.TABLE.CODE'
+ )
+ }}
+
+
+ {{
+ $t(
+ 'HELP_CENTER.PORTAL.PORTAL_SETTINGS.LIST_ITEM.AVAILABLE_LOCALES.TABLE.ARTICLE_COUNT'
+ )
+ }}
+
+
+ {{
+ $t(
+ 'HELP_CENTER.PORTAL.PORTAL_SETTINGS.LIST_ITEM.AVAILABLE_LOCALES.TABLE.CATEGORIES'
+ )
+ }}
+
+
+
+
+
+
+
+
+
+
+ {{ locale.name }}
+
+
+
+ {{ locale.code }}
+
+
+ {{ locale.articles_count }}
+
+
+ {{ locale.categories_count }}
+
+
+
+
{{ $t('HELP_CENTER.PORTAL.POPOVER.SUBTITLE') }}
@@ -52,6 +55,9 @@ export default {
closePortalPopover() {
this.$emit('close-popover');
},
+ openPortalPage() {
+ this.$emit('open-portal-page');
+ },
},
};
diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/components/Sidebar/SidebarHeader.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/components/Sidebar/SidebarHeader.vue
index dcccab5ca..bf1c36438 100644
--- a/app/javascript/dashboard/routes/dashboard/helpcenter/components/Sidebar/SidebarHeader.vue
+++ b/app/javascript/dashboard/routes/dashboard/helpcenter/components/Sidebar/SidebarHeader.vue
@@ -16,13 +16,13 @@
{{ $t('HELP_CENTER.PORTAL.HEADER') }}
+