|
@@ -14,6 +14,7 @@ import { useEditorManagerContext } from '@/features/ide-react/context/editor-man
|
|
|
import { useLayoutContext } from '@/shared/context/layout-context'
|
|
import { useLayoutContext } from '@/shared/context/layout-context'
|
|
|
import { EditorSelection } from '@codemirror/state'
|
|
import { EditorSelection } from '@codemirror/state'
|
|
|
import { EditorView } from '@codemirror/view'
|
|
import { EditorView } from '@codemirror/view'
|
|
|
|
|
+import MaterialIcon from '@/shared/components/material-icon'
|
|
|
|
|
|
|
|
export const ReviewPanelEntry: FC<{
|
|
export const ReviewPanelEntry: FC<{
|
|
|
position: number
|
|
position: number
|
|
@@ -24,6 +25,9 @@ export const ReviewPanelEntry: FC<{
|
|
|
selectLineOnFocus?: boolean
|
|
selectLineOnFocus?: boolean
|
|
|
hoverRanges?: boolean
|
|
hoverRanges?: boolean
|
|
|
disabled?: boolean
|
|
disabled?: boolean
|
|
|
|
|
+ onEnterEntryIndicator?: () => void
|
|
|
|
|
+ onLeaveEntryIndicator?: () => void
|
|
|
|
|
+ entryIndicator?: 'comment' | 'edit'
|
|
|
}> = ({
|
|
}> = ({
|
|
|
children,
|
|
children,
|
|
|
position,
|
|
position,
|
|
@@ -34,6 +38,9 @@ export const ReviewPanelEntry: FC<{
|
|
|
docId,
|
|
docId,
|
|
|
hoverRanges = true,
|
|
hoverRanges = true,
|
|
|
disabled,
|
|
disabled,
|
|
|
|
|
+ onEnterEntryIndicator,
|
|
|
|
|
+ onLeaveEntryIndicator,
|
|
|
|
|
+ entryIndicator,
|
|
|
}) => {
|
|
}) => {
|
|
|
const state = useCodeMirrorStateContext()
|
|
const state = useCodeMirrorStateContext()
|
|
|
const view = useCodeMirrorViewContext()
|
|
const view = useCodeMirrorViewContext()
|
|
@@ -98,7 +105,6 @@ export const ReviewPanelEntry: FC<{
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<div
|
|
<div
|
|
|
- onMouseDown={openReviewPanel} // Using onMouseDown rather than onClick to guarantee that it fires before onFocus
|
|
|
|
|
onFocus={focusHandler}
|
|
onFocus={focusHandler}
|
|
|
onBlur={() => {
|
|
onBlur={() => {
|
|
|
setSelected(false)
|
|
setSelected(false)
|
|
@@ -141,6 +147,21 @@ export const ReviewPanelEntry: FC<{
|
|
|
transition: 'top .3s, left .1s, right .1s',
|
|
transition: 'top .3s, left .1s, right .1s',
|
|
|
}}
|
|
}}
|
|
|
>
|
|
>
|
|
|
|
|
+ {entryIndicator && (
|
|
|
|
|
+ <div
|
|
|
|
|
+ className="review-panel-entry-indicator"
|
|
|
|
|
+ onMouseEnter={onEnterEntryIndicator}
|
|
|
|
|
+ onMouseLeave={onLeaveEntryIndicator}
|
|
|
|
|
+ onMouseDown={openReviewPanel} // Using onMouseDown rather than onClick to guarantee that it fires before onFocus
|
|
|
|
|
+ role="button"
|
|
|
|
|
+ tabIndex={0}
|
|
|
|
|
+ >
|
|
|
|
|
+ <MaterialIcon
|
|
|
|
|
+ type={entryIndicator}
|
|
|
|
|
+ className="review-panel-entry-icon"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
{children}
|
|
{children}
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|