您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

TitleBar.tsx 4.6KB

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