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