-
Notifications
You must be signed in to change notification settings - Fork 61
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
feat: add remote toggle for livechat and whatsapp #833
feat: add remote toggle for livechat and whatsapp #833
Conversation
…livechat-feature-toggle
…livechat-feature-toggle
src/javascript/app/base/header.js
Outdated
const topbar_whatsapp = getElementById('topbar-whatsapp'); | ||
const whatsapp_mobile_drawer = getElementById('whatsapp-mobile-drawer'); | ||
|
||
if (cs_chat_livechat) { |
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 this part can be improved, as the logic with applying inline-flex and none is similar.
Something like this:
const updateVisibility = ({condition, element_1, element_2}) => {
const display_type= condition ? 'inline-flex' : 'none';
element_1.style.display = display_type;
element_2.style.display = display_type;
}
updateVisibility({condition: cs_chat_livechat, element_1: mobile_menu_livechat, element_2: livechat});
updateVisibility({condition: cs_chat_whatsapp, element_1: topbar_whatsapp, element_2: whatsapp_mobile_drawer});
src/javascript/app/base/header.js
Outdated
@@ -40,7 +41,7 @@ const Header = (() => { | |||
fnc_enter: ['requestFullscreen', 'webkitRequestFullscreen', 'mozRequestFullScreen', 'msRequestFullscreen'], | |||
fnc_exit : ['exitFullscreen', 'webkitExitFullscreen', 'mozCancelFullScreen', 'msExitFullscreen'], | |||
}; | |||
|
|||
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.
Nit: empty space
|
||
const getRemoteConfig = async (enabled = false) => { | ||
isEnabled = enabled; | ||
if (isEnabled) { |
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.
Not sure, but will it work?
const getRemoteConfig = async (enabled = false) => {
if (enabled) await fetchAndUpdateData();
return { data };
}
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.
can but i still have to update isEnabled. hence was using isEnabled.
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.
aaa, okay, got it, then ignore me comment please
Preview Link: https://pr-833.smarttrader-preview.pages.dev
|
Changes:
Type of change