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