2021-01-27 05:30:55 -05:00
|
|
|
import React from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
import MenuButton from './menu-button'
|
|
|
|
import CobrandingLogo from './cobranding-logo'
|
|
|
|
import BackToProjectsButton from './back-to-projects-button'
|
2021-02-09 10:37:48 -05:00
|
|
|
import ChatToggleButton from './chat-toggle-button'
|
2021-02-10 05:57:25 -05:00
|
|
|
import OnlineUsersWidget from './online-users-widget'
|
2021-02-23 05:17:41 -05:00
|
|
|
import TrackChangesToggleButton from './track-changes-toggle-button'
|
|
|
|
import HistoryToggleButton from './history-toggle-button'
|
2021-01-27 05:30:55 -05:00
|
|
|
|
2021-02-09 10:37:48 -05:00
|
|
|
function ToolbarHeader({
|
|
|
|
cobranding,
|
|
|
|
onShowLeftMenuClick,
|
|
|
|
chatIsOpen,
|
|
|
|
toggleChatOpen,
|
2021-02-23 05:17:41 -05:00
|
|
|
reviewPanelOpen,
|
|
|
|
toggleReviewPanelOpen,
|
|
|
|
historyIsOpen,
|
|
|
|
toggleHistoryOpen,
|
2021-02-10 05:57:25 -05:00
|
|
|
unreadMessageCount,
|
|
|
|
onlineUsers,
|
2021-02-23 05:17:41 -05:00
|
|
|
goToUser,
|
|
|
|
isRestrictedTokenMember
|
2021-02-09 10:37:48 -05:00
|
|
|
}) {
|
2021-01-27 05:30:55 -05:00
|
|
|
return (
|
|
|
|
<header className="toolbar toolbar-header toolbar-with-labels">
|
|
|
|
<div className="toolbar-left">
|
|
|
|
<MenuButton onClick={onShowLeftMenuClick} />
|
|
|
|
{cobranding ? <CobrandingLogo {...cobranding} /> : null}
|
|
|
|
<BackToProjectsButton />
|
|
|
|
</div>
|
2021-02-09 10:37:48 -05:00
|
|
|
<div className="toolbar-right">
|
2021-02-10 05:57:25 -05:00
|
|
|
<OnlineUsersWidget onlineUsers={onlineUsers} goToUser={goToUser} />
|
2021-02-23 05:17:41 -05:00
|
|
|
{!isRestrictedTokenMember && (
|
|
|
|
<>
|
|
|
|
<TrackChangesToggleButton
|
|
|
|
onClick={toggleReviewPanelOpen}
|
|
|
|
disabled={historyIsOpen}
|
|
|
|
trackChangesIsOpen={reviewPanelOpen}
|
|
|
|
/>
|
|
|
|
<HistoryToggleButton
|
|
|
|
historyIsOpen={historyIsOpen}
|
|
|
|
onClick={toggleHistoryOpen}
|
|
|
|
/>
|
|
|
|
<ChatToggleButton
|
|
|
|
chatIsOpen={chatIsOpen}
|
|
|
|
onClick={toggleChatOpen}
|
|
|
|
unreadMessageCount={unreadMessageCount}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
)}
|
2021-02-09 10:37:48 -05:00
|
|
|
</div>
|
2021-01-27 05:30:55 -05:00
|
|
|
</header>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
ToolbarHeader.propTypes = {
|
|
|
|
onShowLeftMenuClick: PropTypes.func.isRequired,
|
2021-02-09 10:37:48 -05:00
|
|
|
cobranding: PropTypes.object,
|
|
|
|
chatIsOpen: PropTypes.bool,
|
|
|
|
toggleChatOpen: PropTypes.func.isRequired,
|
2021-02-23 05:17:41 -05:00
|
|
|
reviewPanelOpen: PropTypes.bool,
|
|
|
|
toggleReviewPanelOpen: PropTypes.func.isRequired,
|
|
|
|
historyIsOpen: PropTypes.bool,
|
|
|
|
toggleHistoryOpen: PropTypes.func.isRequired,
|
2021-02-10 05:57:25 -05:00
|
|
|
unreadMessageCount: PropTypes.number.isRequired,
|
|
|
|
onlineUsers: PropTypes.array.isRequired,
|
2021-02-23 05:17:41 -05:00
|
|
|
goToUser: PropTypes.func.isRequired,
|
|
|
|
isRestrictedTokenMember: PropTypes.bool
|
2021-01-27 05:30:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
export default ToolbarHeader
|