void
}
+const initialState = {
+ text: '',
+ key: '',
+ title: '',
+ type: ''
+}
+
function OtherIcons ({ verticalIconsPlugin, itemContextAction, addActive, removeActive }: OtherIconsProps) {
+ const [badgeStatus, dispatchStatusUpdate] = useReducer(iconBadgeReducer, initialState)
+
+ useEffect(() => {
+ Object.keys(verticalIconsPlugin.targetProfileForChange)
+ .filter(customFilter)
+ .forEach(p =>
+ verticalIconsPlugin.on(verticalIconsPlugin.targetProfileForChange[p].name, 'statusChanged', (iconStatus: IconStatus) => {
+ const action: IconBadgeReducerAction = {
+ type: verticalIconsPlugin.targetProfileForChange[p].name,
+ payload: { status: iconStatus, verticalIconPlugin: verticalIconsPlugin }
+ }
+ dispatchStatusUpdate(action)
+ }))
+ }, [])
return (
{
@@ -34,6 +56,7 @@ function OtherIcons ({ verticalIconsPlugin, itemContextAction, addActive, remove
key={
verticalIconsPlugin.targetProfileForChange[p].displayName
}
+ badgeStatus={badgeStatus}
/>
))}
diff --git a/libs/remix-ui/vertical-icons-panel/src/lib/components/RequiredSection.tsx b/libs/remix-ui/vertical-icons-panel/src/lib/components/RequiredSection.tsx
index c78610052b..010aa20366 100644
--- a/libs/remix-ui/vertical-icons-panel/src/lib/components/RequiredSection.tsx
+++ b/libs/remix-ui/vertical-icons-panel/src/lib/components/RequiredSection.tsx
@@ -26,31 +26,31 @@ function RequiredSection ({ verticalIconsPlugin, itemContextAction, addActive, r
removeActive={removeActive}
itemContextAction={itemContextAction}
/>
-
-
-
-
-
@@ -47,15 +46,8 @@ function Solidity ({ verticalIconsPlugin, itemContextAction, addActive, removeAc
key={
verticalIconsPlugin.targetProfileForChange[p].displayName
}
+ badgeStatus={badgeStatus}
/>
- {
- badgeStatus && verticalIconsPlugin.keys.includes(badgeStatus.key) &&
- verticalIconsPlugin.types.includes(badgeStatus.type) ? (
-
- ) : null
- }
))
: null}
diff --git a/libs/remix-ui/vertical-icons-panel/src/lib/components/SolidityStaticAnalysis.tsx b/libs/remix-ui/vertical-icons-panel/src/lib/components/SolidityStaticAnalysis.tsx
index 22f3069244..1ad8517869 100644
--- a/libs/remix-ui/vertical-icons-panel/src/lib/components/SolidityStaticAnalysis.tsx
+++ b/libs/remix-ui/vertical-icons-panel/src/lib/components/SolidityStaticAnalysis.tsx
@@ -2,7 +2,7 @@ import { VerticalIcons } from 'libs/remix-ui/vertical-icons-panel/types/vertical
// eslint-disable-next-line no-use-before-define
import React, { Fragment, useEffect, useReducer } from 'react'
import { iconBadgeReducer, IconBadgeReducerAction } from '../reducers/iconBadgeReducer'
-import Badge from './Badge'
+// import Badge from './Badge'
import Icon, { IconStatus } from './Icon'
interface SolidityStaticAnalysisProps {
@@ -34,7 +34,7 @@ function SolidityStaticAnalysis ({ verticalIconsPlugin, itemContextAction, addAc
? Object.keys(verticalIconsPlugin.targetProfileForChange)
.filter(p => p === 'solidityStaticAnalysis')
.map(p => (
-
- {
- badgeStatus && verticalIconsPlugin.keys.includes(badgeStatus.key) &&
- verticalIconsPlugin.types.includes(badgeStatus.type) ? (
-
- ) : null
- }
))
: null}
diff --git a/libs/remix-ui/vertical-icons-panel/src/lib/components/Udapp.tsx b/libs/remix-ui/vertical-icons-panel/src/lib/components/Udapp.tsx
index 44c592e3f7..91f77bbb9c 100644
--- a/libs/remix-ui/vertical-icons-panel/src/lib/components/Udapp.tsx
+++ b/libs/remix-ui/vertical-icons-panel/src/lib/components/Udapp.tsx
@@ -1,8 +1,7 @@
import { VerticalIcons } from 'libs/remix-ui/vertical-icons-panel/types/vertical-icons-panel'
// 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 Badge from './Badge'
import Icon, { IconStatus } from './Icon'
interface UdappProps {
@@ -21,11 +20,10 @@ const initialState = {
function Udapp ({ verticalIconsPlugin, itemContextAction, addActive, removeActive }: UdappProps) {
const [badgeStatus, dispatchStatusUpdate] = useReducer(iconBadgeReducer, initialState)
- const ref = useRef(null)
useEffect(() => {
verticalIconsPlugin.on('udapp', 'statusChanged', (iconStatus: IconStatus) => {
- const action: IconBadgeReducerAction = { type: 'udapp', payload: { status: iconStatus, ref: ref, verticalIconPlugin: verticalIconsPlugin } }
+ const action: IconBadgeReducerAction = { type: 'udapp', payload: { status: iconStatus, verticalIconPlugin: verticalIconsPlugin } }
dispatchStatusUpdate(action)
})
}, [])
@@ -50,15 +48,8 @@ function Udapp ({ verticalIconsPlugin, itemContextAction, addActive, removeActiv
key={
verticalIconsPlugin.targetProfileForChange[p].displayName
}
+ badgeStatus={badgeStatus}
/>
- {
- badgeStatus && verticalIconsPlugin.keys.includes(badgeStatus.key) &&
- verticalIconsPlugin.types.includes(badgeStatus.type) ? (
-
- ) : null
- }
))
: null}
diff --git a/libs/remix-ui/vertical-icons-panel/src/lib/reducers/iconBadgeReducer.ts b/libs/remix-ui/vertical-icons-panel/src/lib/reducers/iconBadgeReducer.ts
index d0c35b91f3..eaeae111ff 100644
--- a/libs/remix-ui/vertical-icons-panel/src/lib/reducers/iconBadgeReducer.ts
+++ b/libs/remix-ui/vertical-icons-panel/src/lib/reducers/iconBadgeReducer.ts
@@ -9,22 +9,12 @@ export type IconBadgeReducerAction = {
readonly payload: any
}
-// const fn = (status: IconStatus) => {
-// if (!verticalIconPlugin.types.includes(status.type) && status.type) throw new Error(`type should be ${verticalIconPlugin.keys.join()}`)
-// if (status.key === undefined) throw new Error('status key should be defined')
-
-// if (typeof status.key === 'string' && (!verticalIconPlugin.keys.includes(status.key))) {
-// throw new Error('key should contain either number or ' + verticalIconPlugin.keys.join())
-// }
-// }
-
/**
* Set a new status for the @arg name
* @param {String} name
* @param {Object} status
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
-// if (!ref.current) return
function setIconStatus (name: string, status: IconStatus) {
if (status.key === 'none') return { ...status, text: '' } // remove status
@@ -41,7 +31,6 @@ function setIconStatus (name: string, status: IconStatus) {
thisType = 'danger' // to use with bootstrap
} else thisType = helper.checkSpecialChars(status.type) ? '' : status.type!
const title = helper.checkSpecialChars(status.title) ? '' : status.title
- console.log(`new status for ${name} is :`, { title, type: thisType, key, text })
return { title, type: thisType, key, text }
}
@@ -49,7 +38,6 @@ export function iconBadgeReducer (state: BadgeStatus, action: IconBadgeReducerAc
const { status, ref, verticalIconPlugin } = action.payload
if (Object.keys(verticalIconPlugin.targetProfileForChange).includes(action.type)) {
const setStatus = setIconStatus(action.type, status)
- console.log(`from reducer of ${action.type} :`, { setStatus })
return setStatus
}
return state
diff --git a/libs/remix-ui/vertical-icons-panel/src/lib/remix-ui-vertical-icons-panel.css b/libs/remix-ui/vertical-icons-panel/src/lib/remix-ui-vertical-icons-panel.css
index 27ecdf7f93..9ecc517187 100644
--- a/libs/remix-ui/vertical-icons-panel/src/lib/remix-ui-vertical-icons-panel.css
+++ b/libs/remix-ui/vertical-icons-panel/src/lib/remix-ui-vertical-icons-panel.css
@@ -44,10 +44,11 @@
bottom: 0;
}
.remixui_status {
- /* position: relative; */
+ position: relative;
bottom: 0;
right: 0;
- align-self: flex-end;
+ left: 12px;
+ top: -13px;
}
.remixui_statusCheck {
font-size: 1.2em;
@@ -114,6 +115,10 @@
flex-grow: 1;
}
+ .remixui_iconContainer {
+
+ }
+
#menuitems {
list-style: none;
margin: 0px;