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.

NavigationBar.js 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 InviteButton from '../../../invite/components/add-people-dialog/native/InviteButton';
  8. import { PictureInPictureButton } from '../../../mobile/picture-in-picture';
  9. import { isToolboxVisible } from '../../../toolbox/functions.native';
  10. import ConferenceTimer from '../ConferenceTimer';
  11. import Labels from './Labels';
  12. import styles from './styles';
  13. type Props = {
  14. /**
  15. * Whether displaying the current conference timer is enabled or not.
  16. */
  17. _conferenceTimerEnabled: boolean,
  18. /**
  19. * Name of the meeting we're currently in.
  20. */
  21. _meetingName: string,
  22. /**
  23. * Whether displaying the current meeting name is enabled or not.
  24. */
  25. _meetingNameEnabled: boolean,
  26. /**
  27. * True if the navigation bar should be visible.
  28. */
  29. _visible: boolean
  30. };
  31. /**
  32. * Implements a navigation bar component that is rendered on top of the
  33. * conference screen.
  34. *
  35. * @param {Props} props - The React props passed to this component.
  36. * @returns {React.Node}
  37. */
  38. const NavigationBar = (props: Props) => {
  39. if (!props._visible) {
  40. return null;
  41. }
  42. return (
  43. <View
  44. pointerEvents = 'box-none'
  45. style = { styles.navBarWrapper }>
  46. <View style = { styles.pipButtonContainer }>
  47. <PictureInPictureButton 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 style = { styles.inviteButtonContainer }>
  71. <InviteButton styles = { styles.inviteButton } />
  72. </View>
  73. </View>
  74. );
  75. };
  76. /**
  77. * Maps part of the Redux store to the props of this component.
  78. *
  79. * @param {Object} state - The Redux state.
  80. * @returns {Props}
  81. */
  82. function _mapStateToProps(state) {
  83. const { hideConferenceTimer, hideConferenceSubject } = state['features/base/config'];
  84. return {
  85. _conferenceTimerEnabled:
  86. getFeatureFlag(state, CONFERENCE_TIMER_ENABLED, true) && !hideConferenceTimer,
  87. _meetingName: getConferenceName(state),
  88. _meetingNameEnabled:
  89. getFeatureFlag(state, MEETING_NAME_ENABLED, true) && !hideConferenceSubject,
  90. _visible: isToolboxVisible(state)
  91. };
  92. }
  93. export default connect(_mapStateToProps)(NavigationBar);