From 216558125bfdd12fda3a6104315b07ef2f1cd75b Mon Sep 17 00:00:00 2001 From: Davide Negretti Date: Thu, 23 Nov 2023 19:03:03 +0100 Subject: [PATCH] [DURACOM-195] Header, navbar, and sidebar refactoring --- cypress/e2e/collection-statistics.cy.ts | 2 +- cypress/e2e/community-statistics.cy.ts | 2 +- cypress/e2e/homepage-statistics.cy.ts | 2 +- cypress/e2e/item-statistics.cy.ts | 2 +- cypress/e2e/login-modal.cy.ts | 26 +- cypress/e2e/search-navbar.cy.ts | 8 +- .../admin-sidebar-section.component.html | 42 ++-- .../admin-sidebar-section.component.spec.ts | 4 +- .../admin-sidebar-section.component.ts | 8 + .../admin-sidebar.component.html | 98 ++++---- .../admin-sidebar.component.scss | 231 ++++++++++-------- .../admin-sidebar.component.spec.ts | 2 +- .../admin-sidebar/admin-sidebar.component.ts | 20 +- ...dable-admin-sidebar-section.component.html | 56 +++-- ...dable-admin-sidebar-section.component.scss | 37 +-- ...le-admin-sidebar-section.component.spec.ts | 4 +- ...andable-admin-sidebar-section.component.ts | 30 ++- .../themed-admin-sidebar.component.ts | 16 +- .../expandable-navbar-section.component.html | 46 ++-- .../expandable-navbar-section.component.scss | 55 ++--- ...xpandable-navbar-section.component.spec.ts | 96 +++++--- .../expandable-navbar-section.component.ts | 79 ++++-- .../navbar-section.component.html | 6 +- .../navbar-section.component.scss | 8 +- src/app/navbar/navbar.component.html | 35 +-- src/app/navbar/navbar.component.scss | 24 +- src/app/root/root.component.html | 8 +- src/app/root/root.component.ts | 46 ++-- src/app/shared/animations/slide.ts | 50 ++-- .../auth-nav-menu.component.html | 64 +++-- .../auth-nav-menu.component.scss | 4 +- .../auth-nav-menu.component.spec.ts | 38 ++- .../auth-nav-menu/auth-nav-menu.component.ts | 4 +- .../user-menu/user-menu.component.html | 37 ++- .../user-menu/user-menu.component.scss | 12 + .../user-menu/user-menu.component.spec.ts | 4 +- .../lang-switch/lang-switch.component.html | 7 +- .../password/log-in-password.component.html | 4 +- .../external-link-menu-item.component.html | 3 +- .../external-link-menu-item.component.ts | 3 +- .../menu-item/link-menu-item.component.html | 5 +- .../menu-item/link-menu-item.component.ts | 3 +- .../menu/menu-item/menu-item.component.scss | 5 + .../onclick-menu-item.component.html | 6 +- .../onclick-menu-item.component.spec.ts | 2 +- .../menu-item/onclick-menu-item.component.ts | 2 +- .../menu-item/text-menu-item.component.html | 2 +- .../menu-item/text-menu-item.component.ts | 1 + .../testing/host-window-service.stub.ts | 5 + src/app/shared/testing/menu-service.stub.ts | 3 + .../system-wide-alert-banner.component.html | 2 +- src/assets/i18n/en.json5 | 4 + src/styles/_bootstrap_variables.scss | 3 - src/styles/_custom_variables.scss | 14 +- src/styles/_global-styles.scss | 5 - src/styles/_mixins.scss | 2 +- .../header-navbar-wrapper.component.html | 8 +- .../header-navbar-wrapper.component.scss | 90 ++++++- .../header-navbar-wrapper.component.ts | 2 + .../dspace/app/header/header.component.html | 45 ++-- .../dspace/app/header/header.component.scss | 29 +-- .../dspace/app/header/header.component.ts | 11 +- .../dspace/app/navbar/navbar.component.html | 35 +-- .../dspace/app/navbar/navbar.component.scss | 64 +---- .../styles/_theme_css_variable_overrides.scss | 20 +- 65 files changed, 901 insertions(+), 690 deletions(-) create mode 100644 src/app/shared/menu/menu-item/menu-item.component.scss diff --git a/cypress/e2e/collection-statistics.cy.ts b/cypress/e2e/collection-statistics.cy.ts index 6df4e9a4542..2a013fe0ce2 100644 --- a/cypress/e2e/collection-statistics.cy.ts +++ b/cypress/e2e/collection-statistics.cy.ts @@ -6,7 +6,7 @@ describe('Collection Statistics Page', () => { it('should load if you click on "Statistics" from a Collection page', () => { cy.visit('/collections/'.concat(TEST_COLLECTION)); - cy.get('ds-navbar ds-link-menu-item a[title="Statistics"]').click(); + cy.get('ds-navbar ds-link-menu-item a[data-test="link-menu-item.menu.section.statistics"]').click(); cy.location('pathname').should('eq', COLLECTIONSTATISTICSPAGE); }); diff --git a/cypress/e2e/community-statistics.cy.ts b/cypress/e2e/community-statistics.cy.ts index 710450e7972..f9848f51000 100644 --- a/cypress/e2e/community-statistics.cy.ts +++ b/cypress/e2e/community-statistics.cy.ts @@ -6,7 +6,7 @@ describe('Community Statistics Page', () => { it('should load if you click on "Statistics" from a Community page', () => { cy.visit('/communities/'.concat(TEST_COMMUNITY)); - cy.get('ds-navbar ds-link-menu-item a[title="Statistics"]').click(); + cy.get('ds-navbar ds-link-menu-item a[data-test="link-menu-item.menu.section.statistics"]').click(); cy.location('pathname').should('eq', COMMUNITYSTATISTICSPAGE); }); diff --git a/cypress/e2e/homepage-statistics.cy.ts b/cypress/e2e/homepage-statistics.cy.ts index 2a1ab9785ab..46ad8f1ed20 100644 --- a/cypress/e2e/homepage-statistics.cy.ts +++ b/cypress/e2e/homepage-statistics.cy.ts @@ -5,7 +5,7 @@ import '../support/commands'; describe('Site Statistics Page', () => { it('should load if you click on "Statistics" from homepage', () => { cy.visit('/'); - cy.get('ds-navbar ds-link-menu-item a[title="Statistics"]').click(); + cy.get('ds-navbar ds-link-menu-item a[data-test="link-menu-item.menu.section.statistics"]').click(); cy.location('pathname').should('eq', '/statistics'); }); diff --git a/cypress/e2e/item-statistics.cy.ts b/cypress/e2e/item-statistics.cy.ts index 9b90cb24afc..78884081f0d 100644 --- a/cypress/e2e/item-statistics.cy.ts +++ b/cypress/e2e/item-statistics.cy.ts @@ -6,7 +6,7 @@ describe('Item Statistics Page', () => { it('should load if you click on "Statistics" from an Item/Entity page', () => { cy.visit('/entities/publication/'.concat(TEST_ENTITY_PUBLICATION)); - cy.get('ds-navbar ds-link-menu-item a[title="Statistics"]').click(); + cy.get('ds-navbar ds-link-menu-item a[data-test="link-menu-item.menu.section.statistics"]').click(); cy.location('pathname').should('eq', ITEMSTATISTICSPAGE); }); diff --git a/cypress/e2e/login-modal.cy.ts b/cypress/e2e/login-modal.cy.ts index d29c13c2f96..13f7bc5c01c 100644 --- a/cypress/e2e/login-modal.cy.ts +++ b/cypress/e2e/login-modal.cy.ts @@ -4,31 +4,31 @@ import { testA11y } from 'cypress/support/utils'; const page = { openLoginMenu() { // Click the "Log In" dropdown menu in header - cy.get('ds-themed-navbar [data-test="login-menu"]').click(); + cy.get('ds-themed-header [data-test="login-menu"]').click(); }, openUserMenu() { // Once logged in, click the User menu in header - cy.get('ds-themed-navbar [data-test="user-menu"]').click(); + cy.get('ds-themed-header [data-test="user-menu"]').click(); }, submitLoginAndPasswordByPressingButton(email, password) { // Enter email - cy.get('ds-themed-navbar [data-test="email"]').type(email); + cy.get('ds-themed-header [data-test="email"]').type(email); // Enter password - cy.get('ds-themed-navbar [data-test="password"]').type(password); + cy.get('ds-themed-header [data-test="password"]').type(password); // Click login button - cy.get('ds-themed-navbar [data-test="login-button"]').click(); + cy.get('ds-themed-header [data-test="login-button"]').click(); }, submitLoginAndPasswordByPressingEnter(email, password) { // In opened Login modal, fill out email & password, then click Enter - cy.get('ds-themed-navbar [data-test="email"]').type(email); - cy.get('ds-themed-navbar [data-test="password"]').type(password); - cy.get('ds-themed-navbar [data-test="password"]').type('{enter}'); + cy.get('ds-themed-header [data-test="email"]').type(email); + cy.get('ds-themed-header [data-test="password"]').type(password); + cy.get('ds-themed-header [data-test="password"]').type('{enter}'); }, submitLogoutByPressingButton() { // This is the POST command that will actually log us out cy.intercept('POST', '/server/api/authn/logout').as('logout'); // Click logout button - cy.get('ds-themed-navbar [data-test="logout-button"]').click(); + cy.get('ds-themed-header [data-test="logout-button"]').click(); // Wait until above POST command responds before continuing // (This ensures next action waits until logout completes) cy.wait('@logout'); @@ -103,10 +103,10 @@ describe('Login Modal', () => { page.openLoginMenu(); // Registration link should be visible - cy.get('ds-themed-navbar [data-test="register"]').should('be.visible'); + cy.get('ds-themed-header [data-test="register"]').should('be.visible'); // Click registration link & you should go to registration page - cy.get('ds-themed-navbar [data-test="register"]').click(); + cy.get('ds-themed-header [data-test="register"]').click(); cy.location('pathname').should('eq', '/register'); cy.get('ds-register-email').should('exist'); }); @@ -117,10 +117,10 @@ describe('Login Modal', () => { page.openLoginMenu(); // Forgot password link should be visible - cy.get('ds-themed-navbar [data-test="forgot"]').should('be.visible'); + cy.get('ds-themed-header [data-test="forgot"]').should('be.visible'); // Click link & you should go to Forgot Password page - cy.get('ds-themed-navbar [data-test="forgot"]').click(); + cy.get('ds-themed-header [data-test="forgot"]').click(); cy.location('pathname').should('eq', '/forgot'); cy.get('ds-forgot-email').should('exist'); }); diff --git a/cypress/e2e/search-navbar.cy.ts b/cypress/e2e/search-navbar.cy.ts index 648db17fe65..0e2983e7903 100644 --- a/cypress/e2e/search-navbar.cy.ts +++ b/cypress/e2e/search-navbar.cy.ts @@ -3,15 +3,15 @@ import { TEST_SEARCH_TERM } from 'cypress/support/e2e'; const page = { fillOutQueryInNavBar(query) { // Click the magnifying glass - cy.get('ds-themed-navbar [data-test="header-search-icon"]').click(); + cy.get('ds-themed-header [data-test="header-search-icon"]').click(); // Fill out a query in input that appears - cy.get('ds-themed-navbar [data-test="header-search-box"]').type(query); + cy.get('ds-themed-header [data-test="header-search-box"]').type(query); }, submitQueryByPressingEnter() { - cy.get('ds-themed-navbar [data-test="header-search-box"]').type('{enter}'); + cy.get('ds-themed-header [data-test="header-search-box"]').type('{enter}'); }, submitQueryByPressingIcon() { - cy.get('ds-themed-navbar [data-test="header-search-icon"]').click(); + cy.get('ds-themed-header [data-test="header-search-icon"]').click(); } }; diff --git a/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.html b/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.html index 7f1e8716ba5..f0f7a49573e 100644 --- a/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.html +++ b/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.html @@ -1,23 +1,21 @@ -