pull/5370/head
filip mertens 3 years ago
commit 2c9ef09dac
  1. 6
      apps/remix-ide-e2e/src/tests/solidityImport_group1.spec.ts
  2. 2
      apps/remix-ide-e2e/src/tests/verticalIconsPanel.test.ts
  3. 22
      apps/remix-ide/src/app/tabs/plugin-tab.js
  4. 2
      libs/remix-ui/editor-context-view/src/index.ts
  5. 14
      libs/remix-ui/editor-context-view/src/lib/remix-ui-editor-context-view.tsx
  6. 1
      libs/remix-ui/terminal/src/lib/remix-ui-terminal.css
  7. 10
      libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx
  8. 10
      libs/remix-ui/vertical-icons-panel/src/lib/components/RequiredSection.tsx
  9. 14
      libs/remix-ui/vertical-icons-panel/src/lib/reducers/verticalScrollReducer.ts
  10. 36
      libs/remix-ui/vertical-icons-panel/src/lib/remix-ui-vertical-icons-panel.tsx

@ -1,6 +0,0 @@
'use strict'
import * as test from './solidityImport.test'
import buildGroupTest from '../helpers/buildgrouptest'
const group = 'group1'
module.exports = buildGroupTest(group, test)

@ -27,6 +27,6 @@ module.exports = {
.click('*[id="menuitemdeactivate"]') .click('*[id="menuitemdeactivate"]')
.click('*[data-id="verticalIconsKindsettings"]') .click('*[data-id="verticalIconsKindsettings"]')
.click('*[data-id="verticalIconsKindpluginManager"]') .click('*[data-id="verticalIconsKindpluginManager"]')
.waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugPlugin"]') .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugger"]')
} }
} }

@ -1,22 +0,0 @@
var yo = require('yo-yo')
var css = require('./styles/plugin-tab-styles')
class PluginTab {
constructor (json) {
this.el = null
this.data = { json }
}
render () {
if (this.el) return this.el
this.el = yo`
<div class="${css.pluginTabView}" id="pluginView">
<iframe class="${css.iframe}" src="${this.data.json.url}/index.html"></iframe>
</div>`
return this.el
}
}
module.exports = PluginTab

@ -1 +1 @@
export * from './lib/remix-ui-editor-context-view'; export * from './lib/remix-ui-editor-context-view'

@ -38,15 +38,13 @@ export interface RemixUiEditorContextViewProps {
function isDefinition (node: any) { function isDefinition (node: any) {
return node.nodeType === 'ContractDefinition' || return node.nodeType === 'ContractDefinition' ||
node.nodeType === 'FunctionDefinition' || node.nodeType === 'FunctionDefinition' ||
node.nodeType === 'ModifierDefinition' || node.nodeType === 'ModifierDefinition' ||
node.nodeType === 'VariableDeclaration' || node.nodeType === 'VariableDeclaration' ||
node.nodeType === 'StructDefinition' || node.nodeType === 'StructDefinition' ||
node.nodeType === 'EventDefinition' node.nodeType === 'EventDefinition'
} }
type nullableAstNode = astNode | null type nullableAstNode = astNode | null
export function RemixUiEditorContextView (props: RemixUiEditorContextViewProps) { export function RemixUiEditorContextView (props: RemixUiEditorContextViewProps) {
@ -90,7 +88,7 @@ export function RemixUiEditorContextView (props: RemixUiEditorContextViewProps)
gasEstimation = await props.gasEstimation(currentNode) gasEstimation = await props.gasEstimation(currentNode)
} }
} }
let activeHighlights = await props.getActiveHighlights() const activeHighlights = await props.getActiveHighlights()
setState(prevState => { setState(prevState => {
return { ...prevState, nodes, references, activeHighlights, currentNode, gasEstimation } return { ...prevState, nodes, references, activeHighlights, currentNode, gasEstimation }
}) })

@ -202,6 +202,7 @@ element.style {
bottom : 1em; bottom : 1em;
border-width : 4px; border-width : 4px;
left : 2em; left : 2em;
overflow-y : scroll;
} }
.autoCompleteItem { .autoCompleteItem {

@ -367,6 +367,12 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
} }
} }
const handleClickSelect = (item: string) => {
const result: string = getKeyOf(item) as string || getValueOf(item) as string
setAutoCompleteState(prevState => ({ ...prevState, showSuggestions: false, userInput: result }))
inputEl.current.focus()
}
const handleSelect = (event) => { const handleSelect = (event) => {
const suggestionCount = autoCompletState.activeSuggestion const suggestionCount = autoCompletState.activeSuggestion
if (event.keyCode === 38) { if (event.keyCode === 38) {
@ -402,11 +408,11 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
} }
const handleAutoComplete = () => ( const handleAutoComplete = () => (
<div className='popup alert alert-secondary' style={{ display: (autoCompletState.showSuggestions && autoCompletState.userInput !== '') && autoCompletState.data._options.length > 0 ? 'block' : 'none' }}> <div className='popup alert alert-secondary' style={{ display: (autoCompletState.showSuggestions && autoCompletState.userInput !== '' && (autoCompletState.userInput.length > 2)) && autoCompletState.data._options.length > 0 ? 'block' : 'none' }}>
<div> <div>
{autoCompletState.data._options.map((item, index) => { {autoCompletState.data._options.map((item, index) => {
return ( return (
<div key={index} data-id="autoCompletePopUpAutoCompleteItem" className={`autoCompleteItem listHandlerShow item ${autoCompletState.data._options[autoCompletState.activeSuggestion] === item ? 'border border-primary ' : ''}`} onKeyDown={ handleSelect } > <div key={index} data-id="autoCompletePopUpAutoCompleteItem" className={`autoCompleteItem listHandlerShow item ${autoCompletState.data._options[autoCompletState.activeSuggestion] === item ? 'border border-primary ' : ''}`} onKeyDown={ handleSelect } onClick={() => handleClickSelect(item)}>
<div> <div>
{getKeyOf(item)} {getKeyOf(item)}
</div> </div>

@ -26,31 +26,31 @@ function RequiredSection ({ verticalIconsPlugin, itemContextAction, addActive, r
removeActive={removeActive} removeActive={removeActive}
itemContextAction={itemContextAction} itemContextAction={itemContextAction}
/> />
<PluginManager <Solidity
verticalIconsPlugin={verticalIconsPlugin} verticalIconsPlugin={verticalIconsPlugin}
addActive={addActive} addActive={addActive}
removeActive={removeActive} removeActive={removeActive}
itemContextAction={itemContextAction} itemContextAction={itemContextAction}
/> />
<Solidity <Udapp
verticalIconsPlugin={verticalIconsPlugin} verticalIconsPlugin={verticalIconsPlugin}
addActive={addActive} addActive={addActive}
removeActive={removeActive} removeActive={removeActive}
itemContextAction={itemContextAction} itemContextAction={itemContextAction}
/> />
<Udapp <SolidityStaticAnalysis
verticalIconsPlugin={verticalIconsPlugin} verticalIconsPlugin={verticalIconsPlugin}
addActive={addActive} addActive={addActive}
removeActive={removeActive} removeActive={removeActive}
itemContextAction={itemContextAction} itemContextAction={itemContextAction}
/> />
<SolidityStaticAnalysis <Debugger
verticalIconsPlugin={verticalIconsPlugin} verticalIconsPlugin={verticalIconsPlugin}
addActive={addActive} addActive={addActive}
removeActive={removeActive} removeActive={removeActive}
itemContextAction={itemContextAction} itemContextAction={itemContextAction}
/> />
<Debugger <PluginManager
verticalIconsPlugin={verticalIconsPlugin} verticalIconsPlugin={verticalIconsPlugin}
addActive={addActive} addActive={addActive}
removeActive={removeActive} removeActive={removeActive}

@ -0,0 +1,14 @@
export type actionType = {
type: 'resize' | 'other'
payload: any
}
export function verticalScrollReducer (prevState: any, actionPayload: actionType) {
if (actionPayload.type === 'resize') {
let { scrollHeight, clientHeight, scrollState } = actionPayload.payload
if (scrollHeight > clientHeight) scrollState = true
return { scrollHeight, clientHeight, scrollState }
}
return prevState
}

@ -3,7 +3,9 @@
import React, { import React, {
Fragment, Fragment,
useEffect, useEffect,
useRef useReducer,
useRef,
useState
} from 'react' } from 'react'
import './remix-ui-vertical-icons-panel.css' import './remix-ui-vertical-icons-panel.css'
@ -12,17 +14,44 @@ import { VerticalIcons } from '../../types/vertical-icons-panel'
import Home from './components/Home' import Home from './components/Home'
import Settings from './components/Settings' import Settings from './components/Settings'
import { RequiredSection } from './components/RequiredSection' import { RequiredSection } from './components/RequiredSection'
import { verticalScrollReducer } from './reducers/verticalScrollReducer'
export interface RemixUiVerticalIconsPanelProps { export interface RemixUiVerticalIconsPanelProps {
verticalIconsPlugin: VerticalIcons verticalIconsPlugin: VerticalIcons
} }
let scrollHeight: any let scrollHeight: any
const initialState = {
scrollHeight: 0,
clientHeight: 0,
scrollState: false
}
export function RemixUiVerticalIconsPanel ({ export function RemixUiVerticalIconsPanel ({
verticalIconsPlugin verticalIconsPlugin
}: RemixUiVerticalIconsPanelProps) { }: RemixUiVerticalIconsPanelProps) {
const scrollableRef = useRef<any>() const scrollableRef = useRef<any>()
const iconPanelRef = useRef<any>() const iconPanelRef = useRef<any>()
const [activateScroll, dispatchScrollAction] = useReducer(verticalScrollReducer, initialState)
useEffect(() => {
const evaluateScrollability = (evt: any) => {
console.log('resize event answered by dispatch!')
dispatchScrollAction({
type: 'resize',
payload: {
scrollHeight: document.querySelector('#remixuiScrollable')?.scrollHeight,
clientHeight: document.querySelector('#remixuiScrollable')?.clientHeight,
scrollState: false
}
})
}
addEventListener('resize', evaluateScrollability)
return () => {
removeEventListener('resize', evaluateScrollability)
}
})
function onThemeChanged (themeType: any) { function onThemeChanged (themeType: any) {
const invert = themeType === 'dark' ? 1 : 0 const invert = themeType === 'dark' ? 1 : 0
@ -51,6 +80,7 @@ export function RemixUiVerticalIconsPanel ({
} }
function addActive (name: string) { function addActive (name: string) {
console.log('addactive has been called now.')
if (name === 'home') return if (name === 'home') return
const themeType = verticalIconsPlugin.registry.get('themeModule').api.currentTheme().quality const themeType = verticalIconsPlugin.registry.get('themeModule').api.currentTheme().quality
const invert = themeType === 'dark' ? 1 : 0 const invert = themeType === 'dark' ? 1 : 0
@ -98,7 +128,7 @@ export function RemixUiVerticalIconsPanel ({
<div className="remixui_icons d-flex flex-column vh-100" ref={iconPanelRef}> <div className="remixui_icons d-flex flex-column vh-100" ref={iconPanelRef}>
<Home verticalIconPlugin={verticalIconsPlugin} /> <Home verticalIconPlugin={verticalIconsPlugin} />
<div className={scrollableRef.current && scrollableRef.current.scrollHeight > scrollableRef.current.clientHeight <div className={scrollableRef.current && scrollableRef.current.scrollHeight > scrollableRef.current.clientHeight
? 'remixui_default-icons-container remixui_requiredSection' : 'remixui_requiredSection'}> ? 'remixui_default-icons-container remixui_requiredSection' : activateScroll && activateScroll.scrollState ? 'remixui_default-icons-container remixui_requiredSection' : 'remixui_requiredSection'}>
<RequiredSection <RequiredSection
verticalIconsPlugin={verticalIconsPlugin} verticalIconsPlugin={verticalIconsPlugin}
addActive={addActive} addActive={addActive}
@ -111,7 +141,7 @@ export function RemixUiVerticalIconsPanel ({
id="remixuiScrollable" id="remixuiScrollable"
className={scrollableRef.current && scrollableRef.current.scrollHeight > scrollableRef.current.clientHeight className={scrollableRef.current && scrollableRef.current.scrollHeight > scrollableRef.current.clientHeight
? 'remixui_default-icons-container remixui_scrollable-container remixui_scrollbar remixui_hide-scroll' ? 'remixui_default-icons-container remixui_scrollable-container remixui_scrollbar remixui_hide-scroll'
: 'remixui_scrollable-container remixui_scrollbar remixui_hide-scroll'} : activateScroll && activateScroll.scrollState ? 'remixui_default-icons-container remixui_scrollable-container remixui_scrollbar remixui_hide-scroll' : 'remixui_scrollable-container remixui_scrollbar remixui_hide-scroll'}
ref={scrollableRef} ref={scrollableRef}
> >
<OtherIcons <OtherIcons

Loading…
Cancel
Save