Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

functions.ts 912B

1234567891011121314151617181920
  1. import { IStateful } from '../app/types';
  2. import { isMobileBrowser } from '../environment/utils';
  3. import { toState } from '../redux/functions';
  4. import { SMALL_DESKTOP_WIDTH } from './constants';
  5. /**
  6. * Determines if the screen is narrow with the chat panel open. If the function returns true video quality label,
  7. * filmstrip, etc will be hidden.
  8. *
  9. * @param {IStateful} stateful - The stateful object representing the application state.
  10. * @returns {boolean} - True if the screen is narrow with the chat panel open, otherwise `false`.
  11. */
  12. export function isNarrowScreenWithChatOpen(stateful: IStateful) {
  13. const state = toState(stateful);
  14. const isDesktopBrowser = !isMobileBrowser();
  15. const { isOpen, width } = state['features/chat'];
  16. const { clientWidth } = state['features/base/responsive-ui'];
  17. return isDesktopBrowser && isOpen && (width?.current + SMALL_DESKTOP_WIDTH) > clientWidth;
  18. }