2019-01-30 15:43:57 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { SafeAreaView, Text, View } from 'react-native';
|
|
|
|
import LinearGradient from 'react-native-linear-gradient';
|
|
|
|
|
|
|
|
import { getConferenceName } from '../../../base/conference';
|
2020-07-15 08:22:35 +00:00
|
|
|
import { getFeatureFlag, CONFERENCE_TIMER_ENABLED, MEETING_NAME_ENABLED } from '../../../base/flags';
|
2019-03-21 16:38:29 +00:00
|
|
|
import { connect } from '../../../base/redux';
|
2019-01-30 15:43:57 +00:00
|
|
|
import { PictureInPictureButton } from '../../../mobile/picture-in-picture';
|
2020-07-24 12:14:33 +00:00
|
|
|
import { isToolboxVisible } from '../../../toolbox/functions.native';
|
2020-01-13 17:12:25 +00:00
|
|
|
import ConferenceTimer from '../ConferenceTimer';
|
2020-05-20 10:57:03 +00:00
|
|
|
|
2019-01-30 15:43:57 +00:00
|
|
|
import styles, { NAVBAR_GRADIENT_COLORS } from './styles';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
2020-07-15 08:22:35 +00:00
|
|
|
/**
|
|
|
|
* Whether displaying the current conference timer is enabled or not.
|
|
|
|
*/
|
|
|
|
_conferenceTimerEnabled: boolean,
|
|
|
|
|
2019-01-30 15:43:57 +00:00
|
|
|
/**
|
|
|
|
* Name of the meeting we're currently in.
|
|
|
|
*/
|
|
|
|
_meetingName: string,
|
|
|
|
|
2020-04-29 07:35:18 +00:00
|
|
|
/**
|
|
|
|
* Whether displaying the current meeting name is enabled or not.
|
|
|
|
*/
|
|
|
|
_meetingNameEnabled: boolean,
|
|
|
|
|
2019-01-30 15:43:57 +00:00
|
|
|
/**
|
|
|
|
* True if the navigation bar should be visible.
|
|
|
|
*/
|
|
|
|
_visible: boolean
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements a navigation bar component that is rendered on top of the
|
|
|
|
* conference screen.
|
|
|
|
*/
|
|
|
|
class NavigationBar extends Component<Props> {
|
|
|
|
/**
|
|
|
|
* Implements {@Component#render}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
if (!this.props._visible) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2019-03-20 20:09:23 +00:00
|
|
|
return [
|
|
|
|
<LinearGradient
|
|
|
|
colors = { NAVBAR_GRADIENT_COLORS }
|
|
|
|
key = { 1 }
|
|
|
|
pointerEvents = 'none'
|
|
|
|
style = { styles.gradient }>
|
|
|
|
<SafeAreaView>
|
2019-07-12 13:03:14 +00:00
|
|
|
<View style = { styles.gradientStretchTop } />
|
2019-03-20 20:09:23 +00:00
|
|
|
</SafeAreaView>
|
|
|
|
</LinearGradient>,
|
2019-01-30 15:43:57 +00:00
|
|
|
<View
|
2019-03-20 20:09:23 +00:00
|
|
|
key = { 2 }
|
2019-01-30 15:43:57 +00:00
|
|
|
pointerEvents = 'box-none'
|
2019-03-20 20:09:23 +00:00
|
|
|
style = { styles.navBarWrapper }>
|
|
|
|
<PictureInPictureButton
|
|
|
|
styles = { styles.navBarButton } />
|
|
|
|
<View
|
2019-01-30 15:43:57 +00:00
|
|
|
pointerEvents = 'box-none'
|
2019-03-20 20:09:23 +00:00
|
|
|
style = { styles.roomNameWrapper }>
|
2020-04-29 07:35:18 +00:00
|
|
|
{
|
|
|
|
this.props._meetingNameEnabled
|
|
|
|
&& <Text
|
|
|
|
numberOfLines = { 1 }
|
|
|
|
style = { styles.roomName }>
|
|
|
|
{ this.props._meetingName }
|
|
|
|
</Text>
|
|
|
|
}
|
2020-07-15 08:22:35 +00:00
|
|
|
{
|
|
|
|
this.props._conferenceTimerEnabled && <ConferenceTimer />
|
|
|
|
}
|
2019-03-20 20:09:23 +00:00
|
|
|
</View>
|
2019-01-30 15:43:57 +00:00
|
|
|
</View>
|
2019-03-20 20:09:23 +00:00
|
|
|
];
|
2019-01-30 15:43:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps part of the Redux store to the props of this component.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
2020-04-29 07:35:18 +00:00
|
|
|
* @returns {Props}
|
2019-01-30 15:43:57 +00:00
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
|
|
|
return {
|
2020-07-15 08:22:35 +00:00
|
|
|
_conferenceTimerEnabled: getFeatureFlag(state, CONFERENCE_TIMER_ENABLED, true),
|
2019-05-29 07:53:12 +00:00
|
|
|
_meetingName: getConferenceName(state),
|
2020-04-29 07:35:18 +00:00
|
|
|
_meetingNameEnabled: getFeatureFlag(state, MEETING_NAME_ENABLED, true),
|
2019-01-30 15:43:57 +00:00
|
|
|
_visible: isToolboxVisible(state)
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default connect(_mapStateToProps)(NavigationBar);
|