Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
92030c31
Commit
92030c31
authored
Sep 21, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
search input
parent
45f8d4af
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
27 deletions
+47
-27
Apps.tsx
ui/pages/Apps.tsx
+2
-2
FilterInput.tsx
ui/shared/FilterInput.tsx
+11
-7
TxInternals.tsx
ui/tx/TxInternals.tsx
+12
-0
TxInternalsFilter.tsx
ui/tx/internals/TxInternalsFilter.tsx
+2
-16
TxInternalsTableItem.tsx
ui/tx/internals/TxInternalsTableItem.tsx
+4
-2
utils.ts
ui/tx/internals/utils.ts
+16
-0
No files found.
ui/pages/Apps.tsx
View file @
92030c31
...
@@ -3,7 +3,7 @@ import React, { useCallback, useState } from 'react';
...
@@ -3,7 +3,7 @@ import React, { useCallback, useState } from 'react';
import
{
TEMPORARY_DEMO_APPS
}
from
'
data/apps
'
;
import
{
TEMPORARY_DEMO_APPS
}
from
'
data/apps
'
;
import
AppList
from
'
ui/apps/AppList
'
;
import
AppList
from
'
ui/apps/AppList
'
;
import
FilterInput
from
'
ui/
apps
/FilterInput
'
;
import
FilterInput
from
'
ui/
shared
/FilterInput
'
;
const
defaultDisplayedApps
=
[
...
TEMPORARY_DEMO_APPS
]
const
defaultDisplayedApps
=
[
...
TEMPORARY_DEMO_APPS
]
.
sort
((
a
,
b
)
=>
a
.
title
.
localeCompare
(
b
.
title
));
.
sort
((
a
,
b
)
=>
a
.
title
.
localeCompare
(
b
.
title
));
...
@@ -23,7 +23,7 @@ const Apps = () => {
...
@@ -23,7 +23,7 @@ const Apps = () => {
return
(
return
(
<>
<>
<
FilterInput
onChange=
{
debounceFilterApps
}
/>
<
FilterInput
onChange=
{
debounceFilterApps
}
marginBottom=
{
{
base
:
'
4
'
,
lg
:
'
6
'
}
}
placeholder=
"Find app"
/>
<
AppList
apps=
{
displayedApps
}
/>
<
AppList
apps=
{
displayedApps
}
/>
</>
</>
);
);
...
...
ui/
apps
/FilterInput.tsx
→
ui/
shared
/FilterInput.tsx
View file @
92030c31
import
{
SearchIcon
}
from
'
@chakra-ui/icons
'
;
import
{
SearchIcon
}
from
'
@chakra-ui/icons
'
;
import
{
Input
,
InputGroup
,
InputLeftElement
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
Input
,
InputGroup
,
InputLeftElement
,
useColorModeValue
,
chakra
}
from
'
@chakra-ui/react
'
;
import
type
{
ChangeEvent
}
from
'
react
'
;
import
type
{
ChangeEvent
}
from
'
react
'
;
import
React
,
{
useCallback
,
useState
}
from
'
react
'
;
import
React
,
{
useCallback
,
useState
}
from
'
react
'
;
type
Props
=
{
type
Props
=
{
onChange
:
(
q
:
string
)
=>
void
;
onChange
:
(
searchTerm
:
string
)
=>
void
;
className
?:
string
;
size
?:
'
xs
'
|
'
sm
'
|
'
md
'
|
'
lg
'
;
placeholder
:
string
;
}
}
const
FilterInput
=
({
onChange
}:
Props
)
=>
{
const
FilterInput
=
({
onChange
,
className
,
size
=
'
sm
'
,
placeholder
}:
Props
)
=>
{
const
[
filterQuery
,
setFilterQuery
]
=
useState
(
''
);
const
[
filterQuery
,
setFilterQuery
]
=
useState
(
''
);
const
handleFilterQueryChange
=
useCallback
((
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
const
handleFilterQueryChange
=
useCallback
((
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
...
@@ -19,7 +22,8 @@ const FilterInput = ({ onChange }: Props) => {
...
@@ -19,7 +22,8 @@ const FilterInput = ({ onChange }: Props) => {
return
(
return
(
<
InputGroup
<
InputGroup
size=
"sm"
size=
{
size
}
className=
{
className
}
>
>
<
InputLeftElement
<
InputLeftElement
pointerEvents=
"none"
pointerEvents=
"none"
...
@@ -28,13 +32,13 @@ const FilterInput = ({ onChange }: Props) => {
...
@@ -28,13 +32,13 @@ const FilterInput = ({ onChange }: Props) => {
</
InputLeftElement
>
</
InputLeftElement
>
<
Input
<
Input
size=
"sm"
size=
{
size
}
value=
{
filterQuery
}
value=
{
filterQuery
}
onChange=
{
handleFilterQueryChange
}
onChange=
{
handleFilterQueryChange
}
marginBottom=
{
{
base
:
'
4
'
,
lg
:
'
6
'
}
}
placeholder=
{
placeholder
}
/>
/>
</
InputGroup
>
</
InputGroup
>
);
);
};
};
export
default
FilterInput
;
export
default
chakra
(
FilterInput
)
;
ui/tx/TxInternals.tsx
View file @
92030c31
...
@@ -2,15 +2,25 @@ import { Box, Flex, Table, Thead, Tbody, Tr, Th, TableContainer } from '@chakra-
...
@@ -2,15 +2,25 @@ import { Box, Flex, Table, Thead, Tbody, Tr, Th, TableContainer } from '@chakra-
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
TxInternalsType
}
from
'
types/api/tx
'
;
import
type
{
TxInternalsType
}
from
'
types/api/tx
'
;
import
type
ArrayElement
from
'
types/utils/ArrayElement
'
;
import
{
data
}
from
'
data/txInternal
'
;
import
{
data
}
from
'
data/txInternal
'
;
import
FilterInput
from
'
ui/shared/FilterInput
'
;
import
TxInternalsFilter
from
'
ui/tx/internals/TxInternalsFilter
'
;
import
TxInternalsFilter
from
'
ui/tx/internals/TxInternalsFilter
'
;
import
TxInternalsTableItem
from
'
ui/tx/internals/TxInternalsTableItem
'
;
import
TxInternalsTableItem
from
'
ui/tx/internals/TxInternalsTableItem
'
;
const
DEFAULT_FILTERS
:
Array
<
TxInternalsType
>
=
[
'
call
'
,
'
delegate_call
'
,
'
static_call
'
,
'
create
'
,
'
create2
'
,
'
self_destruct
'
,
'
reward
'
];
const
DEFAULT_FILTERS
:
Array
<
TxInternalsType
>
=
[
'
call
'
,
'
delegate_call
'
,
'
static_call
'
,
'
create
'
,
'
create2
'
,
'
self_destruct
'
,
'
reward
'
];
const
searchFn
=
(
searchTerm
:
string
)
=>
(
item
:
ArrayElement
<
typeof
data
>
):
boolean
=>
{
const
formattedSearchTerm
=
searchTerm
.
toLowerCase
();
return
item
.
type
.
toLowerCase
().
includes
(
formattedSearchTerm
)
||
item
.
from
.
toLowerCase
().
includes
(
formattedSearchTerm
)
||
item
.
to
.
toLowerCase
().
includes
(
formattedSearchTerm
);
};
const
TxInternals
=
()
=>
{
const
TxInternals
=
()
=>
{
const
[
filters
,
setFilters
]
=
React
.
useState
<
Array
<
TxInternalsType
>>
(
DEFAULT_FILTERS
);
const
[
filters
,
setFilters
]
=
React
.
useState
<
Array
<
TxInternalsType
>>
(
DEFAULT_FILTERS
);
const
[
searchTerm
,
setSearchTerm
]
=
React
.
useState
<
string
>
(
''
);
const
handleFilterChange
=
React
.
useCallback
((
nextValue
:
Array
<
TxInternalsType
>
)
=>
{
const
handleFilterChange
=
React
.
useCallback
((
nextValue
:
Array
<
TxInternalsType
>
)
=>
{
setFilters
(
nextValue
);
setFilters
(
nextValue
);
...
@@ -20,6 +30,7 @@ const TxInternals = () => {
...
@@ -20,6 +30,7 @@ const TxInternals = () => {
<
Box
>
<
Box
>
<
Flex
>
<
Flex
>
<
TxInternalsFilter
onFilterChange=
{
handleFilterChange
}
defaultFilters=
{
filters
}
appliedFiltersNum=
{
filters
.
length
}
/>
<
TxInternalsFilter
onFilterChange=
{
handleFilterChange
}
defaultFilters=
{
filters
}
appliedFiltersNum=
{
filters
.
length
}
/>
<
FilterInput
onChange=
{
setSearchTerm
}
maxW=
"360px"
ml=
{
3
}
size=
"xs"
placeholder=
"Search by addresses, hash, method..."
/>
</
Flex
>
</
Flex
>
<
TableContainer
width=
"100%"
mt=
{
6
}
>
<
TableContainer
width=
"100%"
mt=
{
6
}
>
<
Table
variant=
"simple"
minWidth=
"950px"
size=
"sm"
>
<
Table
variant=
"simple"
minWidth=
"950px"
size=
"sm"
>
...
@@ -35,6 +46,7 @@ const TxInternals = () => {
...
@@ -35,6 +46,7 @@ const TxInternals = () => {
<
Tbody
>
<
Tbody
>
{
data
{
data
.
filter
(({
type
})
=>
filters
.
includes
(
type
))
.
filter
(({
type
})
=>
filters
.
includes
(
type
))
.
filter
(
searchFn
(
searchTerm
))
.
map
((
item
)
=>
<
TxInternalsTableItem
key=
{
item
.
id
}
{
...
item
}
/>)
}
.
map
((
item
)
=>
<
TxInternalsTableItem
key=
{
item
.
id
}
{
...
item
}
/>)
}
</
Tbody
>
</
Tbody
>
</
Table
>
</
Table
>
...
...
ui/tx/internals/TxInternalsFilter.tsx
View file @
92030c31
...
@@ -5,21 +5,7 @@ import type { TxInternalsType } from 'types/api/tx';
...
@@ -5,21 +5,7 @@ import type { TxInternalsType } from 'types/api/tx';
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
FilterButton
from
'
ui/shared/FilterButton
'
;
import
FilterButton
from
'
ui/shared/FilterButton
'
;
import
{
TX_INTERNALS_ITEMS
}
from
'
ui/tx/internals/utils
'
;
interface
Filter
{
title
:
string
;
id
:
TxInternalsType
;
}
const
FILTERS
:
Array
<
Filter
>
=
[
{
title
:
'
Call
'
,
id
:
'
call
'
},
{
title
:
'
Delegate call
'
,
id
:
'
delegate_call
'
},
{
title
:
'
Static call
'
,
id
:
'
static_call
'
},
{
title
:
'
Create
'
,
id
:
'
create
'
},
{
title
:
'
Create2
'
,
id
:
'
create2
'
},
{
title
:
'
Self-destruct
'
,
id
:
'
self_destruct
'
},
{
title
:
'
Reward
'
,
id
:
'
reward
'
},
];
interface
Props
{
interface
Props
{
appliedFiltersNum
?:
number
;
appliedFiltersNum
?:
number
;
...
@@ -44,7 +30,7 @@ const TxInternalsFilter = ({ onFilterChange, defaultFilters, appliedFiltersNum }
...
@@ -44,7 +30,7 @@ const TxInternalsFilter = ({ onFilterChange, defaultFilters, appliedFiltersNum }
<
PopoverContent
w=
"438px"
>
<
PopoverContent
w=
"438px"
>
<
PopoverBody
px=
{
4
}
py=
{
6
}
display=
"grid"
gridTemplateColumns=
"1fr 1fr"
rowGap=
{
5
}
>
<
PopoverBody
px=
{
4
}
py=
{
6
}
display=
"grid"
gridTemplateColumns=
"1fr 1fr"
rowGap=
{
5
}
>
<
CheckboxGroup
size=
"lg"
onChange=
{
onFilterChange
}
defaultValue=
{
defaultFilters
}
>
<
CheckboxGroup
size=
"lg"
onChange=
{
onFilterChange
}
defaultValue=
{
defaultFilters
}
>
{
FILTER
S
.
map
(({
title
,
id
})
=>
<
Checkbox
key=
{
id
}
value=
{
id
}
><
Text
fontSize=
"md"
>
{
title
}
</
Text
></
Checkbox
>)
}
{
TX_INTERNALS_ITEM
S
.
map
(({
title
,
id
})
=>
<
Checkbox
key=
{
id
}
value=
{
id
}
><
Text
fontSize=
"md"
>
{
title
}
</
Text
></
Checkbox
>)
}
</
CheckboxGroup
>
</
CheckboxGroup
>
</
PopoverBody
>
</
PopoverBody
>
</
PopoverContent
>
</
PopoverContent
>
...
...
ui/tx/internals/TxInternalsTableItem.tsx
View file @
92030c31
import
{
Tr
,
Td
,
Tag
,
Icon
}
from
'
@chakra-ui/react
'
;
import
{
Tr
,
Td
,
Tag
,
Icon
}
from
'
@chakra-ui/react
'
;
import
capitalize
from
'
lodash/capitalize
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
rightArrowIcon
from
'
icons/arrows/right.svg
'
;
import
rightArrowIcon
from
'
icons/arrows/right.svg
'
;
import
Address
from
'
ui/shared/address/Address
'
;
import
Address
from
'
ui/shared/address/Address
'
;
import
AddressIcon
from
'
ui/shared/address/AddressIcon
'
;
import
AddressIcon
from
'
ui/shared/address/AddressIcon
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
import
{
TX_INTERNALS_ITEMS
}
from
'
ui/tx/internals/utils
'
;
import
TxStatus
from
'
ui/tx/TxStatus
'
;
import
TxStatus
from
'
ui/tx/TxStatus
'
;
interface
Props
{
interface
Props
{
...
@@ -18,10 +18,12 @@ interface Props {
...
@@ -18,10 +18,12 @@ interface Props {
}
}
const
TxInternalTableItem
=
({
type
,
status
,
from
,
to
,
value
,
gasLimit
}:
Props
)
=>
{
const
TxInternalTableItem
=
({
type
,
status
,
from
,
to
,
value
,
gasLimit
}:
Props
)
=>
{
const
typeTitle
=
TX_INTERNALS_ITEMS
.
find
(({
id
})
=>
id
===
type
)?.
title
;
return
(
return
(
<
Tr
alignItems=
"top"
>
<
Tr
alignItems=
"top"
>
<
Td
>
<
Td
>
<
Tag
colorScheme=
"cyan"
mr=
{
2
}
>
{
capitalize
(
type
)
}
</
Tag
>
{
typeTitle
&&
<
Tag
colorScheme=
"cyan"
mr=
{
2
}
>
{
typeTitle
}
</
Tag
>
}
<
TxStatus
status=
{
status
}
/>
<
TxStatus
status=
{
status
}
/>
</
Td
>
</
Td
>
<
Td
pr=
"0"
>
<
Td
pr=
"0"
>
...
...
ui/tx/internals/utils.ts
0 → 100644
View file @
92030c31
import
type
{
TxInternalsType
}
from
'
types/api/tx
'
;
interface
TxInternalsTypeItem
{
title
:
string
;
id
:
TxInternalsType
;
}
export
const
TX_INTERNALS_ITEMS
:
Array
<
TxInternalsTypeItem
>
=
[
{
title
:
'
Call
'
,
id
:
'
call
'
},
{
title
:
'
Delegate call
'
,
id
:
'
delegate_call
'
},
{
title
:
'
Static call
'
,
id
:
'
static_call
'
},
{
title
:
'
Create
'
,
id
:
'
create
'
},
{
title
:
'
Create2
'
,
id
:
'
create2
'
},
{
title
:
'
Self-destruct
'
,
id
:
'
self_destruct
'
},
{
title
:
'
Reward
'
,
id
:
'
reward
'
},
];
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment