diff --git a/services/web/frontend/js/features/source-editor/components/review-panel/editor-widgets/toggle-widget.tsx b/services/web/frontend/js/features/source-editor/components/review-panel/editor-widgets/toggle-widget.tsx
index 443e20de16..40dd0d1ccf 100644
--- a/services/web/frontend/js/features/source-editor/components/review-panel/editor-widgets/toggle-widget.tsx
+++ b/services/web/frontend/js/features/source-editor/components/review-panel/editor-widgets/toggle-widget.tsx
@@ -3,6 +3,7 @@ import { useReviewPanelUpdaterFnsContext } from '../../../context/review-panel/r
import { useCodeMirrorStateContext } from '../../codemirror-editor'
import { EditorView } from '@codemirror/view'
import classnames from 'classnames'
+import { memo } from 'react'
function ToggleWidget() {
const { toggleReviewPanel } = useReviewPanelUpdaterFnsContext()
@@ -16,12 +17,16 @@ function ToggleWidget() {
})}
onClick={toggleReviewPanel}
>
- }}
- />
+
)
}
+const TrackChangesOn = memo(() => {
+ return (
+ }} />
+ )
+})
+TrackChangesOn.displayName = 'TrackChangesOn'
+
export default ToggleWidget
diff --git a/services/web/frontend/js/features/source-editor/components/review-panel/review-panel.tsx b/services/web/frontend/js/features/source-editor/components/review-panel/review-panel.tsx
index b2e2ff35af..dc92cf5f93 100644
--- a/services/web/frontend/js/features/source-editor/components/review-panel/review-panel.tsx
+++ b/services/web/frontend/js/features/source-editor/components/review-panel/review-panel.tsx
@@ -6,57 +6,64 @@ import { useCodeMirrorViewContext } from '../codemirror-editor'
import { useReviewPanelValueContext } from '../../context/review-panel/review-panel-context'
import { isCurrentFileView } from '../../utils/sub-view'
import { useLayoutContext } from '@/shared/context/layout-context'
-import { useIdeContext } from '@/shared/context/ide-context'
import classnames from 'classnames'
import { lazy, memo } from 'react'
import getMeta from '@/utils/meta'
+import { SubView } from '../../../../../../types/review-panel/review-panel'
+
+const isReactIde: boolean = getMeta('ol-idePageReact')
type ReviewPanelViewProps = {
parentDomNode: Element
}
function ReviewPanelView({ parentDomNode }: ReviewPanelViewProps) {
- const { subView, loadingThreads, layoutToLeft } = useReviewPanelValueContext()
- const { reviewPanelOpen, miniReviewPanelVisible } = useLayoutContext()
- const { isReactIde } = useIdeContext()
-
- const content = (
- <>
-
- {isCurrentFileView(subView) ? (
-
- ) : (
-
- )}
- >
- )
+ const { subView } = useReviewPanelValueContext()
return ReactDOM.createPortal(
isReactIde ? (
-
- {content}
-
+
) : (
- content
+
),
parentDomNode
)
}
-const isReactIde: boolean = getMeta('ol-idePageReact')
+const ReviewPanelContainer = memo(() => {
+ const { subView, loadingThreads, layoutToLeft } = useReviewPanelValueContext()
+ const { reviewPanelOpen, miniReviewPanelVisible } = useLayoutContext()
+
+ const className = classnames('review-panel-wrapper', {
+ 'rp-state-current-file': subView === 'cur_file',
+ 'rp-state-current-file-expanded': subView === 'cur_file' && reviewPanelOpen,
+ 'rp-state-current-file-mini': subView === 'cur_file' && !reviewPanelOpen,
+ 'rp-state-overview': subView === 'overview',
+ 'rp-size-mini': miniReviewPanelVisible,
+ 'rp-size-expanded': reviewPanelOpen,
+ 'rp-layout-left': layoutToLeft,
+ 'rp-loading-threads': loadingThreads,
+ })
+
+ return (
+
+
+
+ )
+})
+ReviewPanelContainer.displayName = 'ReviewPanelContainer'
+
+const ReviewPanelContent = memo<{ subView: SubView }>(({ subView }) => (
+ <>
+
+ {isCurrentFileView(subView) ? (
+
+ ) : (
+
+ )}
+ >
+))
+ReviewPanelContent.displayName = 'ReviewPanelContent'
const ReviewPanelProvider = lazy(() =>
isReactIde
diff --git a/services/web/frontend/js/features/source-editor/components/review-panel/toolbar/toggle-menu.tsx b/services/web/frontend/js/features/source-editor/components/review-panel/toolbar/toggle-menu.tsx
index bf04f6ca41..2ac8243e9e 100644
--- a/services/web/frontend/js/features/source-editor/components/review-panel/toolbar/toggle-menu.tsx
+++ b/services/web/frontend/js/features/source-editor/components/review-panel/toolbar/toggle-menu.tsx
@@ -1,4 +1,4 @@
-import { useState } from 'react'
+import { memo, useState } from 'react'
import { Trans } from 'react-i18next'
import Icon from '../../../../../shared/components/icon'
import TrackChangesMenu from '@/features/source-editor/components/review-panel/toolbar/track-changes-menu'
@@ -47,17 +47,7 @@ function ToggleMenu() {
className="review-panel-toolbar-collapse-button"
onClick={handleToggleFullTCStateCollapse}
>
- {wantTrackChanges ? (
- }}
- />
- ) : (
- }}
- />
- )}
+ {wantTrackChanges ? : }
{
+ return (
+ }} />
+ )
+})
+TrackChangesOn.displayName = 'TrackChangesOn'
+
+const TrackChangesOff = memo(() => (
+ }} />
+))
+TrackChangesOff.displayName = 'TrackChangesOff'
+
+export default memo(ToggleMenu)