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.

TitleBar.js 4.0KB

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