-
Notifications
You must be signed in to change notification settings - Fork 62
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-976: Disabled transition for side menu after reload page #1893
IBX-976: Disabled transition for side menu after reload page #1893
Conversation
999dcd6
to
05c7619
Compare
05c7619
to
d51a558
Compare
const expiryDaysInMiliseconds = expiryDays * 24 * 60 * 60 * 1000; | ||
|
||
date.setTime(date.getTime() + expiryDaysInMiliseconds); | ||
doc.cookie = `${name}=${value};expires=${date.toUTCString()};path=${path}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be better to use max-age
instead of expires
?
doc.cookie = `${name}=${value};expires=${date.toUTCString()};path=${path}`; | ||
}; | ||
const getCookie = (name) => { | ||
let cookieName = name + '='; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let cookieName = name + '='; | |
const cookieName = name + '='; |
}; | ||
const getCookie = (name) => { | ||
let cookieName = name + '='; | ||
let decodedCookie = decodeURIComponent(doc.cookie); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let decodedCookie = decodeURIComponent(doc.cookie); | |
const decodedCookie = decodeURIComponent(doc.cookie); |
const getCookie = (name) => { | ||
let cookieName = name + '='; | ||
let decodedCookie = decodeURIComponent(doc.cookie); | ||
let cookiesArray = decodedCookie.split(';'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let cookiesArray = decodedCookie.split(';'); | |
const cookiesArray = decodedCookie.split(';'); |
let cookieValue = null; | ||
|
||
cookiesArray.forEach((cookie) => { | ||
cookie = cookie.trim(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here is a lot of assignment for cookie
which is function param, I don't think this is best practice.
@@ -1,6 +1,11 @@ | |||
{% extends '@ezdesign/ui/menu/main_base.html.twig' %} | |||
|
|||
{% block root %} | |||
{% set resizerWidth = 10 %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should snake not camelCase in twig.
b3ae836
to
a57a240
Compare
const decodedCookie = decodeURIComponent(doc.cookie); | ||
const cookiesArray = decodedCookie.split(';'); | ||
|
||
for (index in cookiesArray) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for ... of
would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe even change it all to .find
const cookieValue = cookiesArray.find((cookie) => {
const cookieString = cookie.trim();
return cookieString.indexOf(cookieName) === 0;
});
return cookieValue ? cookieValue.split('=')[1] : '';
or sth like this
const decodedCookie = decodeURIComponent(doc.cookie); | ||
const cookiesArray = decodedCookie.split(';'); | ||
|
||
for (index in cookiesArray) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe even change it all to .find
const cookieValue = cookiesArray.find((cookie) => {
const cookieString = cookie.trim();
return cookieString.indexOf(cookieName) === 0;
});
return cookieValue ? cookieValue.split('=')[1] : '';
or sth like this
} | ||
} | ||
|
||
return ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that no value should be represented by null
.
doc.cookie = `${name}=${value};max-age=${maxAge};path=${path}`; | ||
}; | ||
const getCookie = (name) => { | ||
const cookieName = name + '='; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: this is actually not a cookie name, but cookie name with equal sign.
Personally, because it is very short and straightforward, I would prefer to remove this and just add `${name}=`
inside cookieString.indexOf
.
@@ -1,4 +1,4 @@ | |||
(function(global, doc, eZ, localStorage) { | |||
(function (global, doc, eZ, localStorage) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(function (global, doc, eZ, localStorage) { | |
(function(global, doc, eZ, localStorage) { |
{% set second_level_manual_resize_min_width = 80 %} | ||
{% set second_level_menu_width = app.request.cookies.get('second_menu_width') %} | ||
{% set second_menu_width_style = '' %} | ||
{% set second_menu_list_widt_style = '' %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
{% set second_menu_list_widt_style = '' %} | |
{% set second_menu_list_width_style = '' %} |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Checklist:
$ composer fix-cs
)