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.

TitleBar.tsx 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import React from 'react';
  2. import { StyleProp, Text, View, ViewStyle } from 'react-native';
  3. import { connect, useSelector } from 'react-redux';
  4. import { IReduxState } from '../../../../app/types';
  5. import { getConferenceName } from '../../../../base/conference/functions';
  6. import { MEETING_NAME_ENABLED } from '../../../../base/flags/constants';
  7. import { getFeatureFlag } from '../../../../base/flags/functions';
  8. import { JitsiRecordingConstants } from '../../../../base/lib-jitsi-meet';
  9. import { getLocalParticipant } from '../../../../base/participants/functions';
  10. import ConnectionIndicator from '../../../../connection-indicator/components/native/ConnectionIndicator';
  11. import RecordingLabel from '../../../../recording/components/native/RecordingLabel';
  12. import VideoQualityLabel from '../../../../video-quality/components/VideoQualityLabel.native';
  13. import styles from './styles';
  14. interface IProps {
  15. /**
  16. * Name of the meeting we're currently in.
  17. */
  18. _meetingName: string;
  19. /**
  20. * Whether displaying the current meeting name is enabled or not.
  21. */
  22. _meetingNameEnabled: boolean;
  23. }
  24. /**
  25. * Implements a navigation bar component that is rendered on top of the
  26. * carmode screen.
  27. *
  28. * @param {IProps} props - The React props passed to this component.
  29. * @returns {JSX.Element}
  30. */
  31. const TitleBar = (props: IProps): JSX.Element => {
  32. const localParticipant = useSelector(getLocalParticipant);
  33. const localParticipantId = localParticipant?.id;
  34. return (
  35. <View
  36. style = { styles.titleBarWrapper as StyleProp<ViewStyle> }>
  37. <View
  38. pointerEvents = 'box-none'
  39. style = { styles.roomNameWrapper as StyleProp<ViewStyle> }>
  40. <View style = { styles.qualityLabelContainer as StyleProp<ViewStyle> }>
  41. <VideoQualityLabel />
  42. </View>
  43. <ConnectionIndicator
  44. iconStyle = { styles.connectionIndicatorIcon }
  45. participantId = { localParticipantId } />
  46. <View style = { styles.headerLabels as StyleProp<ViewStyle> }>
  47. <RecordingLabel mode = { JitsiRecordingConstants.mode.FILE } />
  48. <RecordingLabel mode = { JitsiRecordingConstants.mode.STREAM } />
  49. </View>
  50. {
  51. props._meetingNameEnabled
  52. && <View style = { styles.roomNameView as StyleProp<ViewStyle> }>
  53. <Text
  54. numberOfLines = { 1 }
  55. style = { styles.roomName }>
  56. { props._meetingName }
  57. </Text>
  58. </View>
  59. }
  60. </View>
  61. </View>
  62. );
  63. };
  64. /**
  65. * Maps part of the Redux store to the props of this component.
  66. *
  67. * @param {Object} state - The Redux state.
  68. * @returns {IProps}
  69. */
  70. function _mapStateToProps(state: IReduxState) {
  71. const { hideConferenceSubject } = state['features/base/config'];
  72. return {
  73. _meetingName: getConferenceName(state),
  74. _meetingNameEnabled:
  75. getFeatureFlag(state, MEETING_NAME_ENABLED, true) && !hideConferenceSubject
  76. };
  77. }
  78. export default connect(_mapStateToProps)(TitleBar);