Merge pull request #21450 from overleaf/dp-focus-entry

Refactor how ReviewPanel and TrackChangesWidget are rendered

GitOrigin-RevId: 0b206a2a70270a885befdcf2403da4e1af3aa9bf
This commit is contained in:
David 2024-11-04 13:30:24 +00:00 committed by Copybot
parent 21464f200e
commit 1c7e4ddcd2

View file

@ -20,23 +20,17 @@ function ReviewPanelContainer() {
return null return null
} }
// the full-width review panel const hasCommentOrChange = hasActiveRange(ranges, threads)
if (reviewPanelOpen) { const showPanel = reviewPanelOpen || hasCommentOrChange
return ReactDOM.createPortal(<ReviewPanel />, view.scrollDOM) const showTrackChangesWidget = wantTrackChanges && !reviewPanelOpen
}
// the mini review panel
if (hasActiveRange(ranges, threads)) {
return ReactDOM.createPortal( return ReactDOM.createPortal(
<> <>
{wantTrackChanges && <TrackChangesOnWidget />} {showTrackChangesWidget && <TrackChangesOnWidget />}
<ReviewPanel mini /> {showPanel && <ReviewPanel mini={!reviewPanelOpen} />}
</>, </>,
view.scrollDOM view.scrollDOM
) )
}
return null
} }
export default memo(ReviewPanelContainer) export default memo(ReviewPanelContainer)