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.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. <PictureInPictureButton
  46. styles = { styles.navBarButton } />
  47. <View
  48. pointerEvents = 'box-none'
  49. style = { styles.roomNameWrapper }>
  50. {
  51. props._meetingNameEnabled
  52. && <View style = { styles.roomNameView }>
  53. <Text
  54. numberOfLines = { 1 }
  55. style = { styles.roomName }>
  56. { props._meetingName }
  57. </Text>
  58. </View>
  59. }
  60. {
  61. props._conferenceTimerEnabled
  62. && <View style = { styles.roomTimerView }>
  63. <ConferenceTimer textStyle = { styles.roomTimer } />
  64. </View>
  65. }
  66. <Labels />
  67. </View>
  68. </View>
  69. );
  70. };
  71. /**
  72. * Maps part of the Redux store to the props of this component.
  73. *
  74. * @param {Object} state - The Redux state.
  75. * @returns {Props}
  76. */
  77. function _mapStateToProps(state) {
  78. const { hideConferenceTimer, hideConferenceSubject } = state['features/base/config'];
  79. return {
  80. _conferenceTimerEnabled:
  81. getFeatureFlag(state, CONFERENCE_TIMER_ENABLED, true) && !hideConferenceTimer,
  82. _meetingName: getConferenceName(state),
  83. _meetingNameEnabled:
  84. getFeatureFlag(state, MEETING_NAME_ENABLED, true) && !hideConferenceSubject,
  85. _visible: isToolboxVisible(state)
  86. };
  87. }
  88. export default connect(_mapStateToProps)(NavigationBar);