// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import AppDispatcher from '../dispatcher/app_dispatcher.jsx'; import Constants from 'utils/constants.jsx'; import {Tooltip, OverlayTrigger} from 'react-bootstrap'; import * as GlobalActions from 'actions/global_actions.jsx'; import {getFlaggedPosts} from 'actions/post_actions.jsx'; import {FormattedMessage} from 'react-intl'; const ActionTypes = Constants.ActionTypes; import React from 'react'; export default class RhsHeaderPost extends React.Component { constructor(props) { super(props); this.handleClose = this.handleClose.bind(this); this.toggleSize = this.toggleSize.bind(this); this.handleBack = this.handleBack.bind(this); this.state = {}; } handleClose(e) { e.preventDefault(); GlobalActions.emitCloseRightHandSide(); this.props.shrink(); } toggleSize(e) { e.preventDefault(); this.props.toggleSize(); } handleBack(e) { e.preventDefault(); if (this.props.fromSearch || this.props.isWebrtc) { AppDispatcher.handleServerAction({ type: ActionTypes.RECEIVED_SEARCH_TERM, term: this.props.fromSearch, do_search: true, is_mention_search: this.props.isMentionSearch }); AppDispatcher.handleServerAction({ type: ActionTypes.RECEIVED_POST_SELECTED, postId: null }); } else if (this.props.fromFlaggedPosts) { getFlaggedPosts(); } } render() { let back; const closeSidebarTooltip = ( ); let backToResultsTooltip; if (this.props.fromSearch) { backToResultsTooltip = ( ); } else if (this.props.fromFlaggedPosts) { backToResultsTooltip = ( ); } else if (this.props.isWebrtc) { backToResultsTooltip = ( ); } const expandSidebarTooltip = ( ); const shrinkSidebarTooltip = ( ); if (this.props.fromSearch || this.props.fromFlaggedPosts || this.props.isWebrtc) { back = ( ); } return (
{back}
); } } RhsHeaderPost.defaultProps = { isMentionSearch: false, fromSearch: '' }; RhsHeaderPost.propTypes = { isMentionSearch: React.PropTypes.bool, isWebrtc: React.PropTypes.bool, fromSearch: React.PropTypes.string, fromFlaggedPosts: React.PropTypes.bool, toggleSize: React.PropTypes.func, shrink: React.PropTypes.func };