From dfe3a13424668142b972bb3d7c93b64e553777f9 Mon Sep 17 00:00:00 2001 From: Sebin Song Date: Sat, 30 Mar 2024 15:00:15 +1300 Subject: [PATCH] PR for the Step 1 of #1619 (#1899) * add a button for global-dashboard in GroupsList.vue * add GlobalDashboard.vue with boilerplate content * make vue-router work with global-dashboard settings * configure GlobalDashboard.vue to update the content based on the route path * add dummy posts and render them with card UI * use markdown pkg to render the post content * fix for some cypress tests * move the settings data to router.js * move the export back to misc.js * move the settings object to GlobalDashboard.vue file --- frontend/assets/style/_icons.scss | 3 +- .../style/components/_custom-markdowns.scss | 5 +- frontend/controller/router.js | 11 ++ .../global-dashboard/DirectMessages.vue | 14 ++ .../global-dashboard/NewsAndUpdates.vue | 101 +++++++++++++ .../containers/navigation/GroupsList.vue | 36 ++++- .../containers/navigation/Navigation.vue | 140 ++++++++++-------- frontend/views/pages/DesignSystem.vue | 1 + frontend/views/pages/GlobalDashboard.vue | 53 +++++++ frontend/views/utils/convert-to-markdown.js | 2 +- test/cypress/integration/group-chat.spec.js | 6 +- .../integration/group-member-removal.spec.js | 2 +- .../cypress/integration/notifications.spec.js | 2 +- 13 files changed, 305 insertions(+), 71 deletions(-) create mode 100644 frontend/views/containers/global-dashboard/DirectMessages.vue create mode 100644 frontend/views/containers/global-dashboard/NewsAndUpdates.vue create mode 100644 frontend/views/pages/GlobalDashboard.vue diff --git a/frontend/assets/style/_icons.scss b/frontend/assets/style/_icons.scss index 56b36265a7..2a95223e62 100644 --- a/frontend/assets/style/_icons.scss +++ b/frontend/assets/style/_icons.scss @@ -69,7 +69,8 @@ $icons: ( magnifying-minus: "\f010", magnifying-plus: "\f00e", paper-clip: "\f0c6", - file: "\f15c" + file: "\f15c", + newspaper: "\f1ea" ); @font-face { diff --git a/frontend/assets/style/components/_custom-markdowns.scss b/frontend/assets/style/components/_custom-markdowns.scss index 4b57cc4d18..79687e1f7d 100644 --- a/frontend/assets/style/components/_custom-markdowns.scss +++ b/frontend/assets/style/components/_custom-markdowns.scss @@ -77,8 +77,7 @@ } } - a { - color: $primary_0; - text-decoration: underline; + .link { + border-bottom-color: currentColor; } } diff --git a/frontend/controller/router.js b/frontend/controller/router.js index 4828ee60a6..857375470d 100644 --- a/frontend/controller/router.js +++ b/frontend/controller/router.js @@ -18,6 +18,7 @@ const lazyContributions = lazyPage(() => import('@pages/Contributions.vue')) const lazyDesignSystem = lazyPage(() => import('@pages/DesignSystem.vue')) const lazyGroupChat = lazyPage(() => import('@pages/GroupChat.vue')) const lazyGroupDashboard = lazyPage(() => import('@pages/GroupDashboard.vue')) +const lazyGlobalDashboard = lazyPage(() => import('@pages/GlobalDashboard.vue')) const lazyGroupSettings = lazyPage(() => import('@pages/GroupSettings.vue')) const lazyPayments = lazyPage(() => import('@pages/Payments.vue')) const lazyPendingApproval = lazyPage(() => import('@pages/PendingApproval.vue')) @@ -98,6 +99,16 @@ const router: any = new Router({ meta: { title: L('Group Dashboard') }, beforeEnter: createEnterGuards(loginGuard, groupGuard, pendingApprovalGuard) }, + { + path: '/global-dashboard/:id', + component: lazyGlobalDashboard, + name: 'GlobalDashboard', + meta: { title: L('Global Dashboard') }, + beforeEnter: createEnterGuards(loginGuard, groupGuard) + }, + { + path: '/global-dashboard', redirect: '/global-dashboard/news-and-updates' + }, { path: '/contributions', component: lazyContributions, diff --git a/frontend/views/containers/global-dashboard/DirectMessages.vue b/frontend/views/containers/global-dashboard/DirectMessages.vue new file mode 100644 index 0000000000..f6b8c7f74b --- /dev/null +++ b/frontend/views/containers/global-dashboard/DirectMessages.vue @@ -0,0 +1,14 @@ + + + + + diff --git a/frontend/views/containers/global-dashboard/NewsAndUpdates.vue b/frontend/views/containers/global-dashboard/NewsAndUpdates.vue new file mode 100644 index 0000000000..3cab5a7707 --- /dev/null +++ b/frontend/views/containers/global-dashboard/NewsAndUpdates.vue @@ -0,0 +1,101 @@ + + + + + diff --git a/frontend/views/containers/navigation/GroupsList.vue b/frontend/views/containers/navigation/GroupsList.vue index 2846bbf38b..de53f006db 100644 --- a/frontend/views/containers/navigation/GroupsList.vue +++ b/frontend/views/containers/navigation/GroupsList.vue @@ -1,10 +1,20 @@ + + diff --git a/frontend/views/utils/convert-to-markdown.js b/frontend/views/utils/convert-to-markdown.js index 45c8222580..18487bacb7 100644 --- a/frontend/views/utils/convert-to-markdown.js +++ b/frontend/views/utils/convert-to-markdown.js @@ -7,7 +7,7 @@ marked.use({ level: 'inline', renderer (token) { // custom renderer for tag for setting target='_blank' to the output HTML - return `${token.text}` + return `${token.text}` } } ] diff --git a/test/cypress/integration/group-chat.spec.js b/test/cypress/integration/group-chat.spec.js index ebcc08fbd9..5ca594e5e4 100644 --- a/test/cypress/integration/group-chat.spec.js +++ b/test/cypress/integration/group-chat.spec.js @@ -332,18 +332,18 @@ describe('Group Chat Basic Features (Create & Join & Leave & Close)', () => { cy.giCheckIfJoinedChatroom(CHATROOM_GENERAL_NAME, me) // Switch from group2 to group1 on the group chat page - cy.getByDT('groupsList').find('li:first-child button').click() + cy.getByDT('groupsList').find('li:nth-child(2) button').click() cy.giWaitUntilMessagesLoaded() cy.giCheckIfJoinedChatroom(CHATROOM_GENERAL_NAME, user2) switchChannel(channelsOf2For1[0]) // Switch from group1 to group2 on the group chat page - cy.getByDT('groupsList').find('li:nth-child(2) button').click() + cy.getByDT('groupsList').find('li:nth-child(3) button').click() cy.giWaitUntilMessagesLoaded() cy.getByDT('channelName').should('contain', CHATROOM_GENERAL_NAME) // Switch from group2 to group1 on the group chat page - cy.getByDT('groupsList').find('li:first-child button').click() + cy.getByDT('groupsList').find('li:nth-child(2) button').click() cy.giWaitUntilMessagesLoaded() cy.getByDT('channelName').should('contain', channelsOf2For1[0]) }) diff --git a/test/cypress/integration/group-member-removal.spec.js b/test/cypress/integration/group-member-removal.spec.js index 53509fac2f..2c90b6a68b 100644 --- a/test/cypress/integration/group-member-removal.spec.js +++ b/test/cypress/integration/group-member-removal.spec.js @@ -198,7 +198,7 @@ describe('Group - Removing a member', () => { cy.giSwitchUser(`user2-${userId}`) // Change from groupB to groupA dashboard - cy.getByDT('groupsList').find('li:nth-child(1) button').click() + cy.getByDT('groupsList').find('li:nth-child(2) button').click() getProposalItems().eq(0).within(() => { cy.getByDT('typeDescription').should('contain', `Remove userbot-${userId} from the group.`) diff --git a/test/cypress/integration/notifications.spec.js b/test/cypress/integration/notifications.spec.js index 3c45d81ee7..353843d5ac 100644 --- a/test/cypress/integration/notifications.spec.js +++ b/test/cypress/integration/notifications.spec.js @@ -184,7 +184,7 @@ describe('Notifications', () => { cy.giCreateGroup(dreamersGroupName, { bypassUI: true }) cy.giCreateGroup(turtlesGroupName, { bypassUI: true }) // The sidebar should now be visible and have two group buttons and one "+" button. - cy.getByDT('groupsList').find('button').should('have.length', 3) + cy.getByDT('groupsList').find('button').should('have.length', 4) }) it('should not display any red badge yet', () => {