You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

functions.web.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // @flow
  2. declare var interfaceConfig: Object;
  3. /**
  4. * Helper for getting the height of the toolbox.
  5. *
  6. * @returns {number} The height of the toolbox.
  7. */
  8. export function getToolboxHeight() {
  9. const toolbox = document.getElementById('new-toolbox');
  10. return (toolbox && toolbox.clientHeight) || 0;
  11. }
  12. /**
  13. * Indicates if a toolbar button is enabled.
  14. *
  15. * @param {string} name - The name of the setting section as defined in
  16. * interface_config.js.
  17. * @returns {boolean} - True to indicate that the given toolbar button
  18. * is enabled, false - otherwise.
  19. */
  20. export function isButtonEnabled(name: string) {
  21. return interfaceConfig.TOOLBAR_BUTTONS.indexOf(name) !== -1;
  22. }
  23. /**
  24. * Indicates if the toolbox is visible or not.
  25. *
  26. * @param {string} state - The state from the Redux store.
  27. * @returns {boolean} - True to indicate that the toolbox is visible, false -
  28. * otherwise.
  29. */
  30. export function isToolboxVisible(state: Object) {
  31. const { iAmSipGateway } = state['features/base/config'];
  32. const {
  33. alwaysVisible,
  34. timeoutID,
  35. visible
  36. } = state['features/toolbox'];
  37. const { audioSettingsVisible, videoSettingsVisible } = state['features/settings'];
  38. return Boolean(!iAmSipGateway && (timeoutID || visible || alwaysVisible
  39. || audioSettingsVisible || videoSettingsVisible));
  40. }