You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

NavigationBar.js 3.1KB

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