From 1c7e4ddcd25d4021a81e164a28c777dbdb13ebc2 Mon Sep 17 00:00:00 2001 From: David <33458145+davidmcpowell@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:30:24 +0000 Subject: [PATCH] Merge pull request #21450 from overleaf/dp-focus-entry Refactor how ReviewPanel and TrackChangesWidget are rendered GitOrigin-RevId: 0b206a2a70270a885befdcf2403da4e1af3aa9bf --- .../components/review-panel-container.tsx | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/services/web/frontend/js/features/review-panel-new/components/review-panel-container.tsx b/services/web/frontend/js/features/review-panel-new/components/review-panel-container.tsx index c24de044a2..93be6ab439 100644 --- a/services/web/frontend/js/features/review-panel-new/components/review-panel-container.tsx +++ b/services/web/frontend/js/features/review-panel-new/components/review-panel-container.tsx @@ -20,23 +20,17 @@ function ReviewPanelContainer() { return null } - // the full-width review panel - if (reviewPanelOpen) { - return ReactDOM.createPortal(, 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 && } - - , - view.scrollDOM - ) - } - - return null + return ReactDOM.createPortal( + <> + {showTrackChangesWidget && } + {showPanel && } + , + view.scrollDOM + ) } export default memo(ReviewPanelContainer)