mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-01 22:19:57 -05:00
d55e46d3c0
[ReactNavToolbar] Track changes and History toggle buttons. GitOrigin-RevId: a67a9a488c0960dba3f3d374cde4db0080ed2952
72 lines
2.2 KiB
JavaScript
72 lines
2.2 KiB
JavaScript
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'
|
|
import ChatToggleButton from './chat-toggle-button'
|
|
import OnlineUsersWidget from './online-users-widget'
|
|
import TrackChangesToggleButton from './track-changes-toggle-button'
|
|
import HistoryToggleButton from './history-toggle-button'
|
|
|
|
function ToolbarHeader({
|
|
cobranding,
|
|
onShowLeftMenuClick,
|
|
chatIsOpen,
|
|
toggleChatOpen,
|
|
reviewPanelOpen,
|
|
toggleReviewPanelOpen,
|
|
historyIsOpen,
|
|
toggleHistoryOpen,
|
|
unreadMessageCount,
|
|
onlineUsers,
|
|
goToUser,
|
|
isRestrictedTokenMember
|
|
}) {
|
|
return (
|
|
<header className="toolbar toolbar-header toolbar-with-labels">
|
|
<div className="toolbar-left">
|
|
<MenuButton onClick={onShowLeftMenuClick} />
|
|
{cobranding ? <CobrandingLogo {...cobranding} /> : null}
|
|
<BackToProjectsButton />
|
|
</div>
|
|
<div className="toolbar-right">
|
|
<OnlineUsersWidget onlineUsers={onlineUsers} goToUser={goToUser} />
|
|
{!isRestrictedTokenMember && (
|
|
<>
|
|
<TrackChangesToggleButton
|
|
onClick={toggleReviewPanelOpen}
|
|
disabled={historyIsOpen}
|
|
trackChangesIsOpen={reviewPanelOpen}
|
|
/>
|
|
<HistoryToggleButton
|
|
historyIsOpen={historyIsOpen}
|
|
onClick={toggleHistoryOpen}
|
|
/>
|
|
<ChatToggleButton
|
|
chatIsOpen={chatIsOpen}
|
|
onClick={toggleChatOpen}
|
|
unreadMessageCount={unreadMessageCount}
|
|
/>
|
|
</>
|
|
)}
|
|
</div>
|
|
</header>
|
|
)
|
|
}
|
|
|
|
ToolbarHeader.propTypes = {
|
|
onShowLeftMenuClick: PropTypes.func.isRequired,
|
|
cobranding: PropTypes.object,
|
|
chatIsOpen: PropTypes.bool,
|
|
toggleChatOpen: PropTypes.func.isRequired,
|
|
reviewPanelOpen: PropTypes.bool,
|
|
toggleReviewPanelOpen: PropTypes.func.isRequired,
|
|
historyIsOpen: PropTypes.bool,
|
|
toggleHistoryOpen: PropTypes.func.isRequired,
|
|
unreadMessageCount: PropTypes.number.isRequired,
|
|
onlineUsers: PropTypes.array.isRequired,
|
|
goToUser: PropTypes.func.isRequired,
|
|
isRestrictedTokenMember: PropTypes.bool
|
|
}
|
|
|
|
export default ToolbarHeader
|