|
|
@ -1,6 +1,6 @@ |
|
|
|
import { VerticalIcons } from 'libs/remix-ui/vertical-icons-panel/types/vertical-icons-panel' |
|
|
|
import { VerticalIcons } from 'libs/remix-ui/vertical-icons-panel/types/vertical-icons-panel' |
|
|
|
// eslint-disable-next-line no-use-before-define
|
|
|
|
// eslint-disable-next-line no-use-before-define
|
|
|
|
import React, { Fragment, useEffect, useReducer, useRef } from 'react' |
|
|
|
import React, { Fragment, useEffect, useReducer } from 'react' |
|
|
|
import { iconBadgeReducer, IconBadgeReducerAction } from '../reducers/iconBadgeReducer' |
|
|
|
import { iconBadgeReducer, IconBadgeReducerAction } from '../reducers/iconBadgeReducer' |
|
|
|
import Badge from './Badge' |
|
|
|
import Badge from './Badge' |
|
|
|
import Icon, { IconStatus } from './Icon' |
|
|
|
import Icon, { IconStatus } from './Icon' |
|
|
@ -21,11 +21,10 @@ const initialState = { |
|
|
|
|
|
|
|
|
|
|
|
function Debugger ({ verticalIconsPlugin, itemContextAction, addActive, removeActive }: DebuggerProps) { |
|
|
|
function Debugger ({ verticalIconsPlugin, itemContextAction, addActive, removeActive }: DebuggerProps) { |
|
|
|
const [badgeStatus, dispatchStatusUpdate] = useReducer(iconBadgeReducer, initialState) |
|
|
|
const [badgeStatus, dispatchStatusUpdate] = useReducer(iconBadgeReducer, initialState) |
|
|
|
const ref = useRef<any>(null) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
verticalIconsPlugin.on('debugger', 'statusChanged', (iconStatus: IconStatus) => { |
|
|
|
verticalIconsPlugin.on('debugger', 'statusChanged', (iconStatus: IconStatus) => { |
|
|
|
const action: IconBadgeReducerAction = { type: 'debugger', payload: { status: iconStatus, ref: ref, verticalIconPlugin: verticalIconsPlugin } } |
|
|
|
const action: IconBadgeReducerAction = { type: 'debugger', payload: { status: iconStatus, verticalIconPlugin: verticalIconsPlugin } } |
|
|
|
dispatchStatusUpdate(action) |
|
|
|
dispatchStatusUpdate(action) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, []) |
|
|
|
}, []) |
|
|
@ -50,14 +49,9 @@ function Debugger ({ verticalIconsPlugin, itemContextAction, addActive, removeAc |
|
|
|
verticalIconsPlugin.targetProfileForChange[p].displayName |
|
|
|
verticalIconsPlugin.targetProfileForChange[p].displayName |
|
|
|
} |
|
|
|
} |
|
|
|
/> |
|
|
|
/> |
|
|
|
{ |
|
|
|
|
|
|
|
badgeStatus && verticalIconsPlugin.keys.includes(badgeStatus.key) && |
|
|
|
|
|
|
|
verticalIconsPlugin.types.includes(badgeStatus.type) ? ( |
|
|
|
|
|
|
|
<Badge |
|
|
|
<Badge |
|
|
|
badgeStatus={badgeStatus} |
|
|
|
badgeStatus={badgeStatus} |
|
|
|
/> |
|
|
|
/> |
|
|
|
) : null |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
)) |
|
|
|
)) |
|
|
|
: null} |
|
|
|
: null} |
|
|
|