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.js 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // @flow
  2. import React from 'react';
  3. import { Text, View } from 'react-native';
  4. import { getConferenceName, getConferenceTimestamp } from '../../../base/conference/functions';
  5. import { getFeatureFlag, CONFERENCE_TIMER_ENABLED, MEETING_NAME_ENABLED } from '../../../base/flags';
  6. import { connect } from '../../../base/redux';
  7. import InviteButton from '../../../invite/components/add-people-dialog/native/InviteButton';
  8. import AudioDeviceToggleButton from '../../../mobile/audio-mode/components/AudioDeviceToggleButton';
  9. import { PictureInPictureButton } from '../../../mobile/picture-in-picture';
  10. import ToggleCameraButton
  11. 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. type Props = {
  17. /**
  18. * Creates a function to be invoked when the onPress of the touchables are
  19. * triggered.
  20. */
  21. _createOnPress: Function,
  22. /**
  23. * Whether displaying the current conference timer is enabled or not.
  24. */
  25. _conferenceTimerEnabled: boolean,
  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 {Props} props - The React props passed to this component.
  44. * @returns {React.Node}
  45. */
  46. const TitleBar = (props: Props) => (<>
  47. {props._visible && <View
  48. pointerEvents = 'box-none'
  49. style = { styles.titleBarWrapper }>
  50. <View style = { styles.pipButtonContainer }>
  51. <PictureInPictureButton styles = { styles.pipButton } />
  52. </View>
  53. <View
  54. pointerEvents = 'box-none'
  55. style = { styles.roomNameWrapper }>
  56. {
  57. props._conferenceTimerEnabled
  58. && <View style = { styles.roomTimerView }>
  59. <ConferenceTimer textStyle = { styles.roomTimer } />
  60. </View>
  61. }
  62. {
  63. props._meetingNameEnabled
  64. && <View style = { styles.roomNameView }>
  65. <Text
  66. numberOfLines = { 1 }
  67. style = { styles.roomName }>
  68. { props._meetingName }
  69. </Text>
  70. </View>
  71. }
  72. {/* eslint-disable-next-line react/jsx-no-bind */}
  73. <Labels createOnPress = { props._createOnPress } />
  74. </View>
  75. <View style = { styles.titleBarButtonContainer }>
  76. <ToggleCameraButton styles = { styles.titleBarButton } />
  77. </View>
  78. <View style = { styles.titleBarButtonContainer }>
  79. <AudioDeviceToggleButton styles = { styles.titleBarButton } />
  80. </View>
  81. <View style = { styles.titleBarButtonContainer }>
  82. <InviteButton styles = { styles.titleBarButton } />
  83. </View>
  84. </View>}
  85. </>);
  86. /**
  87. * Maps part of the Redux store to the props of this component.
  88. *
  89. * @param {Object} state - The Redux state.
  90. * @returns {Props}
  91. */
  92. function _mapStateToProps(state) {
  93. const { hideConferenceTimer, hideConferenceSubject } = state['features/base/config'];
  94. const startTimestamp = getConferenceTimestamp(state);
  95. return {
  96. _conferenceTimerEnabled:
  97. Boolean(getFeatureFlag(state, CONFERENCE_TIMER_ENABLED, true) && !hideConferenceTimer && startTimestamp),
  98. _meetingName: getConferenceName(state),
  99. _meetingNameEnabled:
  100. getFeatureFlag(state, MEETING_NAME_ENABLED, true) && !hideConferenceSubject,
  101. _visible: isToolboxVisible(state)
  102. };
  103. }
  104. export default connect(_mapStateToProps)(TitleBar);