Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

TitleBar.tsx 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. import React from 'react';
  2. import { Text, View, ViewStyle } from 'react-native';
  3. import { connect } from 'react-redux';
  4. import { IReduxState } from '../../../app/types';
  5. import { getConferenceName, getConferenceTimestamp } from '../../../base/conference/functions';
  6. import { CONFERENCE_TIMER_ENABLED, MEETING_NAME_ENABLED } from '../../../base/flags/constants';
  7. import { getFeatureFlag } from '../../../base/flags/functions';
  8. import AudioDeviceToggleButton from '../../../mobile/audio-mode/components/AudioDeviceToggleButton';
  9. import PictureInPictureButton from '../../../mobile/picture-in-picture/components/PictureInPictureButton';
  10. import ParticipantsPaneButton from '../../../participants-pane/components/native/ParticipantsPaneButton';
  11. import ToggleCameraButton from '../../../toolbox/components/native/ToggleCameraButton';
  12. import { isToolboxVisible } from '../../../toolbox/functions.native';
  13. import ConferenceTimer from '../ConferenceTimer';
  14. import Labels from './Labels';
  15. import styles from './styles';
  16. interface IProps {
  17. /**
  18. * Whether displaying the current conference timer is enabled or not.
  19. */
  20. _conferenceTimerEnabled: boolean;
  21. /**
  22. * Creates a function to be invoked when the onPress of the touchables are
  23. * triggered.
  24. */
  25. _createOnPress: Function;
  26. /**
  27. * Name of the meeting we're currently in.
  28. */
  29. _meetingName: string;
  30. /**
  31. * Whether displaying the current meeting name is enabled or not.
  32. */
  33. _meetingNameEnabled: boolean;
  34. /**
  35. * True if the navigation bar should be visible.
  36. */
  37. _visible: boolean;
  38. }
  39. /**
  40. * Implements a navigation bar component that is rendered on top of the
  41. * conference screen.
  42. *
  43. * @param {IProps} props - The React props passed to this component.
  44. * @returns {JSX.Element}
  45. */
  46. const TitleBar = (props: IProps) => {
  47. const { _visible } = props;
  48. if (!_visible) {
  49. return null;
  50. }
  51. return (
  52. <View
  53. style = { styles.titleBarWrapper as ViewStyle }>
  54. <View style = { styles.pipButtonContainer as ViewStyle }>
  55. <PictureInPictureButton styles = { styles.pipButton } />
  56. </View>
  57. <View
  58. pointerEvents = 'box-none'
  59. style = { styles.roomNameWrapper as ViewStyle }>
  60. {
  61. props._conferenceTimerEnabled
  62. && <View style = { styles.roomTimerView as ViewStyle }>
  63. <ConferenceTimer textStyle = { styles.roomTimer } />
  64. </View>
  65. }
  66. {
  67. props._meetingNameEnabled
  68. && <View style = { styles.roomNameView as ViewStyle }>
  69. <Text
  70. numberOfLines = { 1 }
  71. style = { styles.roomName }>
  72. { props._meetingName }
  73. </Text>
  74. </View>
  75. }
  76. {/* eslint-disable-next-line react/jsx-no-bind */}
  77. <Labels createOnPress = { props._createOnPress } />
  78. </View>
  79. <View style = { styles.titleBarButtonContainer }>
  80. <ToggleCameraButton styles = { styles.titleBarButton } />
  81. </View>
  82. <View style = { styles.titleBarButtonContainer }>
  83. <AudioDeviceToggleButton styles = { styles.titleBarButton } />
  84. </View>
  85. <View style = { styles.titleBarButtonContainer }>
  86. <ParticipantsPaneButton styles = { styles.titleBarButton } />
  87. </View>
  88. </View>
  89. );
  90. };
  91. /**
  92. * Maps part of the Redux store to the props of this component.
  93. *
  94. * @param {Object} state - The Redux state.
  95. * @returns {IProps}
  96. */
  97. function _mapStateToProps(state: IReduxState) {
  98. const { hideConferenceTimer, hideConferenceSubject } = state['features/base/config'];
  99. const startTimestamp = getConferenceTimestamp(state);
  100. return {
  101. _conferenceTimerEnabled:
  102. Boolean(getFeatureFlag(state, CONFERENCE_TIMER_ENABLED, true) && !hideConferenceTimer && startTimestamp),
  103. _meetingName: getConferenceName(state),
  104. _meetingNameEnabled:
  105. getFeatureFlag(state, MEETING_NAME_ENABLED, true) && !hideConferenceSubject,
  106. _visible: isToolboxVisible(state)
  107. };
  108. }
  109. export default connect(_mapStateToProps)(TitleBar);