diff --git a/apps/remix-ide/src/app/components/pinned-panel.tsx b/apps/remix-ide/src/app/components/pinned-panel.tsx index 03fc6e1050..f66c9fc3d2 100644 --- a/apps/remix-ide/src/app/components/pinned-panel.tsx +++ b/apps/remix-ide/src/app/components/pinned-panel.tsx @@ -11,12 +11,13 @@ const pinnedPanel = { displayName: 'Pinned Panel', description: 'Remix IDE pinned panel', version: packageJson.version, - methods: ['addView', 'removeView', 'currentFocus', 'pinView', 'unPinView'] + methods: ['addView', 'removeView', 'currentFocus', 'pinView', 'unPinView', 'highlight'] } export class PinnedPanel extends AbstractPanel { dispatch: React.Dispatch = () => {} - loggedState: any + loggedState: Record + highlightStamp: number constructor() { super(pinnedPanel) @@ -61,24 +62,30 @@ export class PinnedPanel extends AbstractPanel { this.emit('unPinnedPlugin', profile) } + highlight () { + this.highlightStamp = Date.now() + this.renderComponent() + } + setDispatch (dispatch: React.Dispatch) { this.dispatch = dispatch } render() { return ( -
+
) } updateComponent(state: any) { - return } plugins={state.plugins} pluginState={state.pluginState} /> + return } { ...state } /> } renderComponent() { this.dispatch({ plugins: this.plugins, - pluginState: this.loggedState + pluginState: this.loggedState, + highlightStamp: this.highlightStamp }) } } diff --git a/libs/remix-ui/panel/src/lib/plugins/panel-plugin.tsx b/libs/remix-ui/panel/src/lib/plugins/panel-plugin.tsx index 7996bb6b46..3ef6066ab9 100644 --- a/libs/remix-ui/panel/src/lib/plugins/panel-plugin.tsx +++ b/libs/remix-ui/panel/src/lib/plugins/panel-plugin.tsx @@ -5,12 +5,15 @@ import './panel.css' interface panelPLuginProps { pluginRecord: PluginRecord, initialState?: any, + highlightStamp?: number, children?: any } const RemixUIPanelPlugin = (props: panelPLuginProps, panelRef: any) => { const localRef = useRef(null) const [view, setView] = useState() + const [showHighlight, setShowHighlight] = useState(false) + useEffect(() => { const ref: any = panelRef || localRef if (ref.current) { @@ -39,8 +42,20 @@ const RemixUIPanelPlugin = (props: panelPLuginProps, panelRef: any) => { } }, []) + useEffect(() => { + setShowHighlight(true) + }, [props.highlightStamp]) + + useEffect(() => { + if (showHighlight) { + setTimeout(() => { + setShowHighlight(false) + }, 500) + } + }, [showHighlight]) + return ( -
+
<>{view}
) diff --git a/libs/remix-ui/panel/src/lib/plugins/panel.css b/libs/remix-ui/panel/src/lib/plugins/panel.css index 437471fabb..b872ff1ada 100644 --- a/libs/remix-ui/panel/src/lib/plugins/panel.css +++ b/libs/remix-ui/panel/src/lib/plugins/panel.css @@ -106,3 +106,7 @@ iframe { .terminal-wrap.minimized.desktop { } + +.highlight { + animation: highlight 2s forwards; +} diff --git a/libs/remix-ui/panel/src/lib/plugins/remix-ui-panel.tsx b/libs/remix-ui/panel/src/lib/plugins/remix-ui-panel.tsx index 7ff51827bd..4e1fa59a2e 100644 --- a/libs/remix-ui/panel/src/lib/plugins/remix-ui-panel.tsx +++ b/libs/remix-ui/panel/src/lib/plugins/remix-ui-panel.tsx @@ -9,6 +9,7 @@ export interface RemixPanelProps { plugins: Record, header: JSX.Element, pluginState?: any, + highlightStamp?: number } export function RemixPluginPanel(props: RemixPanelProps) { @@ -18,7 +19,7 @@ export function RemixPluginPanel(props: RemixPanelProps) {
{Object.values(props.plugins).map((pluginRecord) => { - return + return })}
diff --git a/libs/remix-ui/vertical-icons-panel/src/lib/components/Icon.tsx b/libs/remix-ui/vertical-icons-panel/src/lib/components/Icon.tsx index e50746d3f4..a7de212b38 100644 --- a/libs/remix-ui/vertical-icons-panel/src/lib/components/Icon.tsx +++ b/libs/remix-ui/vertical-icons-panel/src/lib/components/Icon.tsx @@ -101,7 +101,7 @@ const Icon = ({ iconRecord, verticalIconPlugin, contextMenuAction, theme }: Icon className={`remixui_icon m-0 pt-1`} onClick={() => { if (iconRecord.pinned) { - console.log('called an already pinned plugin') + verticalIconPlugin.call('pinnedPanel', 'highlight') } else { (verticalIconPlugin as any).toggle(name) }