Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

TitleBar.js 3.7KB

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