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

feat: add remote toggle for livechat and whatsapp #833

Merged

Conversation

henry-deriv
Copy link
Contributor

Changes:

  • ...

Type of change

  • Bug fix
  • New feature
  • Update feature
  • Refactor code
  • Translation to code
  • Translation to crowdin
  • Script configuration
  • Improve performance
  • Style only
  • Dependency update
  • Documentation update
  • Release

@henry-deriv henry-deriv requested a review from a team as a code owner October 24, 2024 03:12
const topbar_whatsapp = getElementById('topbar-whatsapp');
const whatsapp_mobile_drawer = getElementById('whatsapp-mobile-drawer');

if (cs_chat_livechat) {
Copy link
Contributor

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});

@@ -40,7 +41,7 @@ const Header = (() => {
fnc_enter: ['requestFullscreen', 'webkitRequestFullscreen', 'mozRequestFullScreen', 'msRequestFullscreen'],
fnc_exit : ['exitFullscreen', 'webkitExitFullscreen', 'mozCancelFullScreen', 'msExitFullscreen'],
};

Copy link
Contributor

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) {
Copy link
Contributor

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 };
}

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link

Preview Link: https://pr-833.smarttrader-preview.pages.dev

Name Result
Build status Completed ✅
Preview URL Visit Preview
Action URL Visit Action

@ahmadtaimoor-deriv ahmadtaimoor-deriv merged commit 3b88767 into deriv-com:master Nov 1, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants