|
|
@ -1,8 +1,7 @@ |
|
|
|
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 } from 'react' |
|
|
|
import React, { Fragment } from 'react' |
|
|
|
import { iconBadgeReducer, IconBadgeReducerAction } from '../reducers/iconBadgeReducer' |
|
|
|
import Icon from './Icon' |
|
|
|
import Icon, { IconStatus } from './Icon' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface UdappProps { |
|
|
|
interface UdappProps { |
|
|
|
verticalIconsPlugin: VerticalIcons |
|
|
|
verticalIconsPlugin: VerticalIcons |
|
|
@ -11,23 +10,16 @@ interface UdappProps { |
|
|
|
removeActive: () => void |
|
|
|
removeActive: () => void |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const initialState = { |
|
|
|
|
|
|
|
text: '', |
|
|
|
|
|
|
|
key: '', |
|
|
|
|
|
|
|
title: '', |
|
|
|
|
|
|
|
type: '' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Udapp ({ verticalIconsPlugin, itemContextAction, addActive, removeActive }: UdappProps) { |
|
|
|
function Udapp ({ verticalIconsPlugin, itemContextAction, addActive, removeActive }: UdappProps) { |
|
|
|
const [badgeStatus, dispatchStatusUpdate] = useReducer(iconBadgeReducer, initialState) |
|
|
|
// const [badgeStatus, dispatchStatusUpdate] = useReducer(iconBadgeReducer, initialState)
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
// useEffect(() => {
|
|
|
|
verticalIconsPlugin.on('udapp', 'statusChanged', (iconStatus: IconStatus) => { |
|
|
|
// verticalIconsPlugin.on('udapp', 'statusChanged', (iconStatus: IconStatus) => {
|
|
|
|
iconStatus.pluginName = 'udapp' |
|
|
|
// iconStatus.pluginName = 'udapp'
|
|
|
|
const action: IconBadgeReducerAction = { type: 'udapp', payload: { status: iconStatus, verticalIconPlugin: verticalIconsPlugin } } |
|
|
|
// const action: IconBadgeReducerAction = { type: 'udapp', payload: { status: iconStatus, verticalIconPlugin: verticalIconsPlugin } }
|
|
|
|
dispatchStatusUpdate(action) |
|
|
|
// dispatchStatusUpdate(action)
|
|
|
|
}) |
|
|
|
// })
|
|
|
|
}, []) |
|
|
|
// }, [])
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<Fragment> |
|
|
|
<Fragment> |
|
|
@ -49,7 +41,6 @@ function Udapp ({ verticalIconsPlugin, itemContextAction, addActive, removeActiv |
|
|
|
key={ |
|
|
|
key={ |
|
|
|
verticalIconsPlugin.targetProfileForChange[p].displayName |
|
|
|
verticalIconsPlugin.targetProfileForChange[p].displayName |
|
|
|
} |
|
|
|
} |
|
|
|
badgeStatus={badgeStatus} |
|
|
|
|
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
)) |
|
|
|
)) |
|
|
|