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

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