jitsi-meet-electron/app/features/navbar/components/Navbar.js

93 lines
2.1 KiB
JavaScript
Raw Normal View History

2018-06-08 10:51:58 +02:00
// @flow
import Navigation, { AkGlobalItem } from '@atlaskit/navigation';
import React, { Component } from 'react';
import { connect } from 'react-redux';
2018-06-08 10:51:58 +02:00
import { SettingsAction, SettingsDrawer } from '../../settings';
2018-06-08 10:51:58 +02:00
import { isElectronMac } from '../../utils';
import HelpAction from './HelpAction';
2018-06-16 07:59:24 +02:00
import Logo from './Logo';
2018-06-08 10:51:58 +02:00
/**
* Navigation Bar component.
*/
class Navbar extends Component<*> {
2018-06-16 07:59:24 +02:00
/**
* Get the primary icon of Global Navigation.
*
* @returns {ReactElement}
*/
_getPrimaryIcon() {
return <Logo />;
}
/**
* Get the array of Primary actions of Global Navigation.
*
* @returns {ReactElement[]}
*/
_getPrimaryActions() {
return [
<AkGlobalItem key = { 0 }>
<SettingsAction />
</AkGlobalItem>
];
}
2018-06-08 10:51:58 +02:00
/**
* Get the array of Secondary actions of Global Navigation.
2018-06-07 09:47:42 +02:00
*
* @returns {ReactElement[]}
2018-06-08 10:51:58 +02:00
*/
_getSecondaryActions() {
return [
2018-06-07 09:47:42 +02:00
<AkGlobalItem key = { 0 }>
2018-06-08 10:51:58 +02:00
<HelpAction />
</AkGlobalItem>
];
}
/**
* Render function of component.
*
2018-06-07 09:47:42 +02:00
* @returns {ReactElement}
2018-06-08 10:51:58 +02:00
*/
render() {
return (
<Navigation
drawers = { [
<SettingsDrawer
isOpen = { this.props._isSettingsDrawerOpen }
key = { 0 } />
] }
globalPrimaryActions = { this._getPrimaryActions() }
2018-06-16 07:59:24 +02:00
globalPrimaryIcon = { this._getPrimaryIcon() }
2018-06-08 10:51:58 +02:00
globalSecondaryActions = { this._getSecondaryActions() }
isElectronMac = { isElectronMac() }
isOpen = { false }
isResizeable = { false } />
);
}
}
/**
* Maps (parts of) the redux state to the React props.
*
* @param {Object} state - The redux state.
* @returns {{
* _isSettingsDrawerOpen: boolean
* }}
*/
function _mapStateToProps(state: Object) {
return {
_isSettingsDrawerOpen: state.navbar.openDrawer === SettingsDrawer
};
}
export default connect(_mapStateToProps)(Navbar);