react to statusChanged event

pull/1861/head
Joseph Izang 3 years ago
parent 1bca4ce3c6
commit 27422c50d8
  1. 5
      libs/remix-ui/vertical-icons-panel/src/lib/components/OtherIcons.tsx
  2. 1
      libs/remix-ui/vertical-icons-panel/src/lib/reducers/iconBadgeReducer.ts
  3. 2
      libs/remix-ui/vertical-icons-panel/src/lib/remix-ui-vertical-icons-panel.tsx

@ -33,14 +33,15 @@ function OtherIcons ({ verticalIconsPlugin, itemContextAction, addActive, remove
Object.keys(verticalIconsPlugin.targetProfileForChange)
.filter(customFilter)
.forEach(p =>
verticalIconsPlugin.on(verticalIconsPlugin.targetProfileForChange[p].name, 'statusChanged', (iconStatus: IconStatus) => {
verticalIconsPlugin.on(verticalIconsPlugin.targetProfileForChange[p].name, 'statusChanged', (evt: Event, iconStatus: IconStatus) => {
const action: IconBadgeReducerAction = {
type: verticalIconsPlugin.targetProfileForChange[p].name,
payload: { status: iconStatus, verticalIconPlugin: verticalIconsPlugin }
}
console.log('check the event payload', { evt })
dispatchStatusUpdate(action)
}))
}, [])
}, [verticalIconsPlugin.targetProfileForChange, Object.keys(verticalIconsPlugin.targetProfileForChange).length])
return (
<div id="otherIcons">
{

@ -36,6 +36,7 @@ function setIconStatus (name: string, status: IconStatus) {
export function iconBadgeReducer (state: BadgeStatus, action: IconBadgeReducerAction) {
const { status, ref, verticalIconPlugin } = action.payload
console.log('badge contains ', { status })
if (Object.keys(verticalIconPlugin.targetProfileForChange).includes(action.type)) {
const setStatus = setIconStatus(action.type, status)
return setStatus

@ -36,7 +36,6 @@ export function RemixUiVerticalIconsPanel ({
useEffect(() => {
const evaluateScrollability = (evt: any) => {
console.log('resize event answered by dispatch!')
dispatchScrollAction({
type: 'resize',
payload: {
@ -80,7 +79,6 @@ export function RemixUiVerticalIconsPanel ({
}
function addActive (name: string) {
console.log('addactive has been called now.')
if (name === 'home') return
const themeType = verticalIconsPlugin.registry.get('themeModule').api.currentTheme().quality
const invert = themeType === 'dark' ? 1 : 0

Loading…
Cancel
Save