udapte var names

pull/2092/head
filip mertens 3 years ago
parent 1c39759bbc
commit 53b020744c
  1. 8
      libs/remix-ui/search/src/lib/components/Exclude.tsx
  2. 2
      libs/remix-ui/search/src/lib/components/Find.tsx
  3. 6
      libs/remix-ui/search/src/lib/components/Include.tsx
  4. 14
      libs/remix-ui/search/src/lib/context/context.tsx

@ -3,16 +3,16 @@ import { SearchContext } from '../context/context'
export const Exclude = props => {
const { setExclude, state } = useContext(SearchContext)
const [str, setStr] = useState<string>('.git/**/*,.deps/**/*')
const [excludeInput, setExcludeInput] = useState<string>('.git/**/*,.deps/**/*')
const timeOutId = useRef(null)
const change = e => {
setStr(e.target.value)
setExcludeInput(e.target.value)
clearTimeout(timeOutId.current)
timeOutId.current = setTimeout(() => setExclude(e.target.value), 500)
}
useEffect(() => {
setExclude(str)
setExclude(excludeInput)
}, [])
return (
@ -24,7 +24,7 @@ export const Exclude = props => {
placeholder="Exclude ie .git/**/*"
className="form-control"
onChange={change}
value={str}
value={excludeInput}
></input>
</div>
</>

@ -1,7 +1,7 @@
import React, { useContext, useRef } from 'react'
import { SearchContext } from '../context/context'
export const Find = props => {
export const Find = () => {
const {
setFind,
state,

@ -3,10 +3,10 @@ import { SearchContext } from '../context/context'
export const Include = props => {
const { setInclude } = useContext(SearchContext)
const [str, setStr] = useState<string>('')
const [includeInput, setIncludeInput] = useState<string>('')
const timeOutId = useRef(null)
const change = e => {
setStr(e.target.value)
setIncludeInput(e.target.value)
clearTimeout(timeOutId.current)
timeOutId.current = setTimeout(() => setInclude(e.target.value), 500)
}
@ -20,7 +20,7 @@ export const Include = props => {
placeholder="Include ie contracts/**/*.sol"
className="form-control"
onChange={change}
value={str}
value={includeInput}
></input>
</div>
</>

@ -205,17 +205,17 @@ export const SearchProvider = ({
useEffect(() => {
if (state.find) {
(async () => {
const res = await getDirectory('/', plugin)
const files = await getDirectory('/', plugin)
const pathFilter: any = {}
if (state.include){
const inc = state.include.replaceAll(/(?<!\/)(\*\.)/g, '**/*.')
pathFilter.include = inc.split(',').map(i => i.trim())
const includeWithGlobalExpression = state.include.replaceAll(/(?<!\/)(\*\.)/g, '**/*.')
pathFilter.include = includeWithGlobalExpression.split(',').map(i => i.trim())
}
if (state.exclude){
const exc = state.exclude.replaceAll(/(?<!\/)(\*\.)/g, '**/*.')
pathFilter.exclude = state.exclude.split(',').map(i => i.trim())
const excludeWithGlobalExpression = state.exclude.replaceAll(/(?<!\/)(\*\.)/g, '**/*.')
pathFilter.exclude = excludeWithGlobalExpression.split(',').map(i => i.trim())
}
const ob = res.filter(filePathFilter(pathFilter)).map(file => {
const filteredFiles = files.filter(filePathFilter(pathFilter)).map(file => {
const r: SearchResult = {
filename: file,
lines: [],
@ -226,7 +226,7 @@ export const SearchProvider = ({
}
return r
})
value.setSearchResults(ob)
value.setSearchResults(filteredFiles)
})()
}
}, [state.timeStamp])

Loading…
Cancel
Save