// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. // Copyright (c) 2015-2016 Yuya Ochiai import React from 'react'; import PropTypes from 'prop-types'; import {Nav, NavItem} from 'react-bootstrap'; import {Container, Draggable} from 'react-smooth-dnd'; import PlusIcon from 'mdi-react/PlusIcon'; import {GET_CONFIGURATION} from 'common/communication'; export default class TabBar extends React.PureComponent { // need "this" constructor(props) { super(props); this.state = { hasGPOTeams: false, }; } componentDidMount() { window.ipcRenderer.invoke(GET_CONFIGURATION).then((config) => { this.setState({hasGPOTeams: config.registryTeams && config.registryTeams.length > 0}); }); } render() { const orderedTabs = this.props.teams.concat().sort((a, b) => a.order - b.order); const tabs = orderedTabs.map((team) => { const index = this.props.teams.indexOf(team); const sessionExpired = this.props.sessionsExpired[index]; const hasUnreads = this.props.unreadCounts[index]; let mentionCount = 0; if (this.props.mentionCounts[index] > 0) { mentionCount = this.props.mentionCounts[index]; } let badgeDiv; if (sessionExpired) { badgeDiv = (
); } else if (mentionCount !== 0) { badgeDiv = (