Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-650: redesign menu #1808

Conversation

lucasOsti
Copy link
Contributor

@lucasOsti lucasOsti commented Jul 14, 2021

@lucasOsti lucasOsti marked this pull request as draft July 15, 2021 08:50
@lucasOsti lucasOsti force-pushed the IBX-650-As-an-Editor-I-want-to-see-the-redesigned-navigation-menu branch from e41465f to 4676046 Compare July 19, 2021 10:09
@lucasOsti lucasOsti marked this pull request as ready for review July 19, 2021 10:10
@lucasOsti lucasOsti marked this pull request as draft July 19, 2021 10:50
@lucasOsti lucasOsti marked this pull request as ready for review July 19, 2021 12:55
@lucasOsti lucasOsti force-pushed the IBX-650-As-an-Editor-I-want-to-see-the-redesigned-navigation-menu branch from 786e29e to f6590a7 Compare July 19, 2021 13:26
return;
}

allPopups.push(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are not using those popups. Why do you keep them in array?

@lucasOsti lucasOsti requested a review from dew326 July 20, 2021 12:14
@lucasOsti lucasOsti force-pushed the IBX-650-As-an-Editor-I-want-to-see-the-redesigned-navigation-menu branch from 614a08b to b67a08c Compare July 21, 2021 10:06
const extraClasses = tooltipNode.dataset.extraClasses || '';
const placement = tooltipNode.dataset.placement || 'bottom';
const extraClass = tooltipNode.dataset.tooltipExtraClass || '';
const placement = tooltipNode.dataset.tooltipPlacement || 'bottom';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const placement = tooltipNode.dataset.tooltipPlacement || 'bottom';
const placement = tooltipNode.dataset.tooltipPlacement ?? 'bottom';

@@ -36,8 +36,8 @@
show: tooltipNode.dataset.delayShow || 150,
hide: tooltipNode.dataset.delayHide || 75,
};
const extraClasses = tooltipNode.dataset.extraClasses || '';
const placement = tooltipNode.dataset.placement || 'bottom';
const extraClass = tooltipNode.dataset.tooltipExtraClass || '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const extraClass = tooltipNode.dataset.tooltipExtraClass || '';
const extraClass = tooltipNode.dataset.tooltipExtraClass ?? '';

@@ -0,0 +1,132 @@
(function(global, doc, localStorage, eZ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(function(global, doc, localStorage, eZ) {
(function(global, doc, eZ, localStorage) {

nitpicking, but so far eZ (if it was used) was always third argument

let resizeStartPositionX = 0;
let secondMenuLevelCurrentWidth = secondLevelMenuNode.getBoundingClientRect().width;
const showSecondLevelMenu = (event) => {
const { toggle } = event.currentTarget.dataset;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imho there's no need to put it into new variable if you use it only in one place (in if, in this case)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you can remove it now ;)

<div class="ibexa-main-header">
<div class="ibexa-main-header__brand-column">
<a class="ibexa-main-header__brand" href="{{ url('ezplatform.dashboard') }}">
<img class="ibexa-main-header__brand-image" src="/bundles/ezplatformadminui/img/ibexa-logo.svg" alt="Ibexa" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm... translation? :D

Also, I'm not sure, don't we have some func for resources path?

{% set current_item = item %}

{% for item in current_item.children %}
{% if matcher.isCurrent(item) and item.children|length == 0%}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{% if matcher.isCurrent(item) and item.children|length == 0%}
{% if matcher.isCurrent(item) and item.children|length == 0 %}

{{ block('linkElement') }}
{% endblock %}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra line

{%- endif -%}

{%- if item.extras.template is defined -%}
{% include(item.extras.template) %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{% include(item.extras.template) %}
{% include(item.extras.template) %}

@lucasOsti lucasOsti force-pushed the IBX-650-As-an-Editor-I-want-to-see-the-redesigned-navigation-menu branch from 9a99a87 to 999f8a9 Compare July 21, 2021 13:20
let resizeStartPositionX = 0;
let secondMenuLevelCurrentWidth = secondLevelMenuNode.getBoundingClientRect().width;
const showSecondLevelMenu = (event) => {
const { toggle } = event.currentTarget.dataset;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you can remove it now ;)

Comment on lines 8 to 12
const triggerElement = userMenuContainer.querySelector('.ibexa-header-user-menu__name');
const popupMenuElement = userMenuContainer.querySelector('.ibexa-popup-menu');
const popupMenu = new eZ.core.PopupMenu({
triggerElement,
popupMenuElement,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const triggerElement = userMenuContainer.querySelector('.ibexa-header-user-menu__name');
const popupMenuElement = userMenuContainer.querySelector('.ibexa-popup-menu');
const popupMenu = new eZ.core.PopupMenu({
triggerElement,
popupMenuElement,
const usernameElement = userMenuContainer.querySelector('.ibexa-header-user-menu__name');
const popupMenuElement = userMenuContainer.querySelector('.ibexa-popup-menu');
const popupMenu = new eZ.core.PopupMenu({
triggerElement: usernameElement,
popupMenuElement,

}

const triggerElement = userMenuContainer.querySelector('.ibexa-header-user-menu__name');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does name from CSS selector refer to? Is it a username?

@@ -0,0 +1,8 @@
@mixin hidden-main-menu-node {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether we really need this as a global mixin, it can be local to .ibexa-main-menu as it is used only there. What do you think?

Comment on lines 30 to 36
if (!localStorage.getItem('secondLevelMenuWidth') || secondLevelMenuNode.classList.contains('ibexa-main-menu__navbar--hidden')) {
return;
}

const { secondLevelMenuWidth } = localStorage;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!localStorage.getItem('secondLevelMenuWidth') || secondLevelMenuNode.classList.contains('ibexa-main-menu__navbar--hidden')) {
return;
}
const { secondLevelMenuWidth } = localStorage;
const savedSecondLevelMenuWidth = localStorage.getItem('secondLevelMenuWidth');
const isSecondLevelMenuHidden = secondLevelMenuNode.classList.contains('ibexa-main-menu__navbar--hidden');
if (!savedSecondLevelMenuWidth || isSecondLevelMenuHidden) {
return;
}

Comment on lines 47 to 49
const newMenuWidth = secondLevelMenuNode.classList.contains('ibexa-main-menu__navbar--collapsed')
? SECOND_LEVEL_EXPANDED_WIDTH
: SECOND_LEVEL_COLLAPSED_WIDTH;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const newMenuWidth = secondLevelMenuNode.classList.contains('ibexa-main-menu__navbar--collapsed')
? SECOND_LEVEL_EXPANDED_WIDTH
: SECOND_LEVEL_COLLAPSED_WIDTH;
const isSecondLevelMenuCollapsed = secondLevelMenuNode.classList.contains('ibexa-main-menu__navbar--collapsed');
const newMenuWidth = isSecondLevelMenuCollapsed ? SECOND_LEVEL_EXPANDED_WIDTH : SECOND_LEVEL_COLLAPSED_WIDTH;

setWidthOfSecondLevelMenu();
};
const fitMenu = () => {
const diff = Math.max(HEADER_HEIGHT - global.scrollY, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO name of this variable is too generic.

Comment on lines 106 to 107
firstLevelMenuNode.querySelector('.ibexa-main-menu__items-list').style.top = `${diff}px`;
firstLevelMenuNode.querySelector('.ibexa-main-menu__items-list').style.height = `${global.innerHeight - diff}px`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
firstLevelMenuNode.querySelector('.ibexa-main-menu__items-list').style.top = `${diff}px`;
firstLevelMenuNode.querySelector('.ibexa-main-menu__items-list').style.height = `${global.innerHeight - diff}px`;
const firstLevelMenuItemsList = firstLevelMenuNode.querySelector('.ibexa-main-menu__items-list');
firstLevelMenuItemsList.style.top = `${diff}px`;
firstLevelMenuItemsList.style.height = `${global.innerHeight - diff}px`;

Comment on lines 10 to 13

&:hover {
cursor: pointer;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Element is clickable all the time, not only on hover.

Suggested change
&:hover {
cursor: pointer;
}
cursor: pointer;

}

const usernameElement = userMenuContainer.querySelector('.ibexa-header-user-menu__name');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const usernameElement = userMenuContainer.querySelector('.ibexa-header-user-menu__name');
const userNameElement = userMenuContainer.querySelector('.ibexa-header-user-menu__name');

@lucasOsti lucasOsti requested a review from dew326 July 22, 2021 13:23
@lucasOsti lucasOsti force-pushed the IBX-650-As-an-Editor-I-want-to-see-the-redesigned-navigation-menu branch from 6b58589 to 706d487 Compare July 23, 2021 08:29
@lserwatka
Copy link
Member

Rebase is required here. Can this be merged once Dashboard is in?

@mnocon
Copy link
Member

mnocon commented Jul 26, 2021

@lserwatka this one requires some changes in Behat tests that I'd like to do before it's merged, I will be working on it soon

@lserwatka
Copy link
Member

@mnocon alright, thank you for clarification 👍

@lucasOsti lucasOsti force-pushed the IBX-650-As-an-Editor-I-want-to-see-the-redesigned-navigation-menu branch from d9cc2a2 to 32d468b Compare July 26, 2021 09:55
@lucasOsti lucasOsti force-pushed the IBX-650-As-an-Editor-I-want-to-see-the-redesigned-navigation-menu branch from 7e45537 to f889b19 Compare July 28, 2021 10:28
@mnocon mnocon force-pushed the IBX-650-As-an-Editor-I-want-to-see-the-redesigned-navigation-menu branch from 0a6ffc4 to 72ae216 Compare July 29, 2021 11:11
@sonarcloud
Copy link

sonarcloud bot commented Jul 29, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 6 Code Smells

No Coverage information No Coverage information
2.1% 2.1% Duplication

@dew326 dew326 merged commit 3e732b0 into ezsystems:master Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants